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.

Commitf212663

Browse files
committed
refactor(header): add highlighter for non 'home' routes
1 parent88fc51d commitf212663

File tree

6 files changed

+17
-10
lines changed

6 files changed

+17
-10
lines changed

‎components/Navigator/BriefView.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import MainEntries from './MainEntries'
2121

2222
constCommunityLogoHolder=`${ICON_CMD}/community_logo_holder.svg`
2323

24-
constBriefView=({ community})=>(
24+
constBriefView=({ community, curRoute})=>(
2525
<Wrapper>
2626
<Popover
2727
placement="bottomLeft"
@@ -44,7 +44,7 @@ const BriefView = ({ community }) => (
4444
</Popover>
4545
<Breadcrumbs>
4646
<BetaLogosrc={`${ICON_CMD}/beta.svg`}/>
47-
<MainEntries/>
47+
<MainEntriescurRoute={curRoute}/>
4848
</Breadcrumbs>
4949
</Wrapper>
5050
)

‎components/Navigator/DigestView.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414

1515
importMainEntriesfrom'./MainEntries'
1616

17-
constDigestView=()=>(
17+
constDigestView=({ curRoute})=>(
1818
<Breadcrumbs>
1919
<Logo/>
2020
<Popover
@@ -31,7 +31,7 @@ const DigestView = () => (
3131
<LogoTexthref="/home/posts">coderplanets</LogoText>
3232
</Popover>
3333
<BetaLogosrc={`${ICON_CMD}/beta.svg`}/>
34-
<MainEntries/>
34+
<MainEntriescurRoute={curRoute}/>
3535
</Breadcrumbs>
3636
)
3737

‎components/Navigator/MainEntries.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ import DiscussLinker from '@components/DiscussLinker'
88
import{Wrapper,DotDivider,SiteLink}from'./styles/main_entries'
99

1010
constsplitMargin='8px'
11-
constMainEntries=()=>(
11+
12+
constMainEntries=({curRoute:{ mainPath}})=>(
1213
<Wrapper>
1314
<Linkhref="/home/posts"prefetchpassHref>
1415
<SiteLink>首页</SiteLink>
1516
</Link>
1617
<DotDividerspace={splitMargin}/>
1718
<Linkhref="/communities"prefetchpassHref>
18-
<SiteLink>社区</SiteLink>
19+
<SiteLinkactive={mainPath==='communities'}>社区</SiteLink>
1920
</Link>
2021
<DotDividerspace={splitMargin}/>
2122
<Popover

‎components/Navigator/index.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ const Navigator = ({ curCommunity, layout, curRoute }) => {
2424
R.contains(mainPath,[ROUTE.USER,ROUTE.COMMUNITIES])||
2525
R.contains(subPath,[ROUTE.POST,ROUTE.JOB,ROUTE.VIDEO,ROUTE.REPO])
2626
){
27-
return<DigestView/>
27+
return<DigestViewcurRoute={curRoute}/>
2828
}
2929

3030
return(
3131
<React.Fragment>
3232
{layout===C11N.DIGEST ?(
33-
<DigestView/>
33+
<DigestViewcurRoute={curRoute}/>
3434
) :(
35-
<BriefViewcommunity={curCommunity}/>
35+
<BriefViewcommunity={curCommunity}curRoute={curRoute}/>
3636
)}
3737
</React.Fragment>
3838
)

‎components/Navigator/styles/main_entries.js‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ export const DotDivider = styled(DotDividerBase)`
1515
`
1616
exportconstSiteLink=styled.a`
1717
color:${theme('banner.desc')};
18+
background:${({ active})=>
19+
active ?theme('banner.numberHoverBg') :'transparent'};
20+
padding:${({ active})=>(active ?'5px 3px 3px 3px' :'0')};
21+
border-bottom:${({ active})=>(active ?'2px solid' :'none')};
22+
border-bottom-color:${({ active})=>
23+
active ?theme('tabs.headerActive') :''};
24+
1825
cursor: pointer;
1926
&:hover {
2027
text-decoration: underline;

‎containers/Header/styles/header.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export const InnerWrapper = styled.div`
2929
exportconstRouterWrapper=styled.div`
3030
${cs.flexGrow('align-center')};
3131
height: 100%;
32-
margin-top: 1px;
3332
`
3433
exportconstHeaderSearchIcon=styled(HeaderSearchSVG).attrs(props=>({
3534
'data-testid':props.testid,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp