Skip to content

Commit

Permalink
Merge pull request #678 from filipedeschamps/preview
Browse files Browse the repository at this point in the history
feat(header): set header link to active (#675)
  • Loading branch information
filipedeschamps authored Aug 25, 2022
2 parents 47dc3d8 + f24e8a7 commit ca045b5
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions pages/interface/components/Header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,37 @@ import { Header, Box, ActionMenu, ActionList, IconButton, Truncate, Text, Toolti
import { PersonFillIcon, HomeIcon, SquareFillIcon } from '@primer/octicons-react';
import { CgTab } from 'react-icons/cg';
import { useUser } from 'pages/interface/index.js';
import { useRouter } from 'next/router';

export default function HeaderComponent() {
const { user, isLoading, logout } = useUser();
const { pathname } = useRouter();

const activeLinkStyle = {
textDecoration: 'underline',
textUnderlineOffset: 6,
};

return (
<Header>
<Header.Item>
<Header.Link href="/" fontSize={2}>
<Header.Link href="/" fontSize={2} sx={(pathname === '/' || pathname.startsWith('/pagina')) && activeLinkStyle}>
<CgTab size={32} />
<Box sx={{ ml: 2, display: ['none', 'block'] }}>TabNews</Box>
<Box sx={{ ml: 2 }}>Relevantes</Box>
</Header.Link>
</Header.Item>

<Header.Item>
<Header.Link href="/recentes" fontSize={2}>
<Header.Link href="/recentes" fontSize={2} sx={pathname.startsWith('/recentes') && activeLinkStyle}>
Recentes
</Header.Link>
</Header.Item>

<Header.Item full>
<Header.Link href="/status" fontSize={2}>
<Header.Link
href="/status"
fontSize={2}
sx={{ display: ['none', 'block'], ...(pathname.startsWith('/status') && activeLinkStyle) }}>
Status
</Header.Link>
</Header.Item>
Expand Down

1 comment on commit ca045b5

@vercel
Copy link

@vercel vercel bot commented on ca045b5 Aug 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

tabnews – ./

tabnews.com.br
tabnews-git-main-tabnews.vercel.app
www.tabnews.com.br
tabnews-tabnews.vercel.app

Please sign in to comment.