mirror of
https://github.com/ReVanced/revanced-website.git
synced 2026-01-11 13:46:17 +00:00
feat: add navbar
This commit is contained in:
57
src/lib/components/molecules/NavBar.svelte
Normal file
57
src/lib/components/molecules/NavBar.svelte
Normal file
@@ -0,0 +1,57 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/state';
|
||||
|
||||
const navItems = [
|
||||
{ label: 'Home', href: '/' },
|
||||
{ label: 'Download', href: '/download' },
|
||||
{ label: 'Patches', href: '/patches' },
|
||||
{ label: 'Contributors', href: '/contributors' },
|
||||
{ label: 'Donate', href: '/donate' }
|
||||
] as const satisfies { label: string; href: string }[];
|
||||
</script>
|
||||
|
||||
<nav>
|
||||
<ul>
|
||||
{#each navItems as { href, label }}
|
||||
<li>
|
||||
<a {href} class:active={page.url.pathname === href}>
|
||||
{label}
|
||||
</a>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<style>
|
||||
nav {
|
||||
padding: 1rem;
|
||||
background: #f5f5f5;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
ul {
|
||||
display: flex;
|
||||
gap: 1.5rem;
|
||||
list-style: none;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 4px;
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
background-color: #e0e0e0;
|
||||
}
|
||||
|
||||
a.active {
|
||||
color: #fff;
|
||||
background-color: #333;
|
||||
}
|
||||
</style>
|
||||
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import '../app.css';
|
||||
import favicon from '$assets/favicon.ico';
|
||||
import NavBar from '$components/molecules/NavBar.svelte';
|
||||
import type { WithChildren } from '$types';
|
||||
|
||||
let { children }: WithChildren = $props();
|
||||
@@ -10,4 +11,5 @@
|
||||
<link rel="icon" href={favicon} />
|
||||
</svelte:head>
|
||||
|
||||
<NavBar />
|
||||
{@render children()}
|
||||
|
||||
Reference in New Issue
Block a user