front/BaseTemplate: allow disabling login link and logo label

This commit is contained in:
Alice Gaudon 2021-11-28 16:43:46 +01:00
parent d1ff09fcc8
commit e033baa57f
4 changed files with 20 additions and 5 deletions

View File

@ -11,6 +11,9 @@
export let noHeader: boolean = false;
export let noH1: boolean = false;
export let noFooter: boolean = false;
export let noLogoLabel = false;
export let noLoginLink = false;
</script>
<CommonScripts/>
@ -50,7 +53,7 @@
</svelte:head>
{#if !noHeader}
<BaseHeader/>
<BaseHeader {noLogoLabel} {noLoginLink}/>
{/if}
<div class="flash-messages">

View File

@ -3,6 +3,9 @@
import NavMenu from "../../components/NavMenu.svelte";
import BaseNavMenuLinks from "./BaseNavMenuLinks.svelte";
import BaseNavMenuAuth from "./BaseNavMenuAuth.svelte";
export let noLoginLink = false;
export let noLogoLabel = false;
</script>
<style lang="scss">
@ -35,9 +38,9 @@
</style>
<header>
<BaseHeaderLogo/>
<BaseHeaderLogo noLabel={noLogoLabel}/>
<NavMenu>
<BaseNavMenuLinks/>
<BaseNavMenuAuth/>
<BaseNavMenuAuth {noLoginLink}/>
</NavMenu>
</header>

View File

@ -1,5 +1,7 @@
<script>
import {locals} from "../../../ts/stores.js";
export let noLabel = false;
</script>
<style lang="scss">
@ -23,4 +25,9 @@
}
</style>
<a href="/" class="logo"><img src="/img/logo.svg" alt="{$locals.app.name} logo"> {$locals.app.name}</a>
<a href="/" class="logo">
<img src="/img/logo.svg" alt="{$locals.app.name} logo">
{#if !noLabel}
<span class="label">{$locals.app.name}</span>
{/if}
</a>

View File

@ -2,6 +2,8 @@
import {locals} from "../../../ts/stores.js";
import NavMenuItem from "../../components/NavMenuItem.svelte";
import {hasRoute, route} from "../../../../common/Routing";
export let noLoginLink = false;
</script>
{#if hasRoute('auth')}
@ -12,7 +14,7 @@
<NavMenuItem href={route('account')} icon="user" text={$locals.user.name || 'Account'}/>
<NavMenuItem href={route('logout')} icon="log-out" text="Logout" action/>
{:else}
{:else if !noLoginLink}
<NavMenuItem href={route('auth')} icon="log-in" text="Log in / Register"/>
{/if}
{/if}