firq-dev-website/src/components/navbarEntry.astro

62 lines
1 KiB
Text
Raw Normal View History

2023-03-04 19:11:52 +01:00
---
export interface Props {
2023-03-09 11:44:18 +01:00
currentPage?: string
link: string
text: string
icon: string
2023-03-04 19:11:52 +01:00
}
2023-03-09 11:44:18 +01:00
const { icon, text, link, currentPage } = Astro.props
2023-03-04 19:11:52 +01:00
2023-03-09 11:44:18 +01:00
let currPage = ''
const slug = link.replace(new RegExp('/', 'g'), '')
2023-03-04 19:11:52 +01:00
2023-03-04 22:35:49 +01:00
if (currentPage === slug) {
2023-03-09 11:44:18 +01:00
currPage = 'current'
} else if (currentPage === 'home' && link === '/') {
currPage = 'current'
2023-03-04 19:11:52 +01:00
}
2023-03-04 22:35:49 +01:00
2023-03-09 11:44:18 +01:00
const fulllink = `/${slug}`
2023-03-04 19:11:52 +01:00
---
<li>
2023-03-09 11:44:18 +01:00
<a
href={fulllink}
rel="noopener noreferrer"
aria-label={text}
class={currPage}
2023-07-08 21:09:48 +02:00
tabindex="0"
2023-03-09 11:44:18 +01:00
>
<i class={icon}></i>
{text}
</a>
2023-03-04 19:11:52 +01:00
</li>
<style>
2023-03-09 11:44:18 +01:00
li {
align-items: center;
justify-content: center;
text-align: left;
display: flex;
width: 200px;
}
li > a {
display: inline-flex;
2023-03-09 11:44:18 +01:00
color: white;
text-decoration: none;
justify-content: center;
2023-12-21 11:39:45 +01:00
align-items: center;
2023-03-09 11:44:18 +01:00
font-size: 1.4em;
height: 100%;
font-weight: bold;
gap: 0.2em;
2023-03-09 11:44:18 +01:00
}
li > a:hover {
color: var(--c-purplepink);
}
.current {
color: var(--c-darkpurple) !important;
2023-03-09 11:44:18 +01:00
}
</style>