This repository was archived by the owner on Nov 8, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +106
-27
lines changed
containers/thread/AboutThread Expand file tree Collapse file tree 5 files changed +106
-27
lines changed Original file line number Diff line number Diff line change 1+ import { FC , memo } from 'react'
2+
3+ import type { TUser } from '@/spec'
4+
5+ import {
6+ Wrapper ,
7+ AvatarWrapper ,
8+ Avatar ,
9+ BadgeWrapper ,
10+ BadgeIcon ,
11+ Info ,
12+ Name ,
13+ Bio ,
14+ } from '../styles/members/admin_member'
15+
16+ type TProps = {
17+ user : TUser
18+ }
19+
20+ const AdminMember : FC < TProps > = ( { user } ) => {
21+ return (
22+ < Wrapper >
23+ < AvatarWrapper >
24+ < Avatar src = { user . avatar } />
25+ < BadgeWrapper >
26+ < BadgeIcon />
27+ </ BadgeWrapper >
28+ </ AvatarWrapper >
29+ < Info >
30+ < Name > { user . nickname } </ Name >
31+ < Bio > { user . bio } </ Bio >
32+ </ Info >
33+ </ Wrapper >
34+ )
35+ }
36+
37+ export default memo ( AdminMember )
Original file line number Diff line number Diff line change 11import { FC , memo } from 'react'
22
33import { mockUsers } from '@/utils/mock'
4+ import AdminMember from './AdminMember'
45
56import {
67 Wrapper ,
@@ -10,12 +11,8 @@ import {
1011 Title ,
1112 Row ,
1213 Admin ,
13- AdminInfo ,
14- Name ,
15- Bio ,
16- AdminAvatar ,
1714 NormalAvatar ,
18- } from './styles/members'
15+ } from '.. /styles/members'
1916
2017const Members : FC = ( ) => {
2118 return (
@@ -24,15 +21,10 @@ const Members: FC = () => {
2421 < Header >
2522 < Title > 团队成员</ Title >
2623 </ Header >
27-
2824 < Row >
2925 { mockUsers ( 6 ) . map ( ( user ) => (
3026 < Admin key = { user . id } >
31- < AdminAvatar src = { user . avatar } />
32- < AdminInfo >
33- < Name > { user . nickname } </ Name >
34- < Bio > { user . bio } </ Bio >
35- </ AdminInfo >
27+ < AdminMember user = { user } />
3628 </ Admin >
3729 ) ) }
3830 </ Row >
Original file line number Diff line number Diff line change 1+ import styled from 'styled-components'
2+
3+ import css , { theme } from '@/utils/css'
4+ import Img from '@/Img'
5+ import AdminStarSVG from '@/icons/AdminStar'
6+
7+ export const Wrapper = styled . div `
8+ ${ css . flex ( 'align-start' ) } ;
9+ `
10+ export const AvatarWrapper = styled . div `
11+ position: relative;
12+ `
13+ export const Avatar = styled ( Img ) `
14+ ${ css . circle ( 46 ) } ;
15+ margin-right: 10px;
16+ margin-bottom: 20px;
17+ border: 2px solid;
18+ border-color: ${ theme ( 'thread.articleTitle' ) } ;
19+ padding: 2px;
20+ `
21+ export const BadgeWrapper = styled . div `
22+ ${ css . circle ( 14 ) } ;
23+ ${ css . flex ( 'align-both' ) } ;
24+ background: ${ theme ( 'thread.articleTitle' ) } ;
25+ padding: 1px;
26+ border: 2px solid white;
27+ position: absolute;
28+ right: 10px;
29+ bottom: 18px;
30+ z-index: 2;
31+ `
32+ export const Info = styled . div ``
33+ export const Name = styled . div `
34+ color: ${ theme ( 'thread.articleTitle' ) } ;
35+ font-size: 14px;
36+ `
37+ export const Bio = styled . div `
38+ color: ${ theme ( 'thread.articleDigest' ) } ;
39+ font-size: 12px;
40+ ${ css . cutRest ( '100px' ) } ;
41+ `
42+ export const BadgeIcon = styled ( AdminStarSVG ) `
43+ ${ css . size ( 10 ) } ;
44+ fill: white;
45+ `
Original file line number Diff line number Diff line change @@ -2,7 +2,8 @@ import styled from 'styled-components'
22
33import type { TTestable } from '@/spec'
44import css , { theme } from '@/utils/css'
5- import Img from '@/Img'
5+
6+ import { Avatar as AdminAvatar } from './admin_member'
67
78export const Wrapper = styled . div . attrs ( ( { testid } : TTestable ) => ( {
89 'data-test-id' : testid ,
@@ -59,22 +60,8 @@ export const Admin = styled.div`
5960 ${ css . flex ( 'align-start' ) } ;
6061 width: 33%;
6162`
62- export const AdminInfo = styled . div ``
63- export const Name = styled . div `
64- color: ${ theme ( 'thread.articleTitle' ) } ;
65- font-size: 14px;
66- `
67- export const Bio = styled . div `
68- color: ${ theme ( 'thread.articleDigest' ) } ;
69- font-size: 12px;
70- ${ css . cutRest ( '100px' ) } ;
71- `
72- export const AdminAvatar = styled ( Img ) `
73- ${ css . circle ( 46 ) } ;
74- margin-right: 10px;
75- margin-bottom: 20px;
76- `
7763export const NormalAvatar = styled ( AdminAvatar ) `
7864 ${ css . circle ( 30 ) } ;
7965 margin-bottom: 10px;
66+ border: none;
8067`
Original file line number Diff line number Diff line change 1+ import { memo , SVGProps } from 'react'
2+
3+ const AdminStar = ( props : SVGProps < SVGSVGElement > ) => {
4+ return (
5+ < svg
6+ className = "icon"
7+ viewBox = "0 0 1024 1024"
8+ xmlns = "http://www.w3.org/2000/svg"
9+ width = { 200 }
10+ height = { 200 }
11+ { ...props }
12+ >
13+ < path d = "m908.1 353.1-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3-12.3 12.7-12.1 32.9.6 45.3l183.7 179.1-43.4 252.9c-1.2 6.9-.1 14.1 3.2 20.3 8.2 15.6 27.6 21.7 43.2 13.4L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3z" />
14+ </ svg >
15+ )
16+ }
17+
18+ export default memo ( AdminStar )
You can’t perform that action at this time.
0 commit comments