From e064c58fcc65689961f75162fd2c0c6880b99ea8 Mon Sep 17 00:00:00 2001 From: AlexBocken Date: Sun, 25 Jun 2023 12:15:20 +0200 Subject: [PATCH] Image parallax on recipes --- src/lib/components/TitleImgParallax.svelte | 83 ++++++++++++++++++++++ src/routes/+layout.svelte | 10 ++- src/routes/rezepte/[name]/+page.svelte | 76 ++++++++++---------- src/routes/test/+page.svelte | 11 +++ 4 files changed, 139 insertions(+), 41 deletions(-) create mode 100644 src/lib/components/TitleImgParallax.svelte create mode 100644 src/routes/test/+page.svelte diff --git a/src/lib/components/TitleImgParallax.svelte b/src/lib/components/TitleImgParallax.svelte new file mode 100644 index 0000000..9049140 --- /dev/null +++ b/src/lib/components/TitleImgParallax.svelte @@ -0,0 +1,83 @@ + + +
+
+
+
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index ae106ce..f7b5153 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -15,12 +15,15 @@ li{ list-style-type:none; transition: 100ms; color: white; + user-select: none; } li>a{ text-decoration: none; font-family: sans-serif; font-size: 1.2rem; - color: inherit + color: inherit; + border-radius: 1000px; + padding: 0.5rem 1rem; } li:hover, @@ -31,7 +34,7 @@ li:focus-within transform: scale(1.1,1.1); } ul { - padding-block: 2rem; + padding-block: 1.5rem; display: flex; flex-direction: row; gap: 1rem; @@ -51,7 +54,10 @@ ul { } nav{ + position: sticky; background-color: var(--nord0); + top: 0; + z-index: 10; } .wrapper{ display:flex; diff --git a/src/routes/rezepte/[name]/+page.svelte b/src/routes/rezepte/[name]/+page.svelte index d3c3375..d01c0e6 100644 --- a/src/routes/rezepte/[name]/+page.svelte +++ b/src/routes/rezepte/[name]/+page.svelte @@ -8,6 +8,7 @@ import EditButton from '$lib/components/EditButton.svelte'; import InstructionsPage from '$lib/components/InstructionsPage.svelte'; import IngredientsPage from '$lib/components/IngredientsPage.svelte'; + import TitleImgParallax from '$lib/components/TitleImgParallax.svelte'; export let data: PageData; @@ -86,6 +87,16 @@ h1{ box-shadow: 0.1em 0.1em 0.2em 0.2em rgba(0,0,0,0.3); } +.wrapper_wrapper{ + background-color: #fbf9f3; + width: 100svw; + padding-top: 3rem; + display: flex; + flex-direction: column; + align-items: center; + margin-bottom: 3rem; +} + .wrapper{ display: flex; flex-direction: row; @@ -100,26 +111,14 @@ h1{ } } -.title_container{ - max-width: 1000px; - display: flex; - flex-direction: column; - margin-inline: auto; -} .title{ position: relative; width: min(800px, 80vw); margin-inline: auto; - transform: translateY(-4rem); background-color: var(--nord6); padding: 1rem 2rem; -} -.title_container .img{ - width: 100%; - height: 700px; - background-size: cover; - background-repeat: no-repeat; - background-position: center; + translate: 0 1px; /*bruh*/ + z-index: -1; } .icon{ position: absolute; @@ -198,33 +197,29 @@ h4{ {/each} --> + +
+ {data.icon} +

{data.name}

+ {#if data.preamble} +

{data.preamble}

+ {/if} +
+

Saison:

+ {#each season_iv as season} + {months[season[0] - 1]}-{months[season[1] - 1]} + {/each} +
+
+

Stichwörter:

+ {#each data.tags as tag} + {tag} + {/each} +
-
-
-
-{data.icon} -

{data.name}

-{#if data.preamble} -

{data.preamble}

-{/if} -
-

Saison:

-{#each season_iv as season} - {months[season[0] - 1]}-{months[season[1] - 1]} -{/each} -
- - -

Stichwörter:

-
-{#each data.tags as tag} - {tag} -{/each} -
- -
-
+
+
@@ -234,4 +229,7 @@ h4{ {@html data.addendum} {/if}
+
+
+ diff --git a/src/routes/test/+page.svelte b/src/routes/test/+page.svelte new file mode 100644 index 0000000..43ee5b2 --- /dev/null +++ b/src/routes/test/+page.svelte @@ -0,0 +1,11 @@ + + +
+ +