Put Switcher over and next to Footer

Clever solution to keep it over but next to the title and not hide it
This commit is contained in:
2022-09-20 10:32:35 +02:00
parent 5545871c85
commit be51fea5de
5 changed files with 25 additions and 15 deletions

View File

@@ -9,8 +9,6 @@
// Components // Components
import Icon from '$components/atoms/Icon.svelte' import Icon from '$components/atoms/Icon.svelte'
export let isOver: boolean = false
const { settings: { switcher_links }}: any = getContext('global') const { settings: { switcher_links }}: any = getContext('global')
let switcherEl: HTMLElement let switcherEl: HTMLElement
@@ -24,7 +22,6 @@
isOpen = !isOpen isOpen = !isOpen
} }
/** /**
* Detect outside click * Detect outside click
*/ */
@@ -40,7 +37,6 @@
<aside class="switcher" bind:this={switcherEl} <aside class="switcher" bind:this={switcherEl}
class:is-open={isOpen} class:is-open={isOpen}
class:is-over={isOver}
use:reveal={{ use:reveal={{
animation: { y: [24, 0], opacity: [0, 1] }, animation: { y: [24, 0], opacity: [0, 1] },
options: { options: {

View File

@@ -72,7 +72,7 @@
</svelte:head> </svelte:head>
<Switcher isOver={!!$page.params.location && !!$page.params.photo} /> <Switcher />
<slot /> <slot />

View File

@@ -3,11 +3,20 @@
// Sizes // Sizes
--container-width: #{$container-width}; --container-width: #{$container-width};
// Offsets
--switcher-offset: 16px;
// Animation // Animation
--ease-quart: cubic-bezier(.165, .84, .44, 1); --ease-quart: cubic-bezier(.165, .84, .44, 1);
--ease-cubic: cubic-bezier(.785, .135, .15, .86); --ease-cubic: cubic-bezier(.785, .135, .15, .86);
--ease-inout-quart: cubic-bezier(.76, 0, .24, 1); --ease-inout-quart: cubic-bezier(.76, 0, .24, 1);
} }
@include bp (sm) {
:root {
// Offsets
--switcher-offset: clamp(20px, 3vw, 40px);
}
}
html { html {
font: #{$base-font-size}/1.2 $font-sans; font: #{$base-font-size}/1.2 $font-sans;

View File

@@ -1,16 +1,12 @@
.switcher { .switcher {
--offset: 16px;
--button-size: 44px; --button-size: 44px;
$shadow-color: rgba(0, 0, 0, 0.05); $shadow-color: rgba(0, 0, 0, 0.05);
position: fixed; position: fixed;
z-index: 101; z-index: 100;
bottom: var(--offset); bottom: var(--switcher-offset);
left: var(--offset); left: var(--switcher-offset);
pointer-events: none; pointer-events: none;
@include bp (sm) {
--offset: clamp(20px, 3vw, 40px);
}
@include bp (md) { @include bp (md) {
--button-size: 56px; --button-size: 56px;
} }
@@ -165,4 +161,12 @@
} }
} }
} }
// Sticky (end of page)
&.is-sticky {
// background: red !important;
// position: sticky;
// bottom: 0;
// z-index: 100;
}
} }

View File

@@ -1,9 +1,10 @@
.footer { .footer {
position: relative;
z-index: 200;
background-color: $color-primary-darker; background-color: $color-primary-darker;
padding: 24px 0 40px; padding: 24px 0 40px;
@include bp (sm) {
padding: 24px 0;
}
@include bp (md) { @include bp (md) {
padding: 0; padding: 0;
height: 120px; height: 120px;
@@ -28,7 +29,7 @@
@include bp (sm) { @include bp (sm) {
grid-column: 2 / span 5; grid-column: 2 / span 5;
grid-row: 1; grid-row: 1;
margin: auto 0; margin: auto 0 auto calc(var(--switcher-offset) + clamp(24px, 6vw, 8px));
} }
:global(.site-title) { :global(.site-title) {