thomaswilson-sveltekit/src/lib/components/Navbar.svelte

83 lines
1.4 KiB
Svelte
Raw Normal View History

2024-03-17 09:33:22 +00:00
<script lang="ts">
import { colourSchemeStore, lightColourScheme, darkColourScheme } from "../../stores/colourSchemeStore";
function onColourSchemeChange() {
if ($colourSchemeStore.name === 'dark') {
colourSchemeStore.set(lightColourScheme)
} else {
colourSchemeStore.set(darkColourScheme)
}
}
</script>
2022-04-16 10:43:45 +00:00
<nav>
<div class="left">
<a href="/" class="home">Thomas Wilson</a>
</div>
<div class="right">
2024-03-17 09:33:22 +00:00
<button class="colour-theme-toggle" on:click={onColourSchemeChange}>Toggle Colour Scheme</button>
<a href="/blog" class="blog">/blog</a>
2022-04-16 10:43:45 +00:00
</div>
</nav>
<style>
nav {
display: flex;
flex-flow: row;
max-width: 100vw;
overflow: hidden;
2022-08-18 21:10:02 +00:00
min-height: var(--navbar-height);
2024-03-17 09:33:22 +00:00
font-family: var(--font-family-mono);
2022-04-16 10:43:45 +00:00
}
.left {
flex: 1;
flex-grow: 0;
text-align: left;
padding: var(--spacing-base);
2024-03-17 09:33:22 +00:00
2022-04-16 10:43:45 +00:00
}
.home {
color: var(--brand-orange);
2024-03-17 09:33:22 +00:00
font-family: inherit;
2022-04-16 10:43:45 +00:00
text-decoration: none;
font-weight: 300;
display: flex;
width: fit-content;
white-space: nowrap;
transition: 0.3s;
}
.home:hover {
transform: rotate(11deg);
}
.right {
display: flex;
2022-04-16 10:43:45 +00:00
flex: 1;
text-align: right;
2024-03-17 09:33:22 +00:00
gap: 1rem;
align-items: center;
justify-content: flex-end;
2022-04-16 10:43:45 +00:00
padding: var(--spacing-base);
}
2024-03-17 09:33:22 +00:00
.colour-theme-toggle {
display: flex;
align-items: center;
justify-content: center;
}
2022-08-18 21:10:02 +00:00
.blog {
2024-03-17 09:33:22 +00:00
font-size: 1.1rem;
2022-08-18 21:10:02 +00:00
padding: 0;
2024-03-17 09:33:22 +00:00
margin: 0;
2022-08-18 21:10:02 +00:00
}
2024-03-17 09:33:22 +00:00
2022-04-16 10:43:45 +00:00
.blog:visited {
2024-03-17 09:33:22 +00:00
color: var(--colour-scheme-text);
2022-04-16 10:43:45 +00:00
}
</style>