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

Commit 27b9b21

Browse files
authored
chore(header): rm-jobs, adjust tooltip style (#1060)
1 parent 1bfc7c9 commit 27b9b21

File tree

5 files changed

+25
-38
lines changed

5 files changed

+25
-38
lines changed

src/components/Navigator/MainEntries/DesktopView.js renamed to src/components/Navigator/MainEntries/DesktopView.tsx

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ import { Wrapper, DotDivider, SiteLink, Icon } from '../styles/main_entries'
1313

1414
const splitMargin = 7
1515

16-
const DesktopView = ({ type }) => {
16+
type TProps = {
17+
type: string
18+
}
19+
20+
const DesktopView: React.FC<TProps> = ({ type }) => {
1721
const router = useRouter()
1822
const mainPath = getRouteMainPath(router.asPath)
1923

@@ -27,18 +31,11 @@ const DesktopView = ({ type }) => {
2731
发现
2832
</SiteLink>
2933
</Link>
30-
{/* <DotDivider space={splitMargin} />
31-
<SiteLink>专栏</SiteLink> */}
32-
{/* <Tooltip
33-
placement="bottom"
34-
trigger="click"
35-
content={<DiscussLinker title="专栏" addr={`${ISSUE_ADDR}/265`} />}
36-
>
37-
<SiteLink>专栏</SiteLink>
38-
</Tooltip> */}
3934
<DotDivider space={splitMargin} />
4035
<Link href={`/${ROUTE.WORKS}`} passHref>
41-
<SiteLink active={mainPath === ROUTE.WORKS}>作品集市</SiteLink>
36+
<SiteLink active={mainPath === ROUTE.WORKS} testid="header-works-link">
37+
作品集市
38+
</SiteLink>
4239
</Link>
4340
<DotDivider space={splitMargin} />
4441
<Link href={`/${ROUTE.COOL_GUIDE}`} passHref>
@@ -50,12 +47,13 @@ const DesktopView = ({ type }) => {
5047
</SiteLink>
5148
</Link>
5249
<DotDivider space={splitMargin} />
53-
<Link href={`/${ROUTE.HAVE_A_DRINK}`} passHref>
54-
<SiteLink>工作</SiteLink>
55-
</Link>
56-
<DotDivider space={splitMargin} />
5750
<Link href={`/${ROUTE.MEETUPS}`} passHref>
58-
<SiteLink active={mainPath === ROUTE.MEETUPS}>活动</SiteLink>
51+
<SiteLink
52+
active={mainPath === ROUTE.MEETUPS}
53+
testid="header-meetups-link"
54+
>
55+
活动
56+
</SiteLink>
5957
</Link>
6058
<DotDivider space={splitMargin} />
6159
<Link href={`/${ROUTE.HAVE_A_DRINK}`} passHref>
@@ -73,20 +71,12 @@ const DesktopView = ({ type }) => {
7371
hideOnClick={false}
7472
noPadding
7573
>
76-
<SiteLink>
74+
<SiteLink testid="header-more-link">
7775
更多 <Icon src={`${ICON_CMD}/arrow_down.svg`} />
7876
</SiteLink>
7977
</Tooltip>
8078
</Wrapper>
8179
)
8280
}
8381

84-
DesktopView.propTypes = {
85-
type: T.oneOfType([T.string, T.instanceOf(null)]),
86-
}
87-
88-
DesktopView.defaultProps = {
89-
type: null,
90-
}
91-
9282
export default React.memo(DesktopView)

src/components/Navigator/MainEntries/MobileView.js renamed to src/components/Navigator/MainEntries/MobileView.tsx

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,22 @@ import { send } from '@/utils'
88
// import MorePanel from '../MorePanel'
99
import { Wrapper, SiteLink, MobileIcon } from '../styles/main_entries'
1010

11-
export const openMobileNaviMenu = () => {
11+
export const openMobileNaviMenu = (): void => {
1212
send(EVENT.DRAWER.OPEN, {
1313
type: TYPE.DRAWER.MODELINE_MENU,
1414
data: TYPE.MM_TYPE.GLOBAL_MENU,
1515
options: { direction: 'top' },
1616
})
1717
}
1818

19-
const MainEntries = () => {
19+
const MainEntries: React.FC = () => {
2020
return (
21-
<Wrapper onClick={openMobileNaviMenu}>
22-
<SiteLink as="span">
21+
<Wrapper type="todo" onClick={openMobileNaviMenu}>
22+
<SiteLink as="span" testid="header-mobile">
2323
<MobileIcon src={`${ICON}/shape/more-3.svg`} />
2424
</SiteLink>
2525
</Wrapper>
2626
)
2727
}
2828

29-
MainEntries.propTypes = {
30-
// type: T.oneOfType([T.string, T.instanceOf(null)]),
31-
}
32-
33-
MainEntries.defaultProps = {
34-
// type: null,
35-
}
36-
3729
export default React.memo(MainEntries)

src/components/Navigator/styles/main_entries.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ export const DotDivider = styled(DotDividerBase)`
2020
width: 4px;
2121
height: 4px;
2222
`
23+
type TSiteLink = TTestable & TActive
2324
export const SiteLink = styled.a.attrs(({ testid }: TTestable) => ({
2425
'data-test-id': testid,
25-
}))<TTestable & TActive>`
26+
}))<TSiteLink>`
2627
${css.flex('align-center')};
2728
color: ${({ active }) =>
2829
active ? theme('banner.title') : theme('banner.desc')};

src/components/Tooltip/styles/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const StyledTippy = styled(Tippy)`
1111
color: ${theme('thread.articleDigest')};
1212
box-shadow: ${theme('popover.boxShadow')};
1313
outline: none;
14+
max-width: 480px !important;
1415
1516
border-radius: 5px;
1617
padding: 10px;
@@ -21,6 +22,9 @@ export const StyledTippy = styled(Tippy)`
2122
`
2223
export const NoPaddingStyledTippy = styled(StyledTippy)`
2324
padding: 0;
25+
.tippy-content {
26+
padding: 0;
27+
}
2428
`
2529
export const ContentWrapper = styled.div<{ contentHeight: string }>`
2630
position: relative;

0 commit comments

Comments
 (0)