29 Commits
Author SHA1 Message Date
zoronjiermin 5278df56f6 add page transitions 2026-05-07 04:03:38 +02:00
zoronjiermin dd841dc6d6 add spacing and responsive changes 2026-05-07 03:32:54 +02:00
zoronjiermin 5ed18bda75 add global spacing tokens 2026-05-07 03:06:40 +02:00
zoronjiermin 7a92dcbe8e add discovery interaction on set 2026-05-07 02:38:10 +02:00
zoronjiermin 0a075632c3 addd code review changes 2026-05-06 23:24:45 +02:00
zoronjiermin 5bf3f8694c add string translations in german 2026-05-06 12:08:55 +02:00
zoronjiermin 365fcf0cae add global btn and page layout stylings 2026-05-06 11:59:09 +02:00
zoronjiermin 8960ffd844 add site refactors and media for scent notes 2026-05-05 20:03:18 +02:00
zoronjiermin f3782a0dbf add panel images and make changes to the accessibility style 2026-05-05 18:40:11 +02:00
zoronjiermin 566e8117e2 add accessibility fixes 2026-05-05 14:34:31 +02:00
zoronjiermin b76ebac099 add responsive image sizes 2026-05-05 13:55:13 +02:00
zoronjiermin 1cf9a7271d add styling and media cleanup 2026-05-05 13:46:23 +02:00
zoronjiermin 3dc3086f25 Merge branch 'main' of https://gitea.fhgr.ch/hasicicsalih/parfum_agsd 2026-05-04 22:17:26 +02:00
zoronjiermin 2f09b272bb add hero redesign 2026-05-04 22:16:41 +02:00
zoronjiermin 3a66eaaf4a add hero redesgin 2026-05-04 22:14:46 +02:00
zoronjiermin 283a7a5214 add responsive and scroll behaviour changes 2026-04-30 09:39:32 +02:00
zoronjiermin 2eea587e8b add responsive changes 2026-04-29 17:30:47 +02:00
zoronjiermin 088d01b256 add product site ui refresh 2026-04-29 06:33:56 +02:00
zoronjiermin 5ca7152011 add new product flow arrangement 2026-04-29 00:39:49 +02:00
zoronjiermin 41fa7ddf73 add global styling settings and refresh 2026-04-28 22:54:35 +02:00
zoronjiermin ab9dfff33f add files 2026-04-28 22:03:15 +02:00
zoronjiermin 2cb39f0c55 add darkmode switch 2026-04-28 21:57:39 +02:00
zoronjiermin c1345eaca7 add files 2026-04-24 11:00:35 +02:00
zoronjiermin d0c7916386 add global text reveal hook and scroll animations 2026-04-23 22:56:47 +02:00
zoronjiermin 9de9ce7f43 add sample and discovery imagery 2026-04-23 22:28:32 +02:00
hasicicsalih 9d3180287a fix: tighten CTA footer spacing and product detail scaling 2026-04-23 12:39:01 +02:00
anielsen99 3f2c51eb1f color change duftstruktur 2026-04-21 19:04:16 +02:00
anielsen99 0786fbac8b add dropdown for duftstruktur and moodsetting 2026-04-21 18:31:04 +02:00
anielsen99 ab588fd27b add border-radius to buttons 2026-04-21 18:29:52 +02:00
141 changed files with 9153 additions and 4652 deletions

No files matched your search

+54 -3
View File
@@ -1,10 +1,61 @@
<!doctype html> <!doctype html>
<html lang="en"> <html lang="de">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>parfum-shop</title>
<title>atmos · Konzeptionelle Düfte aus der Schweiz</title>
<meta
name="description"
content="atmos — konzeptionelle Nischendüfte zwischen Materialität, Raum und Charakter. Sechs Düfte als Discovery Set oder 50 ml Flakon. Made in Switzerland."
/>
<meta name="theme-color" content="#262626" />
<meta name="color-scheme" content="dark light" />
<!-- TODO: replace https://atmos.example with the real production domain -->
<link rel="canonical" href="https://atmos.example/" />
<!-- Open Graph -->
<meta property="og:type" content="website" />
<meta property="og:site_name" content="atmos" />
<meta property="og:title" content="atmos · Konzeptionelle Düfte" />
<meta
property="og:description"
content="Konzeptionelle Nischendüfte zwischen Materialität, Raum und Charakter. Made in Switzerland."
/>
<meta property="og:url" content="https://atmos.example/" />
<meta property="og:image" content="https://atmos.example/og-image.jpg" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta property="og:locale" content="de_CH" />
<!-- Twitter / X -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="atmos · Konzeptionelle Düfte" />
<meta
name="twitter:description"
content="Konzeptionelle Nischendüfte zwischen Materialität, Raum und Charakter."
/>
<meta name="twitter:image" content="https://atmos.example/og-image.jpg" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link
rel="preload"
href="/fonts/questrial/questrial-latin.woff2"
as="font"
type="font/woff2"
crossorigin
/>
<!-- Preload LCP image of the landing hero -->
<link
rel="preload"
as="image"
href="/images/hero/768/blasse-seide-hero-product.webp"
imagesrcset="/images/hero/480/blasse-seide-hero-product.webp 480w, /images/hero/768/blasse-seide-hero-product.webp 768w, /images/hero/960/blasse-seide-hero-product.webp 960w, /blasse-seide-hero-product.webp 1078w"
imagesizes="(max-width: 760px) 92vw, (max-width: 1180px) 45vw, 768px"
fetchpriority="high"
/>
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
+32 -18
View File
@@ -9,6 +9,7 @@
"version": "0.0.0", "version": "0.0.0",
"dependencies": { "dependencies": {
"gsap": "^3.14.2", "gsap": "^3.14.2",
"lenis": "^1.3.23",
"react": "^19.2.4", "react": "^19.2.4",
"react-dom": "^19.2.4", "react-dom": "^19.2.4",
"react-router": "^7.14.0" "react-router": "^7.14.0"
@@ -683,9 +684,6 @@
"arm64" "arm64"
], ],
"dev": true, "dev": true,
"libc": [
"glibc"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -703,9 +701,6 @@
"arm64" "arm64"
], ],
"dev": true, "dev": true,
"libc": [
"musl"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -723,9 +718,6 @@
"ppc64" "ppc64"
], ],
"dev": true, "dev": true,
"libc": [
"glibc"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -743,9 +735,6 @@
"s390x" "s390x"
], ],
"dev": true, "dev": true,
"libc": [
"glibc"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -763,9 +752,6 @@
"x64" "x64"
], ],
"dev": true, "dev": true,
"libc": [
"glibc"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -783,9 +769,6 @@
"x64" "x64"
], ],
"dev": true, "dev": true,
"libc": [
"musl"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -1796,6 +1779,37 @@
"json-buffer": "3.0.1" "json-buffer": "3.0.1"
} }
}, },
"node_modules/lenis": {
"version": "1.3.23",
"resolved": "https://registry.npmjs.org/lenis/-/lenis-1.3.23.tgz",
"integrity": "sha512-YxYq3TJqj9sJNv0V9SkyQHejt14xwyIwgDaaMK89Uf9SxQfIszu+gTQSSphh6BWlLTNVKvvXAGkg+Zf+oFIevg==",
"license": "MIT",
"workspaces": [
"packages/*",
"playground",
"playground/*"
],
"funding": {
"type": "github",
"url": "https://github.com/sponsors/darkroomengineering"
},
"peerDependencies": {
"@nuxt/kit": ">=3.0.0",
"react": ">=17.0.0",
"vue": ">=3.0.0"
},
"peerDependenciesMeta": {
"@nuxt/kit": {
"optional": true
},
"react": {
"optional": true
},
"vue": {
"optional": true
}
}
},
"node_modules/levn": { "node_modules/levn": {
"version": "0.4.1", "version": "0.4.1",
"resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
+1
View File
@@ -13,6 +13,7 @@
}, },
"dependencies": { "dependencies": {
"gsap": "^3.14.2", "gsap": "^3.14.2",
"lenis": "^1.3.23",
"react": "^19.2.4", "react": "^19.2.4",
"react-dom": "^19.2.4", "react-dom": "^19.2.4",
"react-router": "^7.14.0" "react-router": "^7.14.0"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 341 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 338 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 270 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 446 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 289 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

@@ -0,0 +1,3 @@
<svg width="1386" height="344" viewBox="0 0 1386 344" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M121 343.5C96.6667 343.5 75.3333 337.833 57 326.5C39 314.833 25 299.167 15 279.5C5 259.833 9.23872e-07 238.167 9.23872e-07 214.5C9.23872e-07 190.5 5 168.833 15 149.5C25 129.833 39 114.333 57 103C75.3333 91.3333 96.6667 85.5 121 85.5C141.667 85.5 159.333 89.5 174 97.5C189 105.5 201.167 116.333 210.5 130V89.5H248V339.5H210.5V299.5C201.167 312.833 189 323.5 174 331.5C159.333 339.5 141.667 343.5 121 343.5ZM126 309.5C144.667 309.5 160.333 305.167 173 296.5C186 287.833 195.833 276.333 202.5 262C209.167 247.333 212.5 231.5 212.5 214.5C212.5 197.167 209.167 181.333 202.5 167C195.833 152.667 186 141.167 173 132.5C160.333 123.833 144.667 119.5 126 119.5C107.667 119.5 91.8333 123.833 78.5 132.5C65.1667 141.167 55 152.667 48 167C41 181.333 37.5 197.167 37.5 214.5C37.5 231.5 41 247.333 48 262C55 276.333 65.1667 287.833 78.5 296.5C91.8333 305.167 107.667 309.5 126 309.5ZM339.863 339.5V122.5H288.863V89.5H339.863V1.43051e-06H377.363V89.5H434.863V122.5H377.363V339.5H339.863ZM475.949 339.5V89.5H513.449V127.5C519.116 117.5 528.116 108 540.449 99C552.783 90 569.116 85.5 589.449 85.5C606.116 85.5 621.449 90 635.449 99C649.783 107.667 660.949 120 668.949 136C672.283 130.333 677.449 123.5 684.449 115.5C691.783 107.5 701.283 100.5 712.949 94.5C724.616 88.5 738.616 85.5 754.949 85.5C770.949 85.5 785.949 89.6667 799.949 98C813.949 106.333 825.283 118.333 833.949 134C842.949 149.333 847.449 167.5 847.449 188.5V339.5H809.949V189.5C809.949 168.5 803.949 151.667 791.949 139C780.283 126 765.616 119.5 747.949 119.5C729.616 119.5 713.783 125.667 700.449 138C687.116 150.333 680.449 167.667 680.449 190V339.5H642.949V189.5C642.949 168.5 636.949 151.667 624.949 139C613.283 126 598.616 119.5 580.949 119.5C562.616 119.5 546.783 125.667 533.449 138C520.116 150.333 513.449 167.667 513.449 190V339.5H475.949ZM1018.53 343.5C993.198 343.5 971.198 337.833 952.531 326.5C933.865 314.833 919.531 299.167 909.531 279.5C899.531 259.833 894.531 238.167 894.531 214.5C894.531 190.5 899.531 168.833 909.531 149.5C919.531 129.833 933.865 114.333 952.531 103C971.198 91.3333 993.198 85.5 1018.53 85.5C1044.2 85.5 1066.2 91.3333 1084.53 103C1103.2 114.333 1117.53 129.833 1127.53 149.5C1137.53 168.833 1142.53 190.5 1142.53 214.5C1142.53 238.167 1137.53 259.833 1127.53 279.5C1117.53 299.167 1103.2 314.833 1084.53 326.5C1066.2 337.833 1044.2 343.5 1018.53 343.5ZM1018.53 309.5C1037.2 309.5 1052.86 305.167 1065.53 296.5C1078.53 287.833 1088.36 276.333 1095.03 262C1101.7 247.333 1105.03 231.5 1105.03 214.5C1105.03 197.167 1101.7 181.333 1095.03 167C1088.36 152.667 1078.53 141.167 1065.53 132.5C1052.86 123.833 1037.2 119.5 1018.53 119.5C1000.2 119.5 984.531 123.833 971.531 132.5C958.531 141.167 948.698 152.667 942.031 167C935.365 181.333 932.031 197.167 932.031 214.5C932.031 231.5 935.365 247.333 942.031 262C948.698 276.333 958.531 287.833 971.531 296.5C984.531 305.167 1000.2 309.5 1018.53 309.5ZM1283.26 343.5C1260.26 343.5 1240.76 339.667 1224.76 332C1209.09 324.333 1197.09 314.333 1188.76 302C1180.42 289.333 1175.76 275.667 1174.76 261H1213.76C1214.76 269.333 1217.59 277.5 1222.26 285.5C1227.26 293.167 1234.76 299.5 1244.76 304.5C1254.76 309.167 1267.76 311.5 1283.76 311.5C1288.76 311.5 1294.92 311 1302.26 310C1309.59 309 1316.59 307.167 1323.26 304.5C1330.26 301.833 1336.09 297.833 1340.76 292.5C1345.42 287.167 1347.76 280.333 1347.76 272C1347.76 261.667 1343.76 253.667 1335.76 248C1327.76 242.333 1317.42 238 1304.76 235C1292.09 231.667 1278.59 228.5 1264.26 225.5C1250.26 222.5 1236.92 218.667 1224.26 214C1211.59 209 1201.26 202.167 1193.26 193.5C1185.26 184.5 1181.26 172.333 1181.26 157C1181.26 134.333 1189.42 116.833 1205.76 104.5C1222.42 91.8333 1246.92 85.5 1279.26 85.5C1301.26 85.5 1319.09 89 1332.76 96C1346.76 102.667 1357.26 111.333 1364.26 122C1371.59 132.667 1375.92 144.167 1377.26 156.5H1339.26C1337.92 145.833 1332.59 136.667 1323.26 129C1314.26 121.333 1299.26 117.5 1278.26 117.5C1238.59 117.5 1218.76 129.5 1218.76 153.5C1218.76 163.5 1222.76 171.167 1230.76 176.5C1238.76 181.833 1249.09 186.167 1261.76 189.5C1274.42 192.5 1287.76 195.5 1301.76 198.5C1316.09 201.167 1329.59 205 1342.26 210C1354.92 215 1365.26 222.167 1373.26 231.5C1381.26 240.5 1385.26 252.833 1385.26 268.5C1385.26 292.833 1375.92 311.5 1357.26 324.5C1338.92 337.167 1314.26 343.5 1283.26 343.5Z" fill="#EAEAEA"/>
</svg>

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 952 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

@@ -0,0 +1,93 @@
Copyright 2011 The Questrial Project Authors (https://github.com/googlefonts/questrial)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 MiB

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#eaeaea" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z"></path></svg>

After

Width:  |  Height:  |  Size: 273 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#eaeaea" viewBox="0 0 256 256"><path d="M216,48H40A16,16,0,0,0,24,64V224a15.84,15.84,0,0,0,9.25,14.5A16.05,16.05,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78l.09-.07L83,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM40,224h0ZM216,192H80a8,8,0,0,0-5.23,1.95L40,224V64H216Z"></path></svg>

After

Width:  |  Height:  |  Size: 355 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#eaeaea" viewBox="0 0 256 256"><path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"></path></svg>

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 957 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 365 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 952 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

+8
View File
@@ -0,0 +1,8 @@
# robots.txt — atmos parfum-shop
# TODO: replace https://atmos.example with the real production domain
User-agent: *
Allow: /
Disallow: /api/
Sitemap: https://atmos.example/sitemap.xml
Binary file not shown.

Before

Width:  |  Height:  |  Size: 933 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

+68
View File
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://atmos.ch/</loc>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://atmos.ch/about</loc>
<changefreq>monthly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>https://atmos.ch/discovery-set</loc>
<changefreq>monthly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://atmos.ch/small-batch</loc>
<changefreq>monthly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>https://atmos.ch/support</loc>
<changefreq>yearly</changefreq>
<priority>0.4</priority>
</url>
<url>
<loc>https://atmos.ch/impressum</loc>
<changefreq>yearly</changefreq>
<priority>0.2</priority>
</url>
<url>
<loc>https://atmos.ch/datenschutz</loc>
<changefreq>yearly</changefreq>
<priority>0.2</priority>
</url>
<url>
<loc>https://atmos.ch/duft/kalter-beton</loc>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>https://atmos.ch/duft/nasser-marmor</loc>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>https://atmos.ch/duft/blasse-seide</loc>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>https://atmos.ch/duft/weisse-asche</loc>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>https://atmos.ch/duft/verbranntes-chrom</loc>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>https://atmos.ch/duft/schwarzes-benzin</loc>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
</urlset>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 951 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 933 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 KiB

+4 -4
View File
@@ -19,18 +19,18 @@ export const catalogProducts = [
{ {
id: `${perfume.slug}-sample`, id: `${perfume.slug}-sample`,
slug: perfume.slug, slug: perfume.slug,
name: `${perfume.name} Sample`, name: `${perfume.name} Probe`,
kind: "sample", kind: "sample",
size_label: "2ml", size_label: "2 ml Probe",
price_cents: parsePriceCents(perfume.prices.sample), price_cents: parsePriceCents(perfume.prices.sample),
discovery_credit_cents: 0, discovery_credit_cents: 0,
}, },
{ {
id: `${perfume.slug}-full`, id: `${perfume.slug}-full`,
slug: perfume.slug, slug: perfume.slug,
name: `${perfume.name} Full Size`, name: `${perfume.name} 50 ml Flakon`,
kind: "full_size", kind: "full_size",
size_label: "50ml", size_label: "50 ml Flakon",
price_cents: parsePriceCents(perfume.prices.full), price_cents: parsePriceCents(perfume.prices.full),
discovery_credit_cents: 0, discovery_credit_cents: 0,
}, },
+8 -1
View File
@@ -1,4 +1,11 @@
import { spawn } from "node:child_process"; import { spawn } from "node:child_process";
import path from "node:path";
const viteBin = path.join(
"node_modules",
".bin",
process.platform === "win32" ? "vite.cmd" : "vite"
);
const run = (name, command, args, env = {}) => { const run = (name, command, args, env = {}) => {
const child = spawn(command, args, { const child = spawn(command, args, {
@@ -22,7 +29,7 @@ const run = (name, command, args, env = {}) => {
}; };
const api = run("api", "node", ["server/index.js"], { API_PORT: "4174" }); const api = run("api", "node", ["server/index.js"], { API_PORT: "4174" });
const vite = run("vite", "node_modules/.bin/vite", []); const vite = run("vite", viteBin, []);
const stop = () => { const stop = () => {
api.kill("SIGTERM"); api.kill("SIGTERM");
+19 -19
View File
@@ -25,7 +25,7 @@ const readBody = async (req) =>
req.on("data", (chunk) => { req.on("data", (chunk) => {
raw += chunk; raw += chunk;
if (raw.length > 1_000_000) { if (raw.length > 1_000_000) {
reject(new Error("Request body too large")); reject(new Error("Anfrage ist zu gross."));
req.destroy(); req.destroy();
} }
}); });
@@ -37,7 +37,7 @@ const readBody = async (req) =>
try { try {
resolve(JSON.parse(raw)); resolve(JSON.parse(raw));
} catch { } catch {
reject(new Error("Invalid JSON")); reject(new Error("Ungültiges JSON."));
} }
}); });
req.on("error", reject); req.on("error", reject);
@@ -130,7 +130,7 @@ const authenticate = (req) => {
const requireAuth = (req, res) => { const requireAuth = (req, res) => {
const auth = authenticate(req); const auth = authenticate(req);
if (!auth) { if (!auth) {
json(res, 401, { error: "Please log in to continue." }); json(res, 401, { error: "Bitte melde dich an, um fortzufahren." });
return null; return null;
} }
return auth; return auth;
@@ -175,7 +175,7 @@ const getAvailableDiscounts = (userId, rows) => {
type: "discovery", type: "discovery",
creditId: discovery.id, creditId: discovery.id,
amount_cents: Math.min(discovery.amount_cents, fullTotal), amount_cents: Math.min(discovery.amount_cents, fullTotal),
label: "Discovery Set credit", label: "Discovery-Set-Gutschrift",
}); });
} }
@@ -194,7 +194,7 @@ const getAvailableDiscounts = (userId, rows) => {
slug: row.slug, slug: row.slug,
product_id: row.product_id, product_id: row.product_id,
amount_cents: Math.min(sample.amount_cents, row.price_cents * row.quantity), amount_cents: Math.min(sample.amount_cents, row.price_cents * row.quantity),
label: `${row.name.replace(" Full Size", "")} sample credit`, label: `Proben-Gutschrift für ${row.name.replace(" 50 ml Flakon", "")}`,
}); });
} }
} }
@@ -355,13 +355,13 @@ const register = async (req, res) => {
const surname = String(body.surname || "").trim(); const surname = String(body.surname || "").trim();
if (!firstName || !surname || !email || !password) { if (!firstName || !surname || !email || !password) {
json(res, 400, { error: "First name, surname, email, and password are required." }); json(res, 400, { error: "Vorname, Nachname, E-Mail und Passwort sind erforderlich." });
return; return;
} }
const existing = db.prepare("SELECT id FROM users WHERE email = ?").get(email); const existing = db.prepare("SELECT id FROM users WHERE email = ?").get(email);
if (existing) { if (existing) {
json(res, 409, { error: "An account with this email already exists." }); json(res, 409, { error: "Mit dieser E-Mail existiert bereits ein Konto." });
return; return;
} }
@@ -389,7 +389,7 @@ const login = async (req, res) => {
const user = db.prepare("SELECT * FROM users WHERE email = ?").get(email); const user = db.prepare("SELECT * FROM users WHERE email = ?").get(email);
if (!user || !verifyPassword(password, user.password_salt, user.password_hash)) { if (!user || !verifyPassword(password, user.password_salt, user.password_hash)) {
json(res, 401, { error: "Invalid email or password." }); json(res, 401, { error: "E-Mail oder Passwort ist ungültig." });
return; return;
} }
@@ -415,7 +415,7 @@ const patchProfile = async (req, res, user) => {
}); });
if (!firstName || !surname) { if (!firstName || !surname) {
json(res, 400, { error: "First name and surname are required." }); json(res, 400, { error: "Vorname und Nachname sind erforderlich." });
return; return;
} }
@@ -459,7 +459,7 @@ const addCartItem = async (req, res, user) => {
const quantity = Math.max(1, Number(body.quantity || 1)); const quantity = Math.max(1, Number(body.quantity || 1));
const product = db.prepare("SELECT * FROM products WHERE id = ?").get(productId); const product = db.prepare("SELECT * FROM products WHERE id = ?").get(productId);
if (!product) { if (!product) {
json(res, 404, { error: "Product not found." }); json(res, 404, { error: "Produkt nicht gefunden." });
return; return;
} }
const timestamp = now(); const timestamp = now();
@@ -472,7 +472,7 @@ const addCartItem = async (req, res, user) => {
).run(user.id, productId, quantity, timestamp, timestamp); ).run(user.id, productId, quantity, timestamp, timestamp);
json(res, 200, { json(res, 200, {
cart: getCart(user.id), cart: getCart(user.id),
message: `${quantity} x ${product.name} added.`, message: `${quantity} x ${product.name} wurde in den Warenkorb gelegt.`,
}); });
}; };
@@ -480,7 +480,7 @@ const patchCartItem = async (req, res, user, productId) => {
const body = await readBody(req); const body = await readBody(req);
const quantity = Number(body.quantity); const quantity = Number(body.quantity);
if (!Number.isFinite(quantity)) { if (!Number.isFinite(quantity)) {
json(res, 400, { error: "Quantity is required." }); json(res, 400, { error: "Die Menge ist erforderlich." });
return; return;
} }
if (quantity <= 0) { if (quantity <= 0) {
@@ -502,7 +502,7 @@ const checkout = async (req, res, user) => {
const body = await readBody(req); const body = await readBody(req);
const rows = getCartRows(user.id); const rows = getCartRows(user.id);
if (rows.length === 0) { if (rows.length === 0) {
json(res, 400, { error: "Your cart is empty." }); json(res, 400, { error: "Dein Warenkorb ist leer." });
return; return;
} }
@@ -514,11 +514,11 @@ const checkout = async (req, res, user) => {
}; };
const paymentMethod = String(body.payment_method || body.paymentMethod || "").trim(); const paymentMethod = String(body.payment_method || body.paymentMethod || "").trim();
if (!addressFields.street_name || !addressFields.house_number || !addressFields.zip_code || !addressFields.city) { if (!addressFields.street_name || !addressFields.house_number || !addressFields.zip_code || !addressFields.city) {
json(res, 400, { error: "Street name, house number, ZIP code, and city are required." }); json(res, 400, { error: "Strasse, Hausnummer, PLZ und Ort sind erforderlich." });
return; return;
} }
if (!["Bill", "Card", "Twint", "PayPal"].includes(paymentMethod)) { if (!["Bill", "Card", "Twint", "PayPal"].includes(paymentMethod)) {
json(res, 400, { error: "Choose a payment method." }); json(res, 400, { error: "Wähle eine Zahlungsmethode." });
return; return;
} }
@@ -611,7 +611,7 @@ const subscribeProduct = async (req, res, user) => {
const type = String(body.type || "restock").trim(); const type = String(body.type || "restock").trim();
const product = db.prepare("SELECT * FROM products WHERE id = ?").get(productId); const product = db.prepare("SELECT * FROM products WHERE id = ?").get(productId);
if (!product) { if (!product) {
json(res, 404, { error: "Product not found." }); json(res, 404, { error: "Produkt nicht gefunden." });
return; return;
} }
db.prepare( db.prepare(
@@ -620,7 +620,7 @@ const subscribeProduct = async (req, res, user) => {
).run(user.id, productId, type, now()); ).run(user.id, productId, type, now());
json(res, 200, { json(res, 200, {
ok: true, ok: true,
message: `${product.name} ${type} subscription saved.`, message: `${product.name}: Benachrichtigung gespeichert.`,
subscriptions: getProductSubscriptions(user.id), subscriptions: getProductSubscriptions(user.id),
}); });
}; };
@@ -719,13 +719,13 @@ const route = async (req, res) => {
return deleteCartItem(res, user, decodeURIComponent(itemMatch[1])); return deleteCartItem(res, user, decodeURIComponent(itemMatch[1]));
} }
json(res, 404, { error: "Route not found." }); json(res, 404, { error: "Route nicht gefunden." });
}; };
createServer((req, res) => { createServer((req, res) => {
route(req, res).catch((error) => { route(req, res).catch((error) => {
console.error(error); console.error(error);
json(res, 500, { error: "Server error." }); json(res, 500, { error: "Serverfehler." });
}); });
}).listen(PORT, () => { }).listen(PORT, () => {
console.log(`Shop API listening on http://localhost:${PORT}`); console.log(`Shop API listening on http://localhost:${PORT}`);
+108 -7
View File
@@ -1,15 +1,116 @@
* {
box-sizing: border-box;
}
html, html,
body, body,
#root { #root {
margin: 0;
min-height: 100%; min-height: 100%;
font-family: Arial, Helvetica, sans-serif; }
#root {
background: var(--theme-bg);
color: var(--theme-text);
min-width: 0;
} }
body { body {
background: #efefef; background: var(--theme-bg);
}
main {
min-width: 0;
}
.shell {
width: var(--container-wide);
margin: 0 auto;
padding: 0 0 clamp(2.2rem, 6vw, 5rem);
background: transparent;
border: 0;
box-shadow: none;
}
.page,
.detail-page,
.discovery-page,
.about-page,
.support-page,
.small-page,
.impressum-page,
.datenschutz-page {
isolation: isolate;
}
.detail-page .navbar--light,
.discovery-page .navbar--light,
.about-page .navbar--light,
.support-page .navbar--light,
.small-page .navbar--light,
.impressum-page .navbar--light,
.datenschutz-page .navbar--light {
position: fixed;
top: clamp(0.75rem, 2.1vw, 1.4rem);
right: 0;
left: 0;
z-index: var(--z-nav);
margin-bottom: 0;
padding-top: 0;
pointer-events: none;
}
.detail-page .navbar--light .nav-pill,
.discovery-page .navbar--light .nav-pill,
.about-page .navbar--light .nav-pill,
.support-page .navbar--light .nav-pill,
.small-page .navbar--light .nav-pill,
.impressum-page .navbar--light .nav-pill,
.datenschutz-page .navbar--light .nav-pill {
pointer-events: auto;
}
.navbar--light .nav-pill,
.navbar--light .nav-link,
.shell,
.page,
.detail-page,
.discovery-page,
.about-page,
.support-page,
.small-page,
.impressum-page,
.datenschutz-page,
button,
input,
textarea,
select {
transition:
background-color var(--duration-med) var(--ease-out),
border-color var(--duration-med) var(--ease-out),
color var(--duration-med) var(--ease-out),
box-shadow var(--duration-med) var(--ease-out);
}
body.theme-dark .navbar--light .nav-pill {
background: rgba(38, 38, 38, 0.88);
border-color: rgba(234, 234, 234, 0.26);
}
body.theme-dark .navbar--light .nav-link {
color: var(--theme-white);
}
body.theme-dark .navbar--light .nav-link:hover,
body.theme-dark .navbar--light .nav-link.active {
background: rgba(234, 234, 234, 0.15);
}
body.theme-dark .navbar--light .nav-theme-switch__track {
border-color: rgba(234, 234, 234, 0.3);
background: rgba(234, 234, 234, 0.14);
}
body.theme-dark .navbar--light .nav-brand-logo {
filter: invert(1) brightness(1.08);
}
body.theme-light .navbar--light .nav-link:hover,
body.theme-light .navbar--light .nav-link.active {
background: var(--theme-surface-soft);
} }
+58 -5
View File
@@ -1,4 +1,5 @@
import { Routes, Route } from "react-router"; import { useEffect, useRef, useState } from "react";
import { Routes, Route, useLocation } from "react-router";
import LandingPage from "./pages/LandingPage"; import LandingPage from "./pages/LandingPage";
import ProductDetailPage from "./components/ProductDetailPage"; import ProductDetailPage from "./components/ProductDetailPage";
import AboutPage from "./pages/AboutPage"; import AboutPage from "./pages/AboutPage";
@@ -12,12 +13,61 @@ import SupportChatbot from "./components/SupportChatbot";
import ScrollToTop from "./components/ScrollToTop"; import ScrollToTop from "./components/ScrollToTop";
import ShopDrawer from "./components/ShopDrawer"; import ShopDrawer from "./components/ShopDrawer";
import CartToast from "./components/CartToast"; import CartToast from "./components/CartToast";
import { ProductTransitionProvider } from "./components/ProductTransition";
import { PageTransitionProvider } from "./transitions/PageTransition";
import useLenisSmoothScroll from "./hooks/useLenisSmoothScroll";
import useScrollTextReveal from "./hooks/useScrollTextReveal";
import useButtonInteractions from "./hooks/useButtonInteractions";
import { ThemeProvider } from "./theme/ThemeContext";
import "./style/textReveal.css";
const THEME_STORAGE_KEY = "atmos-theme";
function App() { function App() {
const location = useLocation();
const routeContentRef = useRef(null);
const [theme, setTheme] = useState(() => {
if (typeof window === "undefined") return "dark";
const storedTheme = window.localStorage.getItem(THEME_STORAGE_KEY);
return storedTheme === "light" ? "light" : "dark";
});
const shouldFlushFooter =
location.pathname === "/" || location.pathname.startsWith("/duft/");
const showSupportChatbot = location.pathname === "/";
useLenisSmoothScroll(location.pathname);
useScrollTextReveal(routeContentRef, location.pathname);
useButtonInteractions();
useEffect(() => {
if (typeof document === "undefined") return;
document.body.classList.remove("theme-dark", "theme-light");
document.body.classList.add(theme === "light" ? "theme-light" : "theme-dark");
document.documentElement.style.colorScheme = theme === "light" ? "light" : "dark";
if (typeof window !== "undefined") {
window.localStorage.setItem(THEME_STORAGE_KEY, theme);
}
}, [theme]);
const toggleTheme = () => {
setTheme((currentTheme) => (currentTheme === "dark" ? "light" : "dark"));
};
const isLight = theme === "light";
return ( return (
<> <ThemeProvider value={{ theme, isLight, toggleTheme }}>
<ProductTransitionProvider>
<PageTransitionProvider>
<ScrollToTop /> <ScrollToTop />
<a href="#main-content" className="skip-link">
Zum Inhalt springen
</a>
<div ref={routeContentRef} data-route-content>
<Routes> <Routes>
<Route path="/" element={<LandingPage />} /> <Route path="/" element={<LandingPage />} />
<Route path="/duft/:perfumeSlug" element={<ProductDetailPage />} /> <Route path="/duft/:perfumeSlug" element={<ProductDetailPage />} />
@@ -28,12 +78,15 @@ function App() {
<Route path="/discovery-set" element={<DiscoverySetPage />} /> <Route path="/discovery-set" element={<DiscoverySetPage />} />
<Route path="/small-batch" element={<SmallBatchPage />} /> <Route path="/small-batch" element={<SmallBatchPage />} />
</Routes> </Routes>
</div>
<ShopDrawer /> <ShopDrawer />
<CartToast /> <CartToast />
<Footer /> <Footer flushTop={shouldFlushFooter} />
<SupportChatbot /> {showSupportChatbot && <SupportChatbot />}
</> </PageTransitionProvider>
</ProductTransitionProvider>
</ThemeProvider>
); );
} }
+13 -4
View File
@@ -22,14 +22,23 @@ function CartToast() {
}; };
return ( return (
<div className="cart-toast"> <div className="cart-toast" role="status" aria-live="polite">
<button className="cart-toast-close" type="button" onClick={dismissToast}> <button
x type="button"
className="atmos-btn atmos-btn--outline atmos-btn--icon atmos-btn--sm cart-toast-close"
onClick={dismissToast}
aria-label="Hinweis schliessen"
>
<span aria-hidden="true">×</span>
</button> </button>
<strong>{cartToast.title}</strong> <strong>{cartToast.title}</strong>
<p>{cartToast.message}</p> <p>{cartToast.message}</p>
{cartToast.actionLabel && ( {cartToast.actionLabel && (
<button type="button" onClick={runAction}> <button
type="button"
className="atmos-btn atmos-btn--primary atmos-btn--block atmos-btn--sm"
onClick={runAction}
>
{cartToast.actionLabel} {cartToast.actionLabel}
</button> </button>
)} )}
+70 -29
View File
@@ -1,80 +1,121 @@
.site-footer { .site-footer {
margin-top: 40px; position: relative;
background: #1f1f1f; margin-top: 0;
color: #f5f5f5; overflow: hidden;
border-top: 1px solid rgba(255, 255, 255, 0.08); background:
radial-gradient(circle at 82% 10%, rgba(var(--theme-accent-rgb) / 0.15), transparent 22rem),
var(--footer-bg);
color: var(--footer-text);
border-top: 1px solid var(--footer-border);
}
.site-footer--flush {
margin-top: 0;
}
.site-footer::before {
content: "ATMOS";
position: absolute;
right: var(--page-x);
bottom: -0.16em;
color: var(--footer-watermark);
font-size: clamp(5.5rem, 18vw, 20rem);
line-height: 0.8;
letter-spacing: 0;
pointer-events: none;
} }
.site-footer__inner { .site-footer__inner {
max-width: 1600px; position: relative;
z-index: 1;
width: var(--container-wide);
margin: 0 auto; margin: 0 auto;
padding: 28px 20px 32px; padding: clamp(2.4rem, 7vw, 6.5rem) 0 clamp(2.2rem, 5vw, 4.8rem);
display: grid; display: grid;
grid-template-columns: 1.4fr 1fr 1fr; grid-template-columns: minmax(0, 1.4fr) minmax(12rem, 0.65fr) minmax(12rem, 0.75fr);
gap: 28px; gap: var(--gap-lg);
align-items: start;
} }
.site-footer__brand { .site-footer__brand {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 12px; gap: var(--gap-sm);
} }
.site-footer__logo { .site-footer__logo {
text-decoration: none; width: fit-content;
color: #fff; color: var(--theme-accent-contrast);
font-size: 14px; font-size: clamp(1rem, 1.5vw, 1.2rem);
letter-spacing: 0.22em; letter-spacing: 0.22em;
text-decoration: none;
} }
.site-footer__text { .site-footer__text {
max-width: 32rem;
margin: 0; margin: 0;
max-width: 320px; color: var(--footer-text-muted);
font-size: 14px; font-size: var(--text-base);
line-height: 1.6; line-height: 1.65;
color: rgba(255, 255, 255, 0.72);
} }
.site-footer__nav-group { .site-footer__nav-group {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 12px; gap: var(--gap-sm);
padding-top: 0.2rem;
} }
.site-footer__heading { .site-footer__heading {
font-size: 10px; color: var(--footer-text-faint);
font-size: var(--text-xs);
letter-spacing: 0.22em; letter-spacing: 0.22em;
text-transform: uppercase; text-transform: uppercase;
color: rgba(255, 255, 255, 0.5);
} }
.site-footer__nav { .site-footer__nav {
display: block;
}
.site-footer__nav ul {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 10px; gap: 0.72rem;
list-style: none;
margin: 0;
padding: 0;
} }
.site-footer__nav a { .site-footer__nav a {
width: fit-content;
color: var(--footer-text);
font-size: var(--text-sm);
line-height: 1.2;
text-decoration: none; text-decoration: none;
color: #f5f5f5; transition:
font-size: 14px; color var(--duration-med) var(--ease-out),
transition: opacity 0.2s ease, transform 0.2s ease; opacity var(--duration-med) var(--ease-out),
transform var(--duration-med) var(--ease-out);
} }
.site-footer__nav a:hover { .site-footer__nav a:hover,
opacity: 0.7; .site-footer__nav a:focus-visible {
transform: translateX(2px); color: var(--theme-accent);
transform: translateX(0.25rem);
} }
@media (max-width: 900px) { @media (max-width: 1023px) {
.site-footer__inner { .site-footer__inner {
grid-template-columns: 1fr 1fr; grid-template-columns: 1fr 1fr;
} }
.site-footer__brand {
grid-column: 1 / -1;
}
} }
@media (max-width: 640px) { @media (max-width: 767px) {
.site-footer__inner { .site-footer__inner {
grid-template-columns: 1fr; grid-template-columns: 1fr;
padding: 24px 16px 28px;
} }
} }
+37 -19
View File
@@ -1,37 +1,55 @@
import { Link } from "react-router"; import { Link } from "react-router";
import "./Footer.css"; import "./Footer.css";
function Footer() { const footerLinkGroups = [
{
heading: "Navigation",
ariaLabel: "Footer Navigation",
links: [
{ to: "/", label: "Startseite" },
{ to: "/#dufte", label: "D\u00FCfte" },
{ to: "/discovery-set", label: "Discovery Set" },
],
},
{
heading: "Rechtliches & Info",
ariaLabel: "Footer Rechtliches und Info",
links: [
{ to: "/about", label: "About Us" },
{ to: "/support", label: "Support" },
{ to: "/impressum", label: "Impressum" },
{ to: "/datenschutz", label: "Datenschutz" },
],
},
];
function Footer({ flushTop = false }) {
return ( return (
<footer className="site-footer"> <footer className={`site-footer${flushTop ? " site-footer--flush" : ""}`}>
<div className="site-footer__inner"> <div className="site-footer__inner">
<div className="site-footer__brand"> <div className="site-footer__brand">
<Link to="/" className="site-footer__logo"> <Link to="/" className="site-footer__logo">
ATMOS ATMOS
</Link> </Link>
<p className="site-footer__text"> <p className="site-footer__text">
Konzeptuelle Düfte zwischen Materialität, Raum und Charakter. {"Konzeptuelle D\u00FCfte zwischen Materialit\u00E4t, Raum und Charakter."}
</p> </p>
</div> </div>
<div className="site-footer__nav-group"> {footerLinkGroups.map((group) => (
<span className="site-footer__heading">Navigation</span> <div className="site-footer__nav-group" key={group.heading}>
<nav className="site-footer__nav"> <span className="site-footer__heading">{group.heading}</span>
<Link to="/">Startseite</Link> <nav className="site-footer__nav" aria-label={group.ariaLabel}>
<Link to="/#dufte">Düfte</Link> <ul>
<Link to="/discovery-set">Discovery Set</Link> {group.links.map((link) => (
</nav> <li key={link.to}>
</div> <Link to={link.to}>{link.label}</Link>
</li>
<div className="site-footer__nav-group"> ))}
<span className="site-footer__heading">Rechtliches & Info</span> </ul>
<nav className="site-footer__nav">
<Link to="/about">About Us</Link>
<Link to="/support">Support</Link>
<Link to="/impressum">Impressum</Link>
<Link to="/datenschutz">Datenschutz</Link>
</nav> </nav>
</div> </div>
))}
</div> </div>
</footer> </footer>
); );
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,37 @@
.product-transition {
position: fixed;
inset: 0;
z-index: 2500;
pointer-events: none;
opacity: 0;
visibility: hidden;
overflow: hidden;
}
.product-transition__wash {
position: absolute;
inset: 0;
background: var(--theme-bg);
}
.product-transition__image {
position: absolute;
top: 0;
left: 0;
display: block;
max-width: none;
object-fit: contain;
transform-origin: 0 0;
will-change: transform, opacity;
filter: var(--shadow-product);
}
body.product-transition-active {
cursor: progress;
}
@media (prefers-reduced-motion: reduce) {
.product-transition {
display: none;
}
}
@@ -0,0 +1,339 @@
import {
useCallback,
useLayoutEffect,
useMemo,
useRef,
useState,
} from "react";
import { useNavigate } from "react-router";
import { gsap } from "gsap";
import { ProductTransitionContext } from "../transitions/ProductTransitionContext";
import "./ProductTransition.css";
const supportsProductTransition = () => {
if (typeof window === "undefined") return false;
return !window.matchMedia("(prefers-reduced-motion: reduce)").matches;
};
const rectToObject = (rect) => ({
top: rect.top,
left: rect.left,
width: rect.width,
height: rect.height,
});
const isPlainNavigationClick = (event) =>
event.button === 0 &&
!event.metaKey &&
!event.altKey &&
!event.ctrlKey &&
!event.shiftKey;
const getStageRect = (sourceRect) => {
const viewportWidth = window.innerWidth;
const viewportHeight = window.innerHeight;
const sourceRatio = sourceRect.height / sourceRect.width || 1;
const isMobile = viewportWidth <= 760;
const maxWidthFraction = isMobile ? 0.85 : 0.56;
const maxHeightFraction = isMobile ? 0.52 : 0.72;
const maxAbsWidth = isMobile ? viewportWidth * maxWidthFraction : 620;
const stageWidth = Math.min(
Math.max(sourceRect.width * 1.16, 260),
maxAbsWidth
);
const stageHeight = Math.min(stageWidth * sourceRatio, viewportHeight * maxHeightFraction);
const normalizedWidth = stageHeight / sourceRatio;
return {
left: (viewportWidth - normalizedWidth) / 2,
top: (viewportHeight - stageHeight) / 2,
width: normalizedWidth,
height: stageHeight,
};
};
const getTransformForRect = (rect, sourceRect) => {
const scale = Math.min(
rect.width / sourceRect.width,
rect.height / sourceRect.height
);
const width = sourceRect.width * scale;
const height = sourceRect.height * scale;
return {
x: rect.left + (rect.width - width) / 2,
y: rect.top + (rect.height - height) / 2,
scaleX: scale,
scaleY: scale,
};
};
export function ProductTransitionProvider({ children }) {
const navigate = useNavigate();
const overlayRef = useRef(null);
const imageRef = useRef(null);
const washRef = useRef(null);
const timelineRef = useRef(null);
const [transition, setTransition] = useState(null);
const clearTransition = useCallback(() => {
timelineRef.current?.kill();
timelineRef.current = null;
document.body.classList.remove("product-transition-active");
setTransition(null);
}, []);
const startProductTransition = useCallback(
(event, perfume) => {
if (!perfume?.slug || !isPlainNavigationClick(event)) {
return false;
}
if (!supportsProductTransition()) {
return false;
}
const card = event.currentTarget;
const image = card.querySelector("[data-product-transition-source]");
if (!image) {
return false;
}
const sourceRect = image.getBoundingClientRect();
if (sourceRect.width <= 0 || sourceRect.height <= 0) {
return false;
}
event.preventDefault();
timelineRef.current?.kill();
document.body.classList.add("product-transition-active");
setTransition({
id: `${perfume.slug}-${Date.now()}`,
slug: perfume.slug,
to: `/duft/${perfume.slug}`,
image: image.currentSrc || image.src || perfume.image,
alt: perfume.name,
sourceRect: rectToObject(sourceRect),
phase: "leaving",
});
return true;
},
[]
);
useLayoutEffect(() => {
if (transition?.phase !== "leaving") {
return undefined;
}
const overlay = overlayRef.current;
const image = imageRef.current;
const wash = washRef.current;
if (!overlay || !image || !wash) {
return undefined;
}
const routeContent = document.querySelector("[data-route-content]");
const sourceRect = transition.sourceRect;
const stageRect = getStageRect(sourceRect);
let completed = false;
gsap.set(overlay, { autoAlpha: 1, pointerEvents: "auto" });
gsap.set(wash, { autoAlpha: 0 });
gsap.set(image, {
x: sourceRect.left,
y: sourceRect.top,
width: sourceRect.width,
height: sourceRect.height,
scaleX: 1,
scaleY: 1,
autoAlpha: 1,
transformOrigin: "0 0",
force3D: true,
});
timelineRef.current = gsap.timeline({
defaults: { ease: "power4.inOut" },
onComplete: () => {
completed = true;
navigate(transition.to, {
state: {
productTransition: true,
transitionId: transition.id,
},
});
setTransition((current) =>
current?.id === transition.id
? { ...current, phase: "entering" }
: current
);
},
});
timelineRef.current
.to(wash, { autoAlpha: 1, duration: 0.42, ease: "power2.out" }, 0)
.to(
routeContent,
{
autoAlpha: 0,
filter: "none",
scale: 1,
duration: 0.62,
ease: "power3.out",
},
0
)
.to(
image,
{
...getTransformForRect(stageRect, sourceRect),
duration: 0.78,
},
0.03
);
return () => {
if (!completed) {
timelineRef.current?.kill();
}
};
}, [navigate, transition]);
useLayoutEffect(() => {
if (transition?.phase !== "entering") {
return undefined;
}
const overlay = overlayRef.current;
const image = imageRef.current;
const wash = washRef.current;
if (!overlay || !image || !wash) {
return undefined;
}
let frame = 0;
let cancelled = false;
let completed = false;
const sourceRect = transition.sourceRect;
const runEnterAnimation = () => {
if (cancelled) return;
window.scrollTo({ top: 0, left: 0, behavior: "instant" });
const target = document.querySelector(
`[data-product-transition-target="${transition.slug}"]`
);
if (!target && frame < 16) {
frame += 1;
window.requestAnimationFrame(runEnterAnimation);
return;
}
const routeContent = document.querySelector("[data-route-content]");
gsap.set(routeContent, {
autoAlpha: 1,
filter: "none",
scale: 1,
clearProps: "opacity,visibility,filter,transform",
});
if (!target) {
gsap.to(overlay, {
autoAlpha: 0,
duration: 0.3,
ease: "power2.out",
onComplete: clearTransition,
});
return;
}
const targetRect = rectToObject(target.getBoundingClientRect());
const revealItems = gsap.utils.toArray("[data-product-transition-reveal]");
gsap.set(target, { autoAlpha: 0 });
gsap.set(revealItems, { y: 28, autoAlpha: 0, force3D: true });
timelineRef.current?.kill();
timelineRef.current = gsap.timeline({
defaults: { ease: "power4.out" },
onComplete: () => {
completed = true;
clearTransition();
},
});
timelineRef.current
.to(image, {
...getTransformForRect(targetRect, sourceRect),
duration: 0.72,
})
.set(target, { autoAlpha: 1 }, ">-0.08")
.to(image, { autoAlpha: 0, duration: 0.16, ease: "power2.out" }, "<")
.to(wash, { autoAlpha: 0, duration: 0.5, ease: "power2.out" }, "<")
.to(
revealItems,
{
y: 0,
autoAlpha: 1,
duration: 0.82,
stagger: 0.07,
ease: "power4.out",
clearProps: "transform",
},
">-0.05"
);
};
window.requestAnimationFrame(runEnterAnimation);
return () => {
cancelled = true;
if (!completed) {
timelineRef.current?.kill();
}
};
}, [clearTransition, transition]);
const value = useMemo(
() => ({
activeSlug: transition?.slug || null,
phase: transition?.phase || "idle",
startProductTransition,
}),
[startProductTransition, transition]
);
return (
<ProductTransitionContext.Provider value={value}>
{children}
{transition && (
<div
className={`product-transition product-transition--${transition.phase}`}
ref={overlayRef}
aria-hidden="true"
>
<div className="product-transition__wash" ref={washRef} />
<img
className="product-transition__image"
src={transition.image}
alt={transition.alt}
ref={imageRef}
decoding="async"
/>
</div>
)}
</ProductTransitionContext.Provider>
);
}
+65 -10
View File
@@ -1,17 +1,41 @@
import { Link } from "react-router"; import { Link } from "react-router";
import { useShop } from "../shop/useShop"; import { useShop } from "../shop/useShop";
import { useTheme } from "../theme/useTheme";
import "../style/navbar.css"; import "../style/navbar.css";
function SharedNavbar({ variant = "light", active = "" }) { function SharedNavbar({ variant = "hero", active = "", brandMode = "logo" }) {
const { cart, openCart, openProfile, user } = useShop(); const { cart, openCart, openProfile, panelOpen, panelType, user } = useShop();
const cartLabel = const { isLight, toggleTheme } = useTheme();
cart.total_quantity > 0 ? `Cart ${cart.total_quantity}` : "Cart"; const cartCount = cart.total_quantity || 0;
const cartLabel = cartCount > 0 ? `Warenkorb ${cartCount}` : "Warenkorb";
const cartCompactLabel = cartCount > 0 ? `Korb ${cartCount}` : "Korb";
const cartAriaLabel =
cartCount > 0
? `Warenkorb mit ${cartCount} ${cartCount === 1 ? "Artikel" : "Artikeln"} öffnen`
: "Warenkorb öffnen";
const logoSrc =
variant === "hero" ? "/atmos-logo-light.svg" : "/atmos-logo-dark.svg";
const brandIsBack = brandMode === "back";
return ( return (
<header className={`site-header site-header--${variant}`}>
<nav className={`navbar navbar--${variant}`} aria-label="Hauptnavigation"> <nav className={`navbar navbar--${variant}`} aria-label="Hauptnavigation">
<div className="nav-pill"> <div className="nav-pill">
<Link to="/" className={`nav-link ${active === "atmos" ? "active" : ""}`}> <Link
atmos to="/"
className={`nav-link nav-link--brand ${brandIsBack ? "nav-link--back" : ""} ${
active === "atmos" ? "active" : ""
}`}
aria-label={brandIsBack ? "Zur Startseite" : "Atmos Startseite"}
>
{brandIsBack ? (
<>
<span className="nav-back-icon" aria-hidden="true" />
<span>Zurück</span>
</>
) : (
<img src={logoSrc} alt="" className="nav-brand-logo" />
)}
</Link> </Link>
<Link <Link
to="/discovery-set" to="/discovery-set"
@@ -19,14 +43,45 @@ function SharedNavbar({ variant = "light", active = "" }) {
> >
Testen Testen
</Link> </Link>
<button type="button" className="nav-link nav-button" onClick={openCart}> <button
{cartLabel} type="button"
className="nav-link nav-button nav-link--cart"
onClick={openCart}
aria-haspopup="dialog"
aria-controls="shop-drawer"
aria-expanded={panelOpen && panelType === "cart"}
aria-label={cartAriaLabel}
>
<span className="nav-label nav-label--full">{cartLabel}</span>
<span className="nav-label nav-label--compact">
{cartCompactLabel}
</span>
</button> </button>
<button type="button" className="nav-link nav-button" onClick={openProfile}> <button
{user ? "Profile" : "Profile"} type="button"
className="nav-link nav-button"
onClick={openProfile}
aria-haspopup="dialog"
aria-controls="shop-drawer"
aria-expanded={panelOpen && panelType === "profile"}
aria-label={user ? "Profil öffnen" : "Anmelden oder Profil öffnen"}
>
Profil
</button>
<button
type="button"
className={`nav-link nav-button nav-theme-switch ${isLight ? "is-light" : ""}`}
onClick={toggleTheme}
aria-label="Light Mode"
aria-pressed={isLight}
>
<span className="nav-theme-switch__track" aria-hidden="true">
<span className="nav-theme-switch__thumb" />
</span>
</button> </button>
</div> </div>
</nav> </nav>
</header>
); );
} }
File diff suppressed because it is too large. Load diff
+482 -134
View File
@@ -1,40 +1,109 @@
import { useState } from "react"; import { useEffect, useId, useRef, useState } from "react";
import { Link } from "react-router"; import { Link } from "react-router";
import { formatChf } from "../shop/money"; import { formatChf } from "../shop/money";
import { useShop } from "../shop/useShop"; import { useShop } from "../shop/useShop";
import "./ShopDrawer.css"; import "./ShopDrawer.css";
const paymentMethods = [ const paymentMethods = [
{ key: "Bill", badge: "BILL", label: "Bill" }, { key: "Bill", badge: "RE", label: "Rechnung" },
{ key: "Card", badge: "CARD", label: "Card" }, { key: "Card", badge: "KA", label: "Karte" },
{ key: "Twint", badge: "TW", label: "Twint" }, { key: "Twint", badge: "TW", label: "Twint" },
{ key: "PayPal", badge: "PP", label: "PayPal" }, { key: "PayPal", badge: "PP", label: "PayPal" },
]; ];
const notificationLabels = [ const notificationLabels = [
["drops_enabled", "New Drops"], ["drops_enabled", "Neue Drops"],
["restocks_enabled", "Restocks"], ["restocks_enabled", "Verfügbarkeits-Updates"],
["small_batch_enabled", "Small Batch Releases"], ["small_batch_enabled", "Small-Batch-Veröffentlichungen"],
["discovery_enabled", "Discovery Set Updates"], ["discovery_enabled", "Discovery-Set-Updates"],
]; ];
function Field({ label, value, onChange, type = "text", readOnly = false }) { const discoveryStatusLabels = {
"No Discount atm": "Noch kein Rabatt",
"Discount already used": "Rabatt bereits genutzt",
"Discount available": "Rabatt verfügbar",
};
const creditStatusLabels = {
available: "verfügbar",
used: "genutzt",
};
const formatDiscoveryStatus = (status) => discoveryStatusLabels[status] || status;
const formatCreditStatus = (status) => creditStatusLabels[status] || status;
const focusableSelector = [
"a[href]",
"button:not([disabled])",
"input:not([disabled]):not([type='hidden'])",
"select:not([disabled])",
"textarea:not([disabled])",
"[tabindex]:not([tabindex='-1'])",
].join(",");
const getFocusableElements = (container) =>
Array.from(container.querySelectorAll(focusableSelector)).filter(
(element) =>
element instanceof HTMLElement &&
element.tabIndex >= 0 &&
!element.closest("[inert]") &&
element.getClientRects().length > 0
);
function Field({
label,
value,
onChange,
type = "text",
readOnly = false,
id,
name,
autoComplete,
inputMode,
describedBy,
invalid = false,
}) {
const generatedId = useId();
const fallbackName = label
.toLowerCase()
.replace(/[^a-z0-9]+/g, "_")
.replace(/^_|_$/g, "");
const fieldName = name || fallbackName;
const fieldId = id || `shop-field-${fieldName}-${generatedId}`;
return ( return (
<label className="shop-field"> <label className="drawer-field" htmlFor={fieldId}>
<span>{label}</span> <span>{label}</span>
<input <input
id={fieldId}
name={fieldName}
type={type} type={type}
value={value} value={value}
readOnly={readOnly} readOnly={readOnly}
autoComplete={autoComplete}
inputMode={inputMode}
aria-describedby={describedBy}
aria-invalid={invalid || undefined}
onChange={(event) => onChange?.(event.target.value)} onChange={(event) => onChange?.(event.target.value)}
/> />
</label> </label>
); );
} }
function DrawerError({ id, children }) {
if (!children) return null;
return (
<p className="drawer-error" id={id} role="alert">
{children}
</p>
);
}
function AuthPanel() { function AuthPanel() {
const { busy, error, login, register } = useShop(); const { busy, error, login, register } = useShop();
const [mode, setMode] = useState("login"); const [mode, setMode] = useState("login");
const errorId = "auth-error";
const [form, setForm] = useState({ const [form, setForm] = useState({
first_name: "", first_name: "",
surname: "", surname: "",
@@ -54,38 +123,80 @@ function AuthPanel() {
}; };
return ( return (
<form className="drawer-section auth-panel" onSubmit={submit}> <form className="drawer-stack" onSubmit={submit}>
<span className="drawer-kicker">{mode === "login" ? "LOGIN" : "REGISTER"}</span> <section className="drawer-section">
<h2>{mode === "login" ? "Welcome back." : "Create your atmos account."}</h2> <span className="drawer-eyebrow">{mode === "login" ? "Anmelden" : "Registrieren"}</span>
<h2 className="drawer-heading">
{mode === "login" ? "Willkommen zurück." : "Konto erstellen."}
</h2>
<div className="drawer-form">
{mode === "register" && ( {mode === "register" && (
<div className="drawer-grid drawer-grid--two"> <div className="drawer-grid drawer-grid--two">
<Field label="Name" value={form.first_name} onChange={(value) => update("first_name", value)} /> <Field
<Field label="Surname" value={form.surname} onChange={(value) => update("surname", value)} /> label="Name"
name="first_name"
value={form.first_name}
autoComplete="given-name"
describedBy={error ? errorId : undefined}
invalid={!!error}
onChange={(value) => update("first_name", value)}
/>
<Field
label="Nachname"
name="surname"
value={form.surname}
autoComplete="family-name"
describedBy={error ? errorId : undefined}
invalid={!!error}
onChange={(value) => update("surname", value)}
/>
</div> </div>
)} )}
<Field label="Email address" value={form.email} onChange={(value) => update("email", value)} />
<Field <Field
label="Password" id="auth-email"
label="E-Mail"
name="email"
type="email"
value={form.email}
autoComplete="email"
inputMode="email"
describedBy={error ? errorId : undefined}
invalid={!!error}
onChange={(value) => update("email", value)}
/>
<Field
id="auth-password"
label="Passwort"
name="password"
type="password" type="password"
value={form.password} value={form.password}
autoComplete={mode === "login" ? "current-password" : "new-password"}
describedBy={error ? errorId : undefined}
invalid={!!error}
onChange={(value) => update("password", value)} onChange={(value) => update("password", value)}
/> />
{error && <p className="drawer-error">{error}</p>} <DrawerError id={errorId}>{error}</DrawerError>
<button className="drawer-primary" type="submit" disabled={busy}> <button
{mode === "login" ? "Login" : "Register"} className="atmos-btn atmos-btn--primary atmos-btn--block"
type="submit"
disabled={busy}
>
{mode === "login" ? "Anmelden" : "Registrieren"}
</button> </button>
<button <button
className="drawer-secondary" className="atmos-btn atmos-btn--ghost atmos-btn--block atmos-btn--sm"
type="button" type="button"
onClick={() => setMode((current) => (current === "login" ? "register" : "login"))} onClick={() => setMode((current) => (current === "login" ? "register" : "login"))}
> >
{mode === "login" ? "Create account" : "Use existing account"} {mode === "login" ? "Konto erstellen" : "Bestehendes Konto nutzen"}
</button> </button>
</div>
</section>
</form> </form>
); );
} }
@@ -107,6 +218,7 @@ function CartPanel() {
city: user?.city || "", city: user?.city || "",
})); }));
const [paymentMethod, setPaymentMethod] = useState("Bill"); const [paymentMethod, setPaymentMethod] = useState("Bill");
const errorId = "cart-error";
const updateAddress = (key, value) => const updateAddress = (key, value) =>
setAddress((current) => ({ ...current, [key]: value })); setAddress((current) => ({ ...current, [key]: value }));
@@ -119,30 +231,39 @@ function CartPanel() {
return ( return (
<form className="drawer-stack" onSubmit={submit}> <form className="drawer-stack" onSubmit={submit}>
<section className="drawer-section"> <section className="drawer-section">
<span className="drawer-kicker">CART</span> <span className="drawer-eyebrow">Warenkorb</span>
{cart.items.length === 0 ? ( {cart.items.length === 0 ? (
<p className="drawer-muted">Your cart is empty.</p> <p className="drawer-muted">Dein Warenkorb ist leer.</p>
) : ( ) : (
<div className="cart-items"> <div className="cart-items">
{cart.items.map((item) => ( {cart.items.map((item) => {
const productName = item.product.name;
return (
<article className="cart-item" key={item.product_id}> <article className="cart-item" key={item.product_id}>
<div> <div className="cart-item-info">
<h3>{item.product.name}</h3> <h3>{productName}</h3>
<p> <p>
{item.product.size_label} · {formatChf(item.product.price_cents)} {item.product.size_label} · {formatChf(item.product.price_cents)}
</p> </p>
</div> </div>
<div className="cart-controls"> <div
className="cart-controls"
role="group"
aria-label={`${productName} Menge: ${item.quantity}`}
>
<button <button
type="button" type="button"
aria-label={`${productName} Menge verringern`}
onClick={() => updateCartQuantity(item.product_id, item.quantity - 1)} onClick={() => updateCartQuantity(item.product_id, item.quantity - 1)}
> >
- −
</button> </button>
<span>{item.quantity}</span> <span aria-live="polite">{item.quantity}</span>
<button <button
type="button" type="button"
aria-label={`${productName} Menge erhoehen`}
onClick={() => updateCartQuantity(item.product_id, item.quantity + 1)} onClick={() => updateCartQuantity(item.product_id, item.quantity + 1)}
> >
+ +
@@ -150,78 +271,126 @@ function CartPanel() {
</div> </div>
<button <button
className="cart-remove" className="atmos-btn atmos-btn--ghost atmos-btn--sm"
type="button" type="button"
aria-label={`${productName} aus dem Warenkorb entfernen`}
onClick={() => removeCartItem(item.product_id)} onClick={() => removeCartItem(item.product_id)}
> >
Remove Entfernen
</button> </button>
</article> </article>
))} );
})}
</div> </div>
)} )}
</section> </section>
<section className="drawer-section"> <section className="drawer-section">
<span className="drawer-kicker">SHIPPING</span> <span className="drawer-eyebrow">Versand</span>
<div className="drawer-grid drawer-grid--two"> <div className="drawer-grid drawer-grid--two">
<Field label="Street Name" value={address.street_name} onChange={(value) => updateAddress("street_name", value)} /> <Field
<Field label="House Number" value={address.house_number} onChange={(value) => updateAddress("house_number", value)} /> label="Strasse"
<Field label="ZIP Code" value={address.zip_code} onChange={(value) => updateAddress("zip_code", value)} /> value={address.street_name}
<Field label="City" value={address.city} onChange={(value) => updateAddress("city", value)} /> describedBy={error ? errorId : undefined}
invalid={!!error}
onChange={(value) => updateAddress("street_name", value)}
/>
<Field
label="Nr."
value={address.house_number}
describedBy={error ? errorId : undefined}
invalid={!!error}
onChange={(value) => updateAddress("house_number", value)}
/>
<Field
label="PLZ"
value={address.zip_code}
describedBy={error ? errorId : undefined}
invalid={!!error}
onChange={(value) => updateAddress("zip_code", value)}
/>
<Field
label="Ort"
value={address.city}
describedBy={error ? errorId : undefined}
invalid={!!error}
onChange={(value) => updateAddress("city", value)}
/>
</div> </div>
</section> </section>
<section className="drawer-section"> <section className="drawer-section">
<span className="drawer-kicker">PAYMENT</span> <span className="drawer-eyebrow">Zahlung</span>
<div className="payment-grid"> <fieldset
{paymentMethods.map((method) => ( className="payment-fieldset"
<button aria-describedby={error ? errorId : undefined}
type="button"
className={`payment-card ${paymentMethod === method.key ? "active" : ""}`}
key={method.key}
onClick={() => setPaymentMethod(method.key)}
> >
<span>{method.badge}</span> <legend className="visually-hidden">Zahlungsmethode</legend>
<div className="payment-grid">
{paymentMethods.map((method) => {
const active = paymentMethod === method.key;
return (
<label
className={`payment-card ${active ? "is-active" : ""}`}
key={method.key}
>
<input
className="payment-card__input"
type="radio"
name="payment_method"
value={method.key}
checked={active}
aria-invalid={!!error || undefined}
onChange={() => setPaymentMethod(method.key)}
/>
<span className="payment-card__badge" aria-hidden="true">
{method.badge}
</span>
<strong>{method.label}</strong> <strong>{method.label}</strong>
</button> </label>
))} );
})}
</div> </div>
</fieldset>
</section> </section>
<section className="drawer-section totals-box"> <section className="drawer-section drawer-totals">
<div> <div className="drawer-totals__row">
<span>Subtotal</span> <span>Zwischensumme</span>
<strong>{formatChf(cart.subtotal_cents)}</strong> <strong>{formatChf(cart.subtotal_cents)}</strong>
</div> </div>
<div> <div className="drawer-totals__row">
<span>Rabatte</span> <span>Rabatte</span>
<strong>-{formatChf(cart.discount_cents)}</strong> <strong>−{formatChf(cart.discount_cents)}</strong>
</div> </div>
{cart.discounts?.length > 0 && ( {cart.discounts?.length > 0 && (
<div className="discount-explainer"> <div className="drawer-totals__explainer">
<span>Applied automatically</span> <span className="drawer-eyebrow">Automatisch angewendet</span>
{cart.discounts.map((discount) => ( {cart.discounts.map((discount) => (
<p key={`${discount.type}-${discount.creditId}`}> <p key={`${discount.type}-${discount.creditId}`}>
<strong>{formatChf(discount.amount_cents)}</strong> <strong>{formatChf(discount.amount_cents)}</strong>
{" - "} {" — "}
{discount.type === "discovery" {discount.type === "discovery"
? "Discovery Set credit for a full-size bottle" ? "Discovery-Set-Gutschrift für einen 50-ml-Flakon"
: `Sample credit for ${discount.slug}`} : `Proben-Gutschrift für ${discount.slug}`}
</p> </p>
))} ))}
</div> </div>
)} )}
<div className="total-row"> <div className="drawer-totals__row drawer-totals__row--total">
<span>Total</span> <span>Gesamt</span>
<strong>{formatChf(cart.total_cents)}</strong> <strong>{formatChf(cart.total_cents)}</strong>
</div> </div>
</section> </section>
{error && <p className="drawer-error">{error}</p>} <DrawerError id={errorId}>{error}</DrawerError>
<button className="drawer-primary" type="submit" disabled={busy || cart.items.length === 0}> <button
Checkout className="atmos-btn atmos-btn--primary atmos-btn--block atmos-btn--lg"
type="submit"
disabled={busy || cart.items.length === 0}
>
Jetzt bezahlen
</button> </button>
</form> </form>
); );
@@ -229,9 +398,9 @@ function CartPanel() {
function RequirementRow({ label, met, children }) { function RequirementRow({ label, met, children }) {
return ( return (
<div className="requirement-row"> <div className={`drawer-requirement ${met ? "is-met" : ""}`}>
<span>{label}</span> <span>{label}</span>
<strong className={met ? "met" : ""}>{children || (met ? "met" : "open")}</strong> <strong>{children || (met ? "Erfüllt" : "Offen")}</strong>
</div> </div>
); );
} }
@@ -250,6 +419,7 @@ function ProfilePanel() {
} = useShop(); } = useShop();
const [editing, setEditing] = useState(false); const [editing, setEditing] = useState(false);
const [form, setForm] = useState(user || {}); const [form, setForm] = useState(user || {});
const errorId = "profile-error";
const update = (key, value) => setForm((current) => ({ ...current, [key]: value })); const update = (key, value) => setForm((current) => ({ ...current, [key]: value }));
const notifications = user?.notifications || {}; const notifications = user?.notifications || {};
@@ -284,72 +454,130 @@ function ProfilePanel() {
return ( return (
<div className="drawer-stack"> <div className="drawer-stack">
<section className="drawer-section profile-head"> <section className="drawer-section drawer-profile-head">
<span className="drawer-kicker">PROFILE</span> <div>
<h2>Hi, {user.first_name}</h2> <span className="drawer-eyebrow">Profil</span>
<button className="drawer-secondary" type="button" onClick={logout}> <h2 className="drawer-heading">Hallo, {user.first_name}.</h2>
Logout </div>
<button
className="atmos-btn atmos-btn--outline atmos-btn--sm"
type="button"
onClick={logout}
>
Abmelden
</button> </button>
</section> </section>
<section className="drawer-section"> <section className="drawer-section">
<div className="profile-section-header"> <header className="drawer-section-head">
<span className="drawer-kicker">PROFILE INFORMATION</span> <span className="drawer-eyebrow">Profil-Informationen</span>
{!editing && ( {!editing && (
<button className="drawer-secondary" type="button" onClick={() => setEditing(true)}> <button
Profil bearbeiten className="atmos-btn atmos-btn--ghost atmos-btn--sm"
type="button"
onClick={() => setEditing(true)}
>
Bearbeiten
</button> </button>
)} )}
</div> </header>
{editing ? ( {editing ? (
<> <>
<div className="drawer-grid drawer-grid--two"> <div className="drawer-grid drawer-grid--two">
<Field label="Name" value={form.first_name || ""} onChange={(value) => update("first_name", value)} /> <Field
<Field label="Surname" value={form.surname || ""} onChange={(value) => update("surname", value)} /> label="Name"
<Field label="Street Name" value={form.street_name || ""} onChange={(value) => update("street_name", value)} /> value={form.first_name || ""}
<Field label="House Number" value={form.house_number || ""} onChange={(value) => update("house_number", value)} /> describedBy={error ? errorId : undefined}
<Field label="ZIP Code" value={form.zip_code || ""} onChange={(value) => update("zip_code", value)} /> invalid={!!error}
<Field label="City" value={form.city || ""} onChange={(value) => update("city", value)} /> onChange={(value) => update("first_name", value)}
<Field label="Birthdate" type="date" value={form.birthdate || ""} onChange={(value) => update("birthdate", value)} /> />
<Field
label="Nachname"
value={form.surname || ""}
describedBy={error ? errorId : undefined}
invalid={!!error}
onChange={(value) => update("surname", value)}
/>
<Field
label="Strasse"
value={form.street_name || ""}
describedBy={error ? errorId : undefined}
invalid={!!error}
onChange={(value) => update("street_name", value)}
/>
<Field
label="Nr."
value={form.house_number || ""}
describedBy={error ? errorId : undefined}
invalid={!!error}
onChange={(value) => update("house_number", value)}
/>
<Field
label="PLZ"
value={form.zip_code || ""}
describedBy={error ? errorId : undefined}
invalid={!!error}
onChange={(value) => update("zip_code", value)}
/>
<Field
label="Ort"
value={form.city || ""}
describedBy={error ? errorId : undefined}
invalid={!!error}
onChange={(value) => update("city", value)}
/>
<Field
label="Geburtsdatum"
type="date"
value={form.birthdate || ""}
describedBy={error ? errorId : undefined}
invalid={!!error}
onChange={(value) => update("birthdate", value)}
/>
</div> </div>
<div className="drawer-actions"> <div className="atmos-btn-row">
<button className="drawer-primary" type="button" disabled={busy} onClick={save}> <button
Save profile className="atmos-btn atmos-btn--primary"
type="button"
disabled={busy}
onClick={save}
>
Profil speichern
</button> </button>
<button <button
className="drawer-secondary" className="atmos-btn atmos-btn--outline"
type="button" type="button"
onClick={() => { onClick={() => {
setForm(user); setForm(user);
setEditing(false); setEditing(false);
}} }}
> >
Cancel Abbrechen
</button> </button>
</div> </div>
</> </>
) : ( ) : (
<div className="profile-read-grid"> <div className="profile-read-grid">
<ReadBlock label="Name" value={user.first_name} /> <ReadBlock label="Name" value={user.first_name} />
<ReadBlock label="Surname" value={user.surname} /> <ReadBlock label="Nachname" value={user.surname} />
<ReadBlock label="Street Name" value={user.street_name || "-"} /> <ReadBlock label="Strasse" value={user.street_name || "—"} />
<ReadBlock label="House Number" value={user.house_number || "-"} /> <ReadBlock label="Nr." value={user.house_number || "—"} />
<ReadBlock label="ZIP Code" value={user.zip_code || "-"} /> <ReadBlock label="PLZ" value={user.zip_code || "—"} />
<ReadBlock label="City" value={user.city || "-"} /> <ReadBlock label="Ort" value={user.city || "—"} />
<ReadBlock label="Birthdate" value={user.birthdate || "-"} /> <ReadBlock label="Geburtsdatum" value={user.birthdate || "—"} />
</div> </div>
)} )}
</section> </section>
<section className="drawer-section"> <section className="drawer-section">
<span className="drawer-kicker">DISCOUNT STATUS</span> <span className="drawer-eyebrow">Rabattstatus</span>
<div className="status-box">{user.discoveryStatus}</div> <div className="drawer-status-box">{formatDiscoveryStatus(user.discoveryStatus)}</div>
{user.sampleCredits?.length > 0 && ( {user.sampleCredits?.length > 0 && (
<div className="sample-credit-list"> <div className="drawer-credit-list">
{user.sampleCredits.map((credit) => ( {user.sampleCredits.map((credit) => (
<span key={`${credit.slug}-${credit.created_at}`}> <span key={`${credit.slug}-${credit.created_at}`}>
{credit.slug}: {credit.status} {credit.slug}: {formatCreditStatus(credit.status)}
</span> </span>
))} ))}
</div> </div>
@@ -357,37 +585,42 @@ function ProfilePanel() {
</section> </section>
<section className="drawer-section"> <section className="drawer-section">
<span className="drawer-kicker">DROP / RESTOCK PREFERENCES</span> <span className="drawer-eyebrow">Drop- und Verfügbarkeits-Einstellungen</span>
<div className="toggle-grid"> <div className="drawer-toggle-grid">
{notificationLabels.map(([key, label]) => ( {notificationLabels.map(([key, label]) => {
const active = !!notifications[key];
return (
<button <button
key={key} key={key}
type="button" type="button"
className={`pref-toggle ${notifications[key] ? "active" : ""}`} aria-pressed={active}
className={`drawer-toggle ${active ? "is-active" : ""}`}
onClick={() => togglePreference(key)} onClick={() => togglePreference(key)}
> >
<span>{label}</span> <span>{label}</span>
<strong>{notifications[key] ? "Active" : "Inactive"}</strong> <strong>{active ? "Aktiv" : "Inaktiv"}</strong>
</button> </button>
))} );
})}
</div> </div>
<div className="subscription-list"> <div className="drawer-subscription-list">
<span className="subscription-list-title">Subscribed Restocks</span> <span className="drawer-eyebrow">Abonnierte Restocks</span>
{restockSubscriptions.length === 0 ? ( {restockSubscriptions.length === 0 ? (
<p className="drawer-muted">No product-specific restock updates yet.</p> <p className="drawer-muted">Noch keine produktbezogenen Restock-Updates.</p>
) : ( ) : (
restockSubscriptions.map((subscription) => ( restockSubscriptions.map((subscription) => (
<article className="subscription-row" key={subscription.id}> <article className="drawer-subscription-row" key={subscription.id}>
<div> <div>
<strong>{subscription.name}</strong> <strong>{subscription.name}</strong>
<span>{subscription.size_label}</span> <span>{subscription.size_label}</span>
</div> </div>
<button <button
type="button" type="button"
className="atmos-btn atmos-btn--ghost atmos-btn--sm"
onClick={() => removeProductSubscription(subscription.id).catch(() => {})} onClick={() => removeProductSubscription(subscription.id).catch(() => {})}
> >
Delete Entfernen
</button> </button>
</article> </article>
)) ))
@@ -396,20 +629,22 @@ function ProfilePanel() {
</section> </section>
<section className="drawer-section"> <section className="drawer-section">
<span className="drawer-kicker">SMALL BATCH ACCESS</span> <span className="drawer-eyebrow">Small-Batch-Zugang</span>
<div className="status-box">{loyalty.unlocked ? "Unlocked" : "Locked"}</div> <div className="drawer-status-box">
<div className="requirements"> {loyalty.unlocked ? "Freigeschaltet" : "Noch gesperrt"}
</div>
<div className="drawer-requirements">
<RequirementRow label="Discovery Set" met={loyalty.hasDiscoverySet} /> <RequirementRow label="Discovery Set" met={loyalty.hasDiscoverySet} />
<RequirementRow label="Full Size" met={loyalty.hasFullSize} /> <RequirementRow label="50 ml Flakon" met={loyalty.hasFullSize} />
<RequirementRow label="Purchases" met={loyalty.purchases >= 3}> <RequirementRow label="Bestellungen" met={loyalty.purchases >= 3}>
{loyalty.purchases}/3 Purchases {loyalty.purchases}/3
</RequirementRow> </RequirementRow>
<RequirementRow label="Spend" met={loyalty.spent_cents > 50000}> <RequirementRow label="Umsatz" met={loyalty.spent_cents > 50000}>
{formatChf(loyalty.spent_cents)} / CHF 500+ {formatChf(loyalty.spent_cents)} / CHF 500+
</RequirementRow> </RequirementRow>
</div> </div>
<Link <Link
className="drawer-primary drawer-link-primary" className="atmos-btn atmos-btn--secondary atmos-btn--block"
to="/small-batch" to="/small-batch"
onClick={closePanel} onClick={closePanel}
> >
@@ -418,33 +653,33 @@ function ProfilePanel() {
</section> </section>
<section className="drawer-section"> <section className="drawer-section">
<span className="drawer-kicker">PURCHASES</span> <span className="drawer-eyebrow">Bestellungen</span>
{orders.length === 0 ? ( {orders.length === 0 ? (
<p className="drawer-muted">No orders yet.</p> <p className="drawer-muted">Noch keine Bestellungen.</p>
) : ( ) : (
<div className="order-list"> <div className="drawer-order-list">
{orders.map((order) => ( {orders.map((order) => (
<article className="order-card" key={order.id}> <article className="drawer-order-card" key={order.id}>
<div> <header>
<strong>Order #{order.id}</strong> <strong>Bestellung #{order.id}</strong>
<span>{new Date(order.created_at).toLocaleDateString("de-CH")}</span> <span>{new Date(order.created_at).toLocaleDateString("de-CH")}</span>
</div> </header>
<p>{order.items.map((item) => `${item.quantity} x ${item.product.name}`).join(", ")}</p> <p>{order.items.map((item) => `${item.quantity} × ${item.product.name}`).join(", ")}</p>
<strong>{formatChf(order.total_cents)}</strong> <strong className="drawer-order-card__total">{formatChf(order.total_cents)}</strong>
</article> </article>
))} ))}
</div> </div>
)} )}
</section> </section>
{error && <p className="drawer-error">{error}</p>} <DrawerError id={errorId}>{error}</DrawerError>
</div> </div>
); );
} }
function ReadBlock({ label, value }) { function ReadBlock({ label, value }) {
return ( return (
<div className="read-block"> <div className="drawer-read-block">
<span>{label}</span> <span>{label}</span>
<strong>{value}</strong> <strong>{value}</strong>
</div> </div>
@@ -453,20 +688,133 @@ function ReadBlock({ label, value }) {
function ShopDrawer() { function ShopDrawer() {
const { closePanel, panelOpen, panelType, user } = useShop(); const { closePanel, panelOpen, panelType, user } = useShop();
const drawerRef = useRef(null);
const restoreFocusRef = useRef(null);
const wasOpenRef = useRef(false);
const drawerTitleId = useId();
const drawerLabel = !user ? "Konto" : panelType === "cart" ? "Warenkorb" : "Profil";
useEffect(() => {
if (typeof document === "undefined") return undefined;
if (!panelOpen) {
if (wasOpenRef.current) {
const restoreTarget = restoreFocusRef.current;
if (restoreTarget && document.contains(restoreTarget)) {
window.requestAnimationFrame(() => {
restoreTarget.focus({ preventScroll: true });
});
}
}
wasOpenRef.current = false;
return undefined;
}
wasOpenRef.current = true;
const activeElement = document.activeElement;
if (
activeElement instanceof HTMLElement &&
!drawerRef.current?.contains(activeElement)
) {
restoreFocusRef.current = activeElement;
}
const previousOverflow = document.body.style.overflow;
document.body.style.overflow = "hidden";
const frameId = window.requestAnimationFrame(() => {
const drawer = drawerRef.current;
if (!drawer) return;
const [firstFocusable] = getFocusableElements(drawer);
(firstFocusable || drawer).focus({ preventScroll: true });
});
return () => {
window.cancelAnimationFrame(frameId);
document.body.style.overflow = previousOverflow;
};
}, [panelOpen]);
useEffect(() => {
if (!panelOpen || typeof document === "undefined") return undefined;
const drawer = drawerRef.current;
if (!drawer) return undefined;
const handleKeyDown = (event) => {
if (event.key === "Escape") {
event.preventDefault();
closePanel();
return;
}
if (event.key !== "Tab") return;
const focusableElements = getFocusableElements(drawer);
if (focusableElements.length === 0) {
event.preventDefault();
drawer.focus({ preventScroll: true });
return;
}
const firstFocusable = focusableElements[0];
const lastFocusable = focusableElements[focusableElements.length - 1];
if (!drawer.contains(document.activeElement)) {
event.preventDefault();
firstFocusable.focus({ preventScroll: true });
return;
}
if (event.shiftKey && document.activeElement === firstFocusable) {
event.preventDefault();
lastFocusable.focus({ preventScroll: true });
return;
}
if (!event.shiftKey && document.activeElement === lastFocusable) {
event.preventDefault();
firstFocusable.focus({ preventScroll: true });
}
};
document.addEventListener("keydown", handleKeyDown);
return () => document.removeEventListener("keydown", handleKeyDown);
}, [closePanel, panelOpen]);
return ( return (
<> <>
<div <div
className={`drawer-backdrop ${panelOpen ? "open" : ""}`} className={`drawer-backdrop ${panelOpen ? "is-open" : ""}`}
aria-hidden="true"
onClick={closePanel} onClick={closePanel}
/> />
<aside className={`shop-drawer ${panelOpen ? "open" : ""}`} aria-hidden={!panelOpen}> <aside
<div className="drawer-top"> id="shop-drawer"
<span>{!user ? "ACCOUNT" : panelType === "cart" ? "CART" : "PROFILE"}</span> ref={drawerRef}
<button type="button" onClick={closePanel} aria-label="Close panel"> role="dialog"
x className={`shop-drawer ${panelOpen ? "is-open" : ""}`}
aria-labelledby={drawerTitleId}
aria-modal="true"
aria-hidden={!panelOpen}
inert={!panelOpen ? "" : undefined}
tabIndex={-1}
data-lenis-prevent
>
<header className="drawer-top">
<span className="drawer-eyebrow" id={drawerTitleId}>
{drawerLabel}
</span>
<button
type="button"
className="atmos-btn atmos-btn--outline atmos-btn--icon atmos-btn--sm"
onClick={closePanel}
aria-label="Panel schliessen"
>
<span aria-hidden="true">×</span>
</button> </button>
</div> </header>
{!user ? <AuthPanel /> : panelType === "cart" ? <CartPanel /> : <ProfilePanel />} {!user ? <AuthPanel /> : panelType === "cart" ? <CartPanel /> : <ProfilePanel />}
</aside> </aside>
</> </>
+110
View File
@@ -0,0 +1,110 @@
.sticky-buy-bar {
display: none;
}
@media (max-width: 1023px) {
.sticky-buy-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
z-index: 900;
display: block;
padding: 0.55rem var(--page-x, 1rem);
background: var(--theme-bg);
border-top: 1px solid var(--theme-border);
transform: translateY(100%);
opacity: 0;
transition:
transform var(--duration-med, 0.3s) var(--ease-out, ease-out),
opacity var(--duration-med, 0.3s) var(--ease-out, ease-out);
pointer-events: none;
}
.sticky-buy-bar.is-visible {
transform: translateY(0);
opacity: 1;
pointer-events: auto;
}
.sticky-buy-bar__inner {
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--gap-sm, 0.75rem);
max-width: 46rem;
margin-inline: auto;
}
.sticky-buy-bar__left {
display: flex;
align-items: center;
gap: 0.75rem;
min-width: 0;
}
.sticky-buy-bar__label {
color: var(--theme-text-muted);
font-size: var(--text-xs, 0.72rem);
letter-spacing: 0.18em;
text-transform: uppercase;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.sticky-buy-bar__price {
color: var(--theme-text);
font-size: clamp(0.92rem, 3vw, 1.1rem);
font-weight: 400;
letter-spacing: 0;
white-space: nowrap;
}
/* ---- segmented size toggle ---- */
.sticky-buy-bar__toggle {
display: flex;
border: 1px solid var(--theme-border);
overflow: hidden;
}
.sticky-buy-bar__tab {
padding: 0.4rem 0.65rem;
border: 0;
background: transparent;
color: var(--theme-text-muted);
font-size: 0.66rem;
letter-spacing: 0.14em;
text-transform: uppercase;
white-space: nowrap;
cursor: pointer;
transition:
color var(--duration-med, 0.3s) var(--ease-out, ease-out),
background-color var(--duration-med, 0.3s) var(--ease-out, ease-out);
}
.sticky-buy-bar__tab + .sticky-buy-bar__tab {
border-left: 1px solid var(--theme-border);
}
.sticky-buy-bar__tab.active {
color: var(--theme-accent-contrast, #fff);
background: var(--theme-accent);
}
/* ---- buy button ---- */
.sticky-buy-bar .atmos-btn {
flex-shrink: 0;
min-width: 6.5rem;
}
}
@media (max-width: 820px) {
.sticky-buy-bar.is-always-visible {
transform: translateY(0);
opacity: 1;
pointer-events: auto;
}
}
@@ -0,0 +1,71 @@
import { useEffect, useRef, useState } from "react";
import "./StickyBuyBar.css";
function StickyBuyBar({ label, price, onBuy, observeRef, sizes, selectedSize, onSizeChange, alwaysVisibleMobile }) {
const [visible, setVisible] = useState(false);
const sentinelRef = useRef(null);
useEffect(() => {
const target = observeRef?.current ?? sentinelRef.current;
if (!target) return;
const observer = new IntersectionObserver(
([entry]) => setVisible(!entry.isIntersecting),
{ threshold: 0 }
);
observer.observe(target);
return () => observer.disconnect();
}, [observeRef]);
const classes = [
"sticky-buy-bar",
visible && "is-visible",
alwaysVisibleMobile && "is-always-visible",
].filter(Boolean).join(" ");
const currentPrice = sizes
? sizes.find((s) => s.key === selectedSize)?.price
: price;
return (
<>
{!observeRef && <span ref={sentinelRef} aria-hidden="true" />}
<div className={classes}>
<div className="sticky-buy-bar__inner">
{sizes ? (
<div className="sticky-buy-bar__left">
<div className="sticky-buy-bar__toggle">
{sizes.map((s) => (
<button
key={s.key}
type="button"
className={`sticky-buy-bar__tab ${selectedSize === s.key ? "active" : ""}`}
onClick={() => onSizeChange(s.key)}
>
{s.label}
</button>
))}
</div>
<strong className="sticky-buy-bar__price">{currentPrice}</strong>
</div>
) : (
<div className="sticky-buy-bar__left">
<span className="sticky-buy-bar__label">{label}</span>
<strong className="sticky-buy-bar__price">{currentPrice}</strong>
</div>
)}
<button
type="button"
className="atmos-btn atmos-btn--primary atmos-btn--uppercase atmos-btn--sm"
onClick={onBuy}
>
Kaufen
</button>
</div>
</div>
</>
);
}
export default StickyBuyBar;
Loaded 100 of 141 files, more files were not shown because too many files have changed in this diff. Show more