-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SHARED(Frontend): Introduce NavigationLinks component to replace use …
…of MUI Tabs in header
- Loading branch information
Showing
4 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
frontend/packages/shared/src/components/NavigationLinks/NavigationLinks.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
@use '../../styles/abstracts/colors'; | ||
|
||
.navigation-links { | ||
ul { | ||
list-style-type: none; | ||
display: flex; | ||
flex-direction: row; | ||
gap: 6rem; | ||
margin: 0; | ||
|
||
> li { | ||
padding-bottom: 2rem; | ||
> a { | ||
text-decoration: none; | ||
} | ||
} | ||
|
||
li.active { | ||
p { | ||
color: colors.$color-secondary; | ||
font-weight: 700; | ||
} | ||
border-bottom: 2px solid colors.$color-secondary; | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
frontend/packages/shared/src/components/NavigationLinks/NavigationLinks.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Text } from '../Text/Text'; | ||
import { Link } from 'react-router-dom'; | ||
import './NavigationLinks.scss'; | ||
|
||
interface NavigationLinksProps { | ||
navigationAriaLabel: string; | ||
links: Array<NavigationLink>; | ||
} | ||
|
||
interface NavigationLink { | ||
active: boolean; | ||
href: string; | ||
label: string; | ||
} | ||
|
||
export const NavigationLinks = ({ | ||
navigationAriaLabel, | ||
links, | ||
}: NavigationLinksProps) => { | ||
return ( | ||
<nav className="navigation-links" aria-label={navigationAriaLabel}> | ||
<ul> | ||
{links.map((l, i) => ( | ||
<li key={i} className={l.active ? 'active' : undefined}> | ||
<Link to={l.href} aria-current={l.active && 'page'}> | ||
<Text>{l.label}</Text> | ||
</Link> | ||
</li> | ||
))} | ||
</ul> | ||
</nav> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters