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

View File

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

View File

@ -1,5 +1,7 @@
<script> <script>
import {locals} from "../../../ts/stores.js"; import {locals} from "../../../ts/stores.js";
export let noLabel = false;
</script> </script>
<style lang="scss"> <style lang="scss">
@ -23,4 +25,9 @@
} }
</style> </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 {locals} from "../../../ts/stores.js";
import NavMenuItem from "../../components/NavMenuItem.svelte"; import NavMenuItem from "../../components/NavMenuItem.svelte";
import {hasRoute, route} from "../../../../common/Routing"; import {hasRoute, route} from "../../../../common/Routing";
export let noLoginLink = false;
</script> </script>
{#if hasRoute('auth')} {#if hasRoute('auth')}
@ -12,7 +14,7 @@
<NavMenuItem href={route('account')} icon="user" text={$locals.user.name || 'Account'}/> <NavMenuItem href={route('account')} icon="user" text={$locals.user.name || 'Account'}/>
<NavMenuItem href={route('logout')} icon="log-out" text="Logout" action/> <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"/> <NavMenuItem href={route('auth')} icon="log-in" text="Log in / Register"/>
{/if} {/if}
{/if} {/if}