Skip to content
This repository was archived by the owner on Nov 3, 2025. It is now read-only.

Commit b632b4e

Browse files
committed
add routing gui
1 parent eba33a0 commit b632b4e

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

src/lib/navbar.svelte

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,30 @@
33
<script lang="ts">
44
import Menu from "$lib/Menu.svelte";
55
import MenuItem from "$lib/MenuItem.svelte";
6-
</script>
76
8-
<!-- <div id="navbar">
9-
<a class="nav-item" id="logo" href="/">
10-
<img src="/Logo.png" alt="home" />
11-
</a>
12-
<a class="nav-item" id="about" href="/about">About</a>
13-
<a class="nav-item" id="games" href="/">Games</a>
14-
</div> -->
7+
let { pageName = "" } = $props();
8+
9+
const isActive = (tabName: string) => {
10+
return tabName === pageName ? "active" : "";
11+
};
12+
</script>
1513

1614
<ul id="navbar">
17-
<li class="navbar-item" id="logo">
15+
<li class="navbar-item {isActive('Index')}" id="logo">
1816
<a href="/"><img src="/Logo.png" alt="home" /></a>
1917
</li>
2018
<!-- margin left auto to move to the right, also moves all children after to the right -->
2119
<li style="margin-left: auto;">
2220
<Menu>
23-
<a href="/" id="games" slot="toggle">Games</a>
21+
<a class={isActive("Games")} href="/" id="games" slot="toggle"
22+
>Games</a
23+
>
2424
<MenuItem class="menu-item"
2525
><a href="/FarmingDragons">Farming Dragons</a></MenuItem
2626
>
2727
</Menu>
2828
</li>
29-
<li class="navbar-item">
29+
<li class="navbar-item {isActive('About')}">
3030
<a href="/about"><span id="about">About</span></a>
3131
</li>
3232
</ul>
@@ -88,4 +88,9 @@
8888
color: white;
8989
text-decoration: none;
9090
}
91+
92+
.active {
93+
background-color: #222;
94+
border-radius: 10px 10px 0 0;
95+
}
9196
</style>

src/routes/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import Navbar from "$lib/navbar.svelte";
44
</script>
55

6-
<navbar-component></navbar-component>
6+
<navbar-component pageName="Index"></navbar-component>
77

88
<h1>Welcome to Bread Bird Games</h1>
99
<p>This site is in development. go away</p>

src/routes/about/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
import Navbar from "$lib/navbar.svelte";
44
</script>
55

6-
<navbar-component></navbar-component>
6+
<navbar-component pageName="About"></navbar-component>
77

88
<h1>Who are we? some may call us gay, some may call us freaks!</h1>

0 commit comments

Comments
 (0)