Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit b2b7413

Browse files
authored
refactor(facepile): adjust more item (#1327)
1 parent 68308b7 commit b2b7413

File tree

7 files changed

+41
-28
lines changed

7 files changed

+41
-28
lines changed

src/containers/thread/KanbanThread/Actions.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ const Actions: FC = () => {
5151
</ModeWrapper>
5252
<Space right={20} />
5353
<JoinTitle>参与者</JoinTitle>
54-
<Facepile size="medium" users={mockUsers(6)} total={20} />
54+
<Facepile
55+
size="medium"
56+
users={mockUsers(6)}
57+
total={20}
58+
showTotalNumber
59+
/>
5560
{/* <Space right={25} /> */}
5661
{/* <NewButton size="medium">
5762
<BtnText>新增</BtnText>

src/widgets/Facepile/MoreItem.tsx

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

3-
import { Br } from '@/widgets/Common'
4-
import Tooltip from '@/widgets/Tooltip'
3+
// import { Br } from '@/widgets/Common'
4+
// import Tooltip from '@/widgets/Tooltip'
55

66
import type { TProps as TAvatarsProps } from './index'
77

@@ -11,9 +11,9 @@ import {
1111
Wrapper,
1212
TextMore,
1313
DotText,
14-
StateInfoWrapper,
15-
TotalCommentStateHint,
16-
Focus,
14+
// StateInfoWrapper,
15+
// TotalCommentStateHint,
16+
// Focus,
1717
} from './styles/more_item'
1818

1919
type TProps = Pick<
@@ -29,7 +29,15 @@ const MoreItem: FC<TProps> = ({
2929
}) => {
3030
return (
3131
<Wrapper size={size} onClick={() => onTotalSelect()}>
32-
<Tooltip
32+
{!showTotalNumber ? (
33+
<TextMore size={size} total={total}>
34+
<DotText>..</DotText>
35+
</TextMore>
36+
) : (
37+
<RealNumber total={total} size={size} />
38+
)}
39+
40+
{/* <Tooltip
3341
content={
3442
showTotalNumber ? (
3543
'更多'
@@ -49,14 +57,8 @@ const MoreItem: FC<TProps> = ({
4957
placement="bottom-end"
5058
noPadding
5159
>
52-
{showTotalNumber ? (
53-
<TextMore size={size} total={total}>
54-
<DotText>...</DotText>
55-
</TextMore>
56-
) : (
57-
<RealNumber total={total} size={size} />
58-
)}
59-
</Tooltip>
60+
<div>...</div>
61+
</Tooltip> */}
6062
</Wrapper>
6163
)
6264
}

src/widgets/Facepile/RealNumber.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type TProps = Pick<TAvatarsProps, 'size' | 'total'>
1010
const RealNumber: FC<TProps> = ({ total, size }) => {
1111
return (
1212
<Wrapper total={total} size={size}>
13-
{total > 15 ? (
13+
{total > 100 ? (
1414
<HighlightNumber>{prettyNum(total)}</HighlightNumber>
1515
) : (
1616
<Fragment>{prettyNum(total)}</Fragment>

src/widgets/Facepile/styles/index.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,15 @@ export const TotalOneOffset = styled.span`
2323
`
2424
type TAvatarsMore = { size: TAvatarSize; total: number }
2525
export const AvatarsMore = styled.span<TAvatarsMore>`
26+
${({ size }) => css.circle(getAvatarSize(size))};
2627
${css.flex('align-both')};
2728
font-size: 14px;
28-
border-color: ${theme('textBadge')}; // to-theme
29+
border-color: ${theme('textBadge')};
2930
color: ${theme('thread.articleTitle')};
30-
background-color: ${theme('textBadge')}; // to-theme
31-
border-radius: 100px 100px 100px 100px;
31+
background-color: ${theme('textBadge')};
3232
font-family: sans-serif;
3333
font-weight: ${({ total }) => (total >= 1000 ? 600 : 200)};
3434
35-
min-width: ${({ size }) => getAvatarSize(size)};
36-
height: ${({ size }) => getAvatarSize(size)};
37-
3835
padding-left: ${({ total }) => (total >= 1000 ? '5px' : '3px')};
3936
4037
&:hover {

src/widgets/Facepile/styles/more_item.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import styled from 'styled-components'
22

33
import css, { theme } from '@/utils/css'
4+
import { pixelAdd } from '@/utils/dom'
45

56
import { Wrapper as BaseWrapper, AvatarsMore } from './index'
67
import { getAvatarSize } from './metric'
@@ -13,7 +14,7 @@ const BaseAvatarItem = styled.li<{ size: string }>`
1314
z-index: 0;
1415
${BaseWrapper}:hover & {
1516
margin-left: 0;
16-
z-index: 1;
17+
z-index: 0;
1718
}
1819
`
1920
export const Wrapper = styled(BaseAvatarItem)`
@@ -22,9 +23,16 @@ export const Wrapper = styled(BaseAvatarItem)`
2223
export const TextMore = styled(AvatarsMore)`
2324
font-size: 20px;
2425
padding-left: 4px;
26+
27+
${({ size }) => css.circle(pixelAdd(getAvatarSize(size) as string, -2))};
28+
${css.flex('align-both')};
29+
margin-left: 1px;
2530
`
2631
export const DotText = styled.div`
27-
margin-top: -8px;
32+
color: ${theme('thread.articleTitle')};
33+
margin-top: -10px;
34+
letter-spacing: -1px;
35+
padding-right: 2px;
2836
`
2937
export const StateInfoWrapper = styled.div`
3038
width: 95px;

src/widgets/Facepile/styles/real_avatar.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export const Wrapper = styled.li<TWrapper>`
1414
padding: 0px 0px 0px 0px;
1515
position: relative;
1616
width: ${({ size }) => getLiSize(size)};
17-
/* z-index: 2; */
1817
1918
&:hover {
2019
z-index: 3;

src/widgets/Facepile/styles/real_number.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import styled from 'styled-components'
22

33
import { theme } from '@/utils/css'
4+
import { pixelAdd } from '@/utils/dom'
45

56
import { AvatarsMore } from './index'
67
import { getAvatarSize, getMoreTextWidth } from './metric'
@@ -9,13 +10,14 @@ type TWrapper = { size: string; total: number }
910
export const Wrapper = styled(AvatarsMore)<TWrapper>`
1011
background-color: ${theme('textBadge')};
1112
color: ${theme('thread.articleTitle')};
12-
height: ${({ size }) => getAvatarSize(size)};
13+
height: ${({ size }) => pixelAdd(getAvatarSize(size) as string, -2)};
14+
min-height: ${({ size }) => pixelAdd(getAvatarSize(size) as string, -2)};
1315
width: ${({ total }) => getMoreTextWidth(total)};
16+
min-width: ${({ total }) => getMoreTextWidth(total)};
1417
font-weight: 400;
1518
padding-left: 1px;
16-
padding-top: 0.5px;
1719
margin-left: 4px;
18-
border-radius: 0 10px 10px 0;
20+
border-radius: 100%;
1921
font-size: 13px;
2022
`
2123
export const HighlightNumber = styled.div`

0 commit comments

Comments
 (0)