Skip to content

Commit

Permalink
feat(lluis): add <NavBar />
Browse files Browse the repository at this point in the history
  • Loading branch information
kantord committed May 5, 2021
1 parent ec2ca35 commit 2fee850
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 48 deletions.
46 changes: 46 additions & 0 deletions apps/lluis/NavBar.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<script lang="typescript">
export let dark = false
export let is_hidden_mobile = false
</script>

<nav
class="navbar"
class:dark
class:is-hidden-mobile={is_hidden_mobile}
role="navigation"
aria-label="main navigation"
>

<div class="navbar-brand">
<a class="navbar-item" href="/">
<img src="/images/logo.svg" alt="LibreLingo" />
</a>
</div>

<div class="navbar-start"></div>

<div class="navbar-end">
<div class="navbar-item">
<div class="buttons">
<slot name="buttons" />
</div>
</div>
</div>

</nav>

<style type="text/scss">
.navbar.dark {
background: var(--navbar-dark-background);
color: var(--navbar-dark-text-color);
}

.navbar {
border: 0;
.navbar-end {
position: absolute;
right: 0;
top: 0;
}
}
</style>
80 changes: 32 additions & 48 deletions apps/web/src/components/NavBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import authStore from "../auth"
import SponsorButton from "./SponsorButton.svelte"
import GitHubButton from "./GitHubButton.svelte"
import NavBar from "lluis/NavBar.svelte"
import Icon from "lluis/Icon.svelte"
import Button from "lluis/Button.svelte"
import ButtonLink from "lluis/ButtonLink.svelte"
Expand All @@ -14,56 +15,39 @@
_Logout: () => void
}
const _Logout = () => (window as unknown as WindowWithLogout)._Logout()
</script>

<nav
class="navbar"
class:dark
class:is-hidden-mobile="{is_hidden_mobile}"
role="navigation"
aria-label="main navigation"
>
<div class="navbar-brand">
<a class="navbar-item" href="/">
<img src="/images/logo.svg" alt="LibreLingo" />
</a>
</div>

<div class="navbar-start"></div>
</script>

<div class="navbar-end">
<div class="navbar-item">
<div class="buttons">
<SponsorButton />
<GitHubButton />
{#if hasAuth && settings.features.authEnabled}
{#if $authStore.user}
<Button size="small" outlined inverted info>
<Icon size="small" icon="user" />
<span>{$authStore.user.name}</span>
</Button>
<Button
on:click="{() => _Logout()}"
size="small"
outlined
inverted
info
>
Log out
</Button>
{:else}
<ButtonLink href="/sign-up" size="small" outlined inverted info>
Sign up
</ButtonLink>
<ButtonLink href="/login" size="small" outlined inverted info>
Log in
</ButtonLink>
{/if}
{/if}
</div>
</div>
</div>
</nav>
<NavBar dark>
<span slot="buttons">
<SponsorButton />
<GitHubButton />
{#if hasAuth && settings.features.authEnabled}
{#if $authStore.user}
<Button size="small" outlined inverted info>
<Icon size="small" icon="user" />
<span>{$authStore.user.name}</span>
</Button>
<Button
on:click="{() => _Logout()}"
size="small"
outlined
inverted
info
>
Log out
</Button>
{:else}
<ButtonLink href="/sign-up" size="small" outlined inverted info>
Sign up
</ButtonLink>
<ButtonLink href="/login" size="small" outlined inverted info>
Log in
</ButtonLink>
{/if}
{/if}
</span>
</NavBar>

<style type="text/scss">
@import "../variables";
Expand Down
8 changes: 8 additions & 0 deletions apps/web/src/mystyles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,11 @@


@import "~bulmaswatch/lumen/overrides.scss";

:root {
--blue: #325f74;
--white: #bfb5af;

--navbar-dark-background: var(--blue);
--navbar-dark-text-color: var(--white);
}

1 comment on commit 2fee850

@vercel
Copy link

@vercel vercel bot commented on 2fee850 May 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.