Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit4396e17

Browse files
authored
feat(dashboard): basic admin editor UI (#1348)
* chore: adjust tab drawer switch style* feat(dashboard): basic admin setter & re-org
1 parent4e1ece4 commit4396e17

File tree

15 files changed

+259
-70
lines changed

15 files changed

+259
-70
lines changed

‎src/containers/thread/AboutThread/Members/AdminMember.tsx‎

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
import{FC,memo}from'react'
22

33
importtype{TUser}from'@/spec'
4+
importAdminAvatarfrom'@/widgets/AdminAvatar'
45

5-
import{
6-
Wrapper,
7-
AvatarWrapper,
8-
Avatar,
9-
BadgeWrapper,
10-
BadgeIcon,
11-
Info,
12-
Name,
13-
Bio,
14-
}from'../styles/members/admin_member'
6+
import{Wrapper,Info,Name,Bio}from'../styles/members/admin_member'
157

168
typeTProps={
179
user:TUser
@@ -20,12 +12,7 @@ type TProps = {
2012
constAdminMember:FC<TProps>=({ user})=>{
2113
return(
2214
<Wrapper>
23-
<AvatarWrapper>
24-
<Avatarsrc={user.avatar}/>
25-
<BadgeWrapper>
26-
<BadgeIcon/>
27-
</BadgeWrapper>
28-
</AvatarWrapper>
15+
<AdminAvataruser={user}right={10}/>
2916
<Info>
3017
<Name>{user.nickname}</Name>
3118
<Bio>{user.bio}</Bio>
Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,11 @@
11
importstyledfrom'styled-components'
22

33
importcss,{theme}from'@/utils/css'
4-
importImgfrom'@/Img'
5-
importAdminStarSVGfrom'@/icons/AdminStar'
64

75
exportconstWrapper=styled.div`
86
${css.flex('align-start')};
97
margin-bottom: 15px;
108
`
11-
exportconstAvatarWrapper=styled.div`
12-
position: relative;
13-
`
14-
exportconstAvatar=styled(Img)`
15-
${css.circle(40)};
16-
margin-right: 10px;
17-
margin-bottom: 20px;
18-
border: 2px solid;
19-
border-color:${theme('thread.articleTitle')};
20-
padding: 2px;
21-
`
22-
exportconstBadgeWrapper=styled.div`
23-
${css.circle(14)};
24-
${css.flex('align-both')};
25-
background:${theme('thread.articleTitle')};
26-
padding: 1px;
27-
border: 2px solid white;
28-
position: absolute;
29-
right: 10px;
30-
bottom: 18px;
31-
z-index: 2;
32-
`
339
exportconstInfo=styled.div``
3410
exportconstName=styled.div`
3511
${css.cutRest('140px')};
@@ -45,7 +21,3 @@ export const Bio = styled.div`
4521
opacity: 0.8;
4622
padding-right: 22px;
4723
`
48-
exportconstBadgeIcon=styled(AdminStarSVG)`
49-
${css.size(10)};
50-
fill: white;
51-
`

‎src/containers/thread/AboutThread/styles/members/index.ts‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
importstyledfrom'styled-components'
22

33
importtype{TTestable}from'@/spec'
4+
importImgfrom'@/Img'
45
importcss,{theme}from'@/utils/css'
56

6-
import{AvatarasAdminAvatar}from'./admin_member'
7-
87
exportconstWrapper=styled.div.attrs(({ testid}:TTestable)=>({
98
'data-test-id':testid,
109
}))<TTestable>`
@@ -47,8 +46,8 @@ export const Admin = styled.div`
4746
${css.flex('align-start')};
4847
width: 33.3%;
4948
`
50-
exportconstNormalAvatar=styled(AdminAvatar)`
51-
${css.circle(30)};
52-
margin-bottom: 10px;
53-
border: none;
49+
exportconstNormalAvatar=styled(Img)`
50+
${css.circle(26)};
51+
margin-right: 10px;
52+
margin-bottom: 16px;
5453
`
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import{FC,memo}from'react'
2+
3+
import{Space}from'@/widgets/Common'
4+
import{Wrapper,Inputer,PlusIcon,AddButton}from'../styles/admin/adder'
5+
6+
constAdder:FC=()=>{
7+
return(
8+
<Wrapper>
9+
<Inputerplaceholder="账户名称 / 登入ID"/>
10+
<Spaceright={30}/>
11+
<AddButtonsize="small">
12+
<PlusIcon/>
13+
管理员
14+
</AddButton>
15+
</Wrapper>
16+
)
17+
}
18+
19+
exportdefaultmemo(Adder)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import{FC,memo}from'react'
2+
3+
import{mockUsers}from'@/utils/mock'
4+
5+
import{SpaceGrow}from'@/widgets/Common'
6+
importDropdownButtonfrom'@/widgets/Buttons/DropdownButton'
7+
importAdminAvatarfrom'@/widgets/AdminAvatar'
8+
9+
import{
10+
Wrapper,
11+
User,
12+
Intro,
13+
Title,
14+
Name,
15+
Login,
16+
Bio,
17+
}from'../styles/admin/list'
18+
19+
constList:FC=()=>{
20+
return(
21+
<Wrapper>
22+
{mockUsers(5).map((item)=>(
23+
<Userkey={item.login}>
24+
<AdminAvataruser={item}right={14}top={5}/>
25+
<Intro>
26+
<Title>
27+
<Name>{item.nickname}</Name>
28+
<Login>@{item.login}</Login>
29+
<SpaceGrow/>
30+
<DropdownButtontop={2}>全部</DropdownButton>
31+
</Title>
32+
<Bio>{item.bio}</Bio>
33+
</Intro>
34+
</User>
35+
))}
36+
</Wrapper>
37+
)
38+
}
39+
40+
exportdefaultmemo(List)

‎src/containers/thread/DashboardThread/Admin/index.tsx‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import{FC,memo}from'react'
22

3+
importArrowButtonfrom'@/widgets/Buttons/ArrowButton'
4+
import{Inline}from'@/widgets/Common'
5+
6+
importPortalfrom'../Portal'
7+
importAdderfrom'./Adder'
8+
importListfrom'./List'
9+
310
import{Wrapper}from'../styles/admin'
411

512
typeTProps={
@@ -9,7 +16,21 @@ type TProps = {
916
constAdmin:FC<TProps>=({ testid='admin'})=>{
1017
return(
1118
<Wrapper>
12-
<div>Admin</div>
19+
<Portal
20+
title="管理员"
21+
desc={
22+
<>
23+
添加可参与社区内容管理的账号。
24+
<Inline>
25+
<ArrowButtonsize="tiny"arrowStyle="simple">
26+
设置参考
27+
</ArrowButton>
28+
</Inline>
29+
</>
30+
}
31+
/>
32+
<Adder/>
33+
<List/>
1334
</Wrapper>
1435
)
1536
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
importstyledfrom'styled-components'
2+
3+
importcssfrom'@/utils/css'
4+
importInputfrom'@/widgets/Input'
5+
importButtonfrom'@/widgets/Buttons/Button'
6+
importPlusSVGfrom'@/icons/Plus'
7+
8+
exportconstWrapper=styled.div`
9+
${css.flex('align-center')};
10+
margin-bottom: 42px;
11+
`
12+
exportconstInputer=styled(Input)`
13+
height: 35px;
14+
font-size: 13px;
15+
`
16+
exportconstPlusIcon=styled(PlusSVG)`
17+
${css.size(13)};
18+
fill: white;
19+
margin-right: 8px;
20+
`
21+
exportconstAddButton=styled(Button)`
22+
border-radius: 5px;
23+
height: 32px;
24+
padding: 4px 15px;
25+
width: 130px;
26+
`

‎src/containers/thread/DashboardThread/styles/admin/index.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import styled from 'styled-components'
33
importcssfrom'@/utils/css'
44

55
exportconstWrapper=styled.div`
6-
${css.flex()};
6+
${css.flexColumn()};
7+
padding: 0 120px;
8+
padding-left: 80px;
79
`
810

911
exportconstTitle=styled.div``
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
importstyledfrom'styled-components'
2+
3+
importcss,{theme}from'@/utils/css'
4+
5+
exportconstWrapper=styled.div`
6+
${css.flexColumn()};
7+
`
8+
exportconstUser=styled.div`
9+
${css.flex()};
10+
margin-bottom: 25px;
11+
`
12+
exportconstIntro=styled.div`
13+
width: 100%;
14+
`
15+
exportconstTitle=styled.div`
16+
${css.flex('align-center')};
17+
font-weight: 600;
18+
`
19+
exportconstName=styled.div`
20+
color:${theme('thread.articleTitle')};
21+
font-size: 16px;
22+
`
23+
exportconstLogin=styled.div`
24+
color:${theme('lightText')};
25+
font-size: 14px;
26+
margin-left: 10px;
27+
`
28+
exportconstBio=styled.div`
29+
color:${theme('lightText')};
30+
font-size: 14px;
31+
width: 75%;
32+
`

‎src/widgets/AdminAvatar/index.tsx‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
*
3+
* AdminAvatar
4+
*
5+
*/
6+
7+
import{FC,memo}from'react'
8+
9+
importtype{TUser,TSpace}from'@/spec'
10+
import{buildLog}from'@/utils/logger'
11+
12+
import{Wrapper,Avatar,BadgeWrapper,BadgeIcon}from'./styles'
13+
14+
/* eslint-disable-next-line */
15+
constlog=buildLog('c:AdminAvatar:index')
16+
17+
typeTProps={
18+
testid?:string
19+
user:TUser
20+
}&TSpace
21+
22+
constAdminAvatar:FC<TProps>=({
23+
testid='admin-avatar',
24+
user,
25+
...restProps
26+
})=>{
27+
return(
28+
<Wrappertestid={testid}{...restProps}>
29+
<Avatarsrc={user.avatar}/>
30+
<BadgeWrapper>
31+
<BadgeIcon/>
32+
</BadgeWrapper>
33+
</Wrapper>
34+
)
35+
}
36+
37+
exportdefaultmemo(AdminAvatar)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp