Update navigation component

This commit is contained in:
Andrew Kingston 2020-10-14 17:06:02 +01:00
parent b0171c1a9f
commit 62091ce744
1 changed files with 49 additions and 43 deletions

View File

@ -1,28 +1,11 @@
<script> <script>
import { cssVars, createClasses } from "./cssVars"
export let className = ""
export let onLoad export let onLoad
export let backgroundColor
export let color
export let borderWidth
export let borderColor
export let borderStyle
export let logoUrl export let logoUrl
export let title
export let _bb export let _bb
export let title
let itemContainer let itemContainer
let hasLoaded let hasLoaded
let currentChildren
$: cssVariables = {
backgroundColor,
color,
borderWidth,
borderColor,
borderStyle,
}
$: { $: {
if (itemContainer) { if (itemContainer) {
@ -35,40 +18,63 @@
} }
</script> </script>
<nav use:cssVars={cssVariables}> <div class="nav">
<a href="/"> <div class="nav__top">
<img class="logo" alt="logo" src={logoUrl} height="48" /> <a href="/">
<span>{title}</span> {#if logoUrl}
</a> <img class="logo" alt="logo" src={logoUrl} height="48" />
<div class="menu-items" bind:this={itemContainer} /> {/if}
</nav> {#if title}
<span>{title}</span>
{/if}
</a>
<div class="nav__controls">
<div>Log out</div>
</div>
</div>
<div class="nav__menu" bind:this={itemContainer} />
</div>
<style> <style>
nav { .nav {
color: var(--color);
background-color: var(--backgroundColor);
align-items: center;
display: flex; display: flex;
font-weight: bold; flex-direction: column;
justify-content: flex-start;
align-items: stretch;
}
.nav__top {
display: flex;
flex-direction: row;
justify-content: space-between; justify-content: space-between;
padding: 20px 0px;
}
nav > a {
display: flex;
align-items: center; align-items: center;
font-size: 1.5em;
color: var(--color);
text-decoration: none;
} }
.nav__top img {
nav a img {
margin-right: 16px; margin-right: 16px;
} }
.menu-items {
.nav__controls {
display: flex; display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: center;
gap: 16px;
} }
.menu-items > :global(*) { .nav__controls > div:hover {
margin: 0 10px; cursor: pointer;
color: #4285f4;
}
.nav__menu {
display: flex;
margin-top: 40px;
gap: 16px;
flex-direction: row;
justify-content: flex-start;
align-items: center;
}
.nav__menu > a {
font-size: 1.5em;
text-decoration: none;
} }
</style> </style>