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

Commit 886515f

Browse files
authored
feat(article-footer): add cat select concept (#1323)
* chore: adjust tags & upvote for posts * chore: add cat to article footer & re-org
1 parent 80f502c commit 886515f

File tree

25 files changed

+296
-116
lines changed

25 files changed

+296
-116
lines changed

src/containers/unit/ArticleFooter/Panel/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ type TProps = {
3737

3838
export const TAB_ITEMS = [
3939
{
40-
title: '关于作者',
40+
title: '帖作者',
4141
raw: 'author-info',
4242
},
4343
{

src/containers/unit/ArticleFooter/TagList.tsx

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/containers/unit/ArticleFooter/index.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,20 @@
66

77
import { FC, useState } from 'react'
88

9-
import type { TCopyright, TMetric } from '@/spec'
9+
import type { TArticleCat, TMetric } from '@/spec'
1010
import { METRIC } from '@/constant'
1111

1212
import { buildLog } from '@/utils/logger'
1313
import { bond } from '@/utils/mobx'
1414

15-
import Copyright from '@/widgets/Copyright'
15+
import ArticleCatLabel from '@/widgets/ArticleCatLabel'
1616
import { SpaceGrow } from '@/widgets/Common'
17+
import TagsList from '@/widgets/TagsList'
1718

18-
// import TagList from '@/widgets/TagList'
19-
20-
import TagList from './TagList'
2119
import Panel from './Panel'
2220

2321
import type { TStore } from './store'
24-
import { Wrapper, BaseInfo } from './styles'
22+
import { Wrapper, BaseInfo, CatLabelWrapper } from './styles'
2523
import { useInit } from './logic'
2624

2725
/* eslint-disable-next-line */
@@ -42,18 +40,20 @@ const ArticleFooterContainer: FC<TProps> = ({
4240
const { viewingArticle } = store
4341
const { author, articleTags } = viewingArticle
4442

45-
const [copyright, setCopyright] = useState('cc')
43+
const [cat, setCat] = useState('feature')
4644

4745
return (
4846
<Wrapper testid={testid}>
4947
<BaseInfo>
50-
<TagList items={articleTags} />
51-
<Copyright
52-
type={copyright as TCopyright}
53-
mode="readonly"
54-
onChange={(key) => setCopyright(key)}
55-
/>
56-
<SpaceGrow />
48+
<TagsList items={articleTags} size="small" />
49+
<CatLabelWrapper>
50+
<ArticleCatLabel
51+
type={cat as TArticleCat}
52+
mode="readonly"
53+
onChange={(key) => setCat(key)}
54+
/>
55+
</CatLabelWrapper>
56+
<div>Emoji</div>
5757
</BaseInfo>
5858

5959
<Panel author={author} />

src/containers/unit/ArticleFooter/styles/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const Wrapper = styled.div.attrs(({ testid }: TTestable) => ({
88
}))<TTestable>``
99

1010
export const BaseInfo = styled.div`
11-
${css.flex('align-center')};
11+
${css.flex('align-center', 'justify-between')};
1212
margin-bottom: 30px;
1313
padding-left: 0;
1414
padding-right: 10px;
@@ -17,3 +17,7 @@ export const BaseInfo = styled.div`
1717
margin-top: 20px;
1818
`};
1919
`
20+
21+
export const CatLabelWrapper = styled.div`
22+
margin-left: -25px;
23+
`

src/containers/unit/ArticleFooter/styles/panel/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const Wrapper = styled.div.attrs(({ testid }: TTestable) => ({
2121
export const TabsWrapper = styled.div`
2222
position: absolute;
2323
top: -36px;
24-
left: -15px;
24+
left: -14px;
2525
`
2626
export const ReportWrapper = styled.div`
2727
position: absolute;

src/containers/unit/ArticleFooter/styles/tag_list.ts

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/containers/unit/TagsBar/DesktopView/Folder.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ const Folder: FC<TProps> = ({
111111
>
112112
<SubTogglePrefixIcon />
113113
<SubToggleTitle>
114-
{curDisplayCount === maxDisplayCount ? '展开全部' : '收起'}
114+
{curDisplayCount === maxDisplayCount ? '展开' : '收起'}
115115
</SubToggleTitle>
116116
</SubToggle>
117117
)}

src/containers/unit/TagsBar/DesktopView/TagItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const TagItem: FC<TProps> = ({ tag, active, onSelect }) => {
3030
<DotSign color={tag.color} $active={active} />
3131
</DotWrapper>
3232
<Tag $active={active} color={tag.color} onClick={() => onSelect(tag)}>
33-
<Title color={tag.color}>{cutRest(Trans(tag.title), 10)}</Title>
33+
<Title>{cutRest(Trans(tag.title), 10)}</Title>
3434
<RawWrapper $active={active}>
3535
{/* <DotDivider radius={2} space={6} /> */}
3636
<Raw>{tag.raw}</Raw>

src/containers/unit/TagsBar/styles/desktop_view/folder.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,52 +10,58 @@ export const Header = styled.div<TActive>`
1010
${css.flex('align-center')};
1111
display: ${({ show }) => (show ? 'flex' : 'none')};
1212
margin-bottom: 8px;
13+
margin-left: -25px;
1314
&:hover {
1415
cursor: pointer;
1516
}
1617
`
1718
export const ArrowIcon = styled(ArrowSVG)<{ $isOpen: boolean }>`
1819
fill: ${theme('tags.text')};
1920
${css.size(16)};
20-
opacity: 0.5;
21+
opacity: 0;
2122
transform: ${({ $isOpen }) =>
2223
$isOpen ? 'rotate(270deg)' : 'rotate(180deg)'};
2324
transition: transform 0.5s;
25+
26+
${Wrapper}:hover & {
27+
opacity: 0.6;
28+
}
29+
2430
${Header}:hover & {
25-
opacity: 0.65;
31+
opacity: 1;
2632
}
33+
transition: all 0.2s;
2734
`
2835
export const Title = styled.div`
2936
${css.flex('align-center')};
3037
margin-left: 7px;
3138
`
3239
export const FolderTitle = styled.div`
3340
color: ${theme('thread.extraInfo')};
41+
opacity: 0.65;
3442
margin-left: 4px;
35-
font-size: 14px;
43+
font-weight: 500;
44+
font-size: 13px;
3645
margin-right: 8px;
3746
${css.cutRest('85px')};
3847
3948
${Header}:hover & {
40-
opacity: 0.65;
49+
opacity: 1;
4150
}
4251
`
4352
export const Count = styled.div`
44-
color: ${theme('thread.articleTitle')};
53+
color: ${theme('thread.extraInfo')};
4554
font-size: 13px;
46-
margin-top: 2px;
4755
4856
&:before {
4957
content: '(';
5058
margin-right: 2px;
5159
font-size: 12px;
52-
color: ${theme('thread.articleDigest')};
5360
}
5461
&:after {
5562
content: ')';
5663
margin-left: 2px;
5764
font-size: 12px;
58-
color: ${theme('thread.articleDigest')};
5965
}
6066
`
6167

@@ -71,7 +77,7 @@ export const SubToggle = styled.div`
7177
opacity: 0.8;
7278
7379
&:hover {
74-
opacity: 0.1;
80+
opacity: 1;
7581
cursor: pointer;
7682
}
7783
`
@@ -84,5 +90,6 @@ export const SubToggleTitle = styled.div`
8490
`
8591
export const SubTogglePrefixIcon = styled(MoreSVG)`
8692
fill: ${theme('thread.extraInfo')};
87-
${css.size(13)};
93+
${css.size(12)};
94+
margin-right: 2px;
8895
`

src/containers/unit/TagsBar/styles/desktop_view/tag_item.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const Wrapper = styled.div<TTag>`
1616
max-width: 180px;
1717
border-radius: 5px;
1818
19-
background: ${({ $active }) => (!$active ? 'transparent' : '#0e303d')};
19+
background: ${({ $active }) => (!$active ? 'transparent' : theme('hoverBg'))};
2020
2121
&:hover {
2222
background: ${theme('textBadge')}; // to-theme
@@ -69,21 +69,19 @@ export const Tag = styled.div<TTag>`
6969
width: 100%;
7070
font-size: 14px;
7171
padding-left: 4px;
72-
color: ${({ color, $active }) =>
73-
!$active ? theme('tags.text') : theme(`baseColor.${color.toLowerCase()}`)};
7472
75-
/* color: ${({ color }) => theme(`baseColor.${color.toLowerCase()}`)}; */
73+
font-weight: ${({ $active }) => (!$active ? 'bold' : 'normal')};
7674
7775
${Wrapper}:hover & {
7876
cursor: pointer;
7977
}
8078
8179
transition: all 0.1s;
8280
`
83-
export const Title = styled.div<THashSign>`
81+
export const Title = styled.div`
8482
letter-spacing: 1px;
8583
font-weight: 400;
86-
color: ${({ color }) => theme(`baseColor.${color.toLowerCase()}`)};
84+
color: ${theme('tags.text')};
8785
filter: saturate(0);
8886
8987
${Wrapper}:hover & {

0 commit comments

Comments
 (0)