add productdetailpage
This commit is contained in:
1 parent
6479792acf
commit
624c8c8f1a
9 files changed
+1218
-386
No files matched your search
@@ -0,0 +1,432 @@
|
||||
/*
|
||||
Hallo im CSS,
|
||||
ich versuche auch hier die Struktur sauber zu kommentieren, damit ihr nicht
|
||||
im Styling-Dschungel verloren geht und schneller versteht, was wohin gehört.
|
||||
|
||||
Bei Bugs, kleinen Krisen oder emotionalem Kontrollverlust bitte
|
||||
https://stackoverflow.com/questions konsultieren
|
||||
oder fragt Salih oder eine KI eures Vertrauens.
|
||||
*/
|
||||
|
||||
/* --- Product Detail Page Wrapper Start --- */
|
||||
|
||||
.detail-page {
|
||||
min-height: 100vh;
|
||||
background: #efefef;
|
||||
color: #191919;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.detail-shell {
|
||||
background: #f7f7f7;
|
||||
border: 1px solid #d6d6d6;
|
||||
padding: 22px;
|
||||
}
|
||||
|
||||
/* --- Product Detail Page Wrapper End --- */
|
||||
|
||||
/* --- Back Link Start --- */
|
||||
|
||||
.back-link {
|
||||
background: none;
|
||||
border: none;
|
||||
padding: 0;
|
||||
margin-bottom: 18px;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
color: #222;
|
||||
}
|
||||
|
||||
/* --- Back Link End --- */
|
||||
|
||||
/* --- Main Detail Layout Start --- */
|
||||
|
||||
.detail-layout {
|
||||
display: grid;
|
||||
grid-template-columns: 1.02fr 1fr;
|
||||
gap: 28px;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
/* --- Main Detail Layout End --- */
|
||||
|
||||
/* --- Left Column / Gallery Start --- */
|
||||
|
||||
.detail-gallery {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.detail-main-image {
|
||||
background: #ddd;
|
||||
aspect-ratio: 1 / 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.detail-main-image img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.detail-thumbs {
|
||||
display: flex;
|
||||
gap: 14px;
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
.thumb-btn {
|
||||
width: 88px;
|
||||
height: 88px;
|
||||
border: 1px solid #cfcfcf;
|
||||
background: #fff;
|
||||
padding: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.thumb-btn.active {
|
||||
outline: 2px solid #4da3ff;
|
||||
outline-offset: 1px;
|
||||
}
|
||||
|
||||
.thumb-btn img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
/* --- Left Column / Gallery End --- */
|
||||
|
||||
/* --- Duftstruktur Start --- */
|
||||
|
||||
.detail-structure {
|
||||
margin-top: 28px;
|
||||
}
|
||||
|
||||
.detail-structure h3 {
|
||||
font-size: 12px;
|
||||
letter-spacing: 0.24em;
|
||||
font-weight: 500;
|
||||
margin: 0 0 14px;
|
||||
}
|
||||
|
||||
.structure-block {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.structure-phase {
|
||||
display: block;
|
||||
margin-bottom: 6px;
|
||||
font-size: 10px;
|
||||
letter-spacing: 0.18em;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.structure-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.structure-tags span {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: 34px;
|
||||
padding: 8px 14px;
|
||||
border: 1px solid #d2d2d2;
|
||||
background: #ebebeb;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.mood-box {
|
||||
margin-top: 18px;
|
||||
background: #dfdfdf;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.mood-label {
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
font-size: 10px;
|
||||
letter-spacing: 0.2em;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.mood-box p {
|
||||
font-size: 15px;
|
||||
line-height: 1.5;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* --- Duftstruktur End --- */
|
||||
|
||||
/* --- Meta Infos unter Duftstruktur Start --- */
|
||||
|
||||
.detail-meta-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr 1.5fr;
|
||||
gap: 20px;
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
.detail-meta-grid span {
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
font-size: 10px;
|
||||
letter-spacing: 0.2em;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.detail-meta-grid p {
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* --- Meta Infos unter Duftstruktur End --- */
|
||||
|
||||
/* --- Right Column Start --- */
|
||||
|
||||
.detail-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 22px;
|
||||
}
|
||||
|
||||
.detail-heading h1 {
|
||||
margin: 0 0 6px;
|
||||
font-size: 52px;
|
||||
line-height: 0.95;
|
||||
font-weight: 400;
|
||||
letter-spacing: -0.04em;
|
||||
color: #131313;
|
||||
}
|
||||
|
||||
.detail-heading p {
|
||||
font-size: 22px;
|
||||
color: #3f3f3f;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.detail-section-block {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.label-title {
|
||||
display: block;
|
||||
margin-bottom: 10px;
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.24em;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
/* --- Right Column End --- */
|
||||
|
||||
/* --- Material Tags Start --- */
|
||||
|
||||
.material-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.material-tags span {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: 34px;
|
||||
padding: 8px 14px;
|
||||
border: 1px solid #d2d2d2;
|
||||
background: #ebebeb;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* --- Material Tags End --- */
|
||||
|
||||
/* --- Size Selection Start --- */
|
||||
|
||||
.size-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.size-card {
|
||||
border: 1px solid #d0d0d0;
|
||||
background: #fefefe;
|
||||
padding: 18px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.size-card.active {
|
||||
border-color: #111;
|
||||
}
|
||||
|
||||
.size-title {
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.size-card strong {
|
||||
display: block;
|
||||
font-size: 28px;
|
||||
font-weight: 400;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.size-card small {
|
||||
font-size: 11px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
/* --- Size Selection End --- */
|
||||
|
||||
/* --- Discovery Hinweis + Kaufen Button Start --- */
|
||||
|
||||
.discovery-note {
|
||||
background: #050505;
|
||||
color: #fff;
|
||||
padding: 14px 16px;
|
||||
}
|
||||
|
||||
.discovery-note strong {
|
||||
display: block;
|
||||
margin-bottom: 6px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.discovery-note p {
|
||||
font-size: 11px;
|
||||
color: rgba(255, 255, 255, 0.78);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.buy-button {
|
||||
width: 100%;
|
||||
border: none;
|
||||
background: #050505;
|
||||
color: #fff;
|
||||
padding: 18px;
|
||||
font-size: 16px;
|
||||
letter-spacing: 0.08em;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* --- Discovery Hinweis + Kaufen Button End --- */
|
||||
|
||||
/* --- Description Columns Start --- */
|
||||
|
||||
.detail-columns {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 22px 30px;
|
||||
}
|
||||
|
||||
.detail-copy-block p {
|
||||
white-space: pre-line;
|
||||
color: #2b2b2b;
|
||||
line-height: 1.55;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* --- Description Columns End --- */
|
||||
|
||||
/* --- Bottom Upsell Bar Start --- */
|
||||
|
||||
.detail-upsell-bar {
|
||||
margin-top: auto;
|
||||
background: #060606;
|
||||
color: #fff;
|
||||
padding: 12px 16px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.detail-upsell-bar strong {
|
||||
display: block;
|
||||
margin-bottom: 4px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.detail-upsell-bar p {
|
||||
font-size: 11px;
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* --- Bottom Upsell Bar End --- */
|
||||
|
||||
/* --- Bottom CTA Start --- */
|
||||
|
||||
.detail-bottom-cta {
|
||||
margin-top: 42px;
|
||||
padding: 42px 20px 16px;
|
||||
border-top: 1px solid #d4d4d4;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.detail-bottom-cta h2 {
|
||||
margin: 0 0 14px;
|
||||
font-size: 34px;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.detail-bottom-cta p {
|
||||
max-width: 880px;
|
||||
margin: 0 auto;
|
||||
color: #333;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.detail-bottom-actions {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 16px;
|
||||
margin-top: 26px;
|
||||
}
|
||||
|
||||
.detail-bottom-actions button {
|
||||
border: 1px solid #101010;
|
||||
background: transparent;
|
||||
padding: 16px 24px;
|
||||
min-width: 250px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* --- Bottom CTA End --- */
|
||||
|
||||
/* --- Responsive Start --- */
|
||||
|
||||
@media (max-width: 1100px) {
|
||||
.detail-layout {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.detail-heading h1 {
|
||||
font-size: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 700px) {
|
||||
.detail-columns,
|
||||
.detail-meta-grid,
|
||||
.size-grid,
|
||||
.detail-bottom-actions {
|
||||
grid-template-columns: 1fr;
|
||||
display: grid;
|
||||
}
|
||||
|
||||
.detail-bottom-actions button {
|
||||
min-width: 100%;
|
||||
}
|
||||
|
||||
.detail-thumbs {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
|
||||
/* --- Responsive End --- */
|
||||
@@ -0,0 +1,232 @@
|
||||
import { useMemo, useState } from "react";
|
||||
import perfumes from "../data/perfumes";
|
||||
import "../navbar.css";
|
||||
import "./ProductDetailPage.css";
|
||||
|
||||
function ProductDetailPage({ perfumeSlug = "kalter-beton" }) {
|
||||
const perfume = useMemo(
|
||||
() => perfumes.find((item) => item.slug === perfumeSlug) || perfumes[0],
|
||||
[perfumeSlug]
|
||||
);
|
||||
|
||||
const [selectedImage, setSelectedImage] = useState(
|
||||
perfume.gallery?.[0] || perfume.image
|
||||
);
|
||||
const [selectedSize, setSelectedSize] = useState("sample");
|
||||
|
||||
const sizeOptions = [
|
||||
{
|
||||
key: "sample",
|
||||
title: "Sample 2ml",
|
||||
price: perfume.prices.sample,
|
||||
note: "Zum Testen · ca. 20 Anwendungen",
|
||||
},
|
||||
{
|
||||
key: "full",
|
||||
title: "Full Size 50ml",
|
||||
price: perfume.prices.full,
|
||||
note: "Nachkauf · 500+ Anwendungen",
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="detail-page">
|
||||
{/* Navbar */}
|
||||
<nav className="navbar navbar--light">
|
||||
<div className="nav-pill">
|
||||
<a href="#home" className="nav-link active">
|
||||
Name
|
||||
</a>
|
||||
<a href="#dufte" className="nav-link">
|
||||
Düfte
|
||||
</a>
|
||||
<a href="#testen" className="nav-link">
|
||||
Testen
|
||||
</a>
|
||||
<a href="#cart" className="nav-link">
|
||||
Cart
|
||||
</a>
|
||||
</div>
|
||||
</nav>
|
||||
{/* --- Navbar End --- */}
|
||||
|
||||
{/* Product detail content */}
|
||||
<main className="detail-shell">
|
||||
<button className="back-link" type="button">
|
||||
← Zurück zur Startseite
|
||||
</button>
|
||||
|
||||
<section className="detail-layout">
|
||||
{/* Left column */}
|
||||
<div className="detail-gallery">
|
||||
<div className="detail-main-image">
|
||||
<img src={selectedImage} alt={perfume.name} />
|
||||
</div>
|
||||
|
||||
<div className="detail-thumbs">
|
||||
{[perfume.image, ...(perfume.gallery || [])]
|
||||
.slice(0, 3)
|
||||
.map((img, index) => (
|
||||
<button
|
||||
key={`${img}-${index}`}
|
||||
type="button"
|
||||
className={`thumb-btn ${selectedImage === img ? "active" : ""}`}
|
||||
onClick={() => setSelectedImage(img)}
|
||||
>
|
||||
<img src={img} alt={`${perfume.name} Ansicht ${index + 1}`} />
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="detail-structure">
|
||||
<h3>DUFTSTRUKTUR</h3>
|
||||
|
||||
<div className="structure-block">
|
||||
<span className="structure-phase">PHASE 1: TOP NOTES (0–1 H)</span>
|
||||
<div className="structure-tags">
|
||||
{perfume.phases.top.map((note) => (
|
||||
<span key={note}>{note}</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="structure-block">
|
||||
<span className="structure-phase">PHASE 2: HEART NOTES (1–4 H)</span>
|
||||
<div className="structure-tags">
|
||||
{perfume.phases.heart.map((note) => (
|
||||
<span key={note}>{note}</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="structure-block">
|
||||
<span className="structure-phase">PHASE 3: BASE NOTES (4 H+)</span>
|
||||
<div className="structure-tags">
|
||||
{perfume.phases.base.map((note) => (
|
||||
<span key={note}>{note}</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mood-box">
|
||||
<span className="mood-label">MOODSETTING</span>
|
||||
<p>{perfume.mood}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="detail-meta-grid">
|
||||
<div>
|
||||
<span>TRAGEHINWEIS</span>
|
||||
<p>{perfume.dosage}</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span>HALTBARKEIT</span>
|
||||
<p>{perfume.longevity}</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span>ANLASS</span>
|
||||
<p>{perfume.occasion}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Right column */}
|
||||
<div className="detail-info">
|
||||
<div className="detail-heading">
|
||||
<h1>{perfume.name}</h1>
|
||||
<p>{perfume.shortText}</p>
|
||||
</div>
|
||||
|
||||
<div className="detail-section-block">
|
||||
<span className="label-title">MATERIAL-KOMPOSITION</span>
|
||||
<div className="material-tags">
|
||||
{perfume.materialTags.map((tag) => (
|
||||
<span key={tag}>{tag}</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="detail-section-block">
|
||||
<span className="label-title">GRÖSSE WÄHLEN</span>
|
||||
<div className="size-grid">
|
||||
{sizeOptions.map((option) => (
|
||||
<button
|
||||
key={option.key}
|
||||
type="button"
|
||||
className={`size-card ${selectedSize === option.key ? "active" : ""}`}
|
||||
onClick={() => setSelectedSize(option.key)}
|
||||
>
|
||||
<span className="size-title">{option.title}</span>
|
||||
<strong>{option.price}</strong>
|
||||
<small>{option.note}</small>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="discovery-note">
|
||||
<strong>Discovery Set wird angerechnet</strong>
|
||||
<p>
|
||||
Hast du das Discovery Set gekauft, wird der volle Preis beim Kauf
|
||||
automatisch abgezogen.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<button className="buy-button" type="button">
|
||||
KAUFEN
|
||||
</button>
|
||||
|
||||
<div className="detail-columns">
|
||||
<div className="detail-copy-block">
|
||||
<span className="label-title">BESCHREIBUNG</span>
|
||||
<p>{perfume.description}</p>
|
||||
</div>
|
||||
|
||||
<div className="detail-copy-block">
|
||||
<span className="label-title">HERKUNFT</span>
|
||||
<p>{perfume.origin}</p>
|
||||
</div>
|
||||
|
||||
<div className="detail-copy-block">
|
||||
<span className="label-title">KONZENTRATION</span>
|
||||
<p>{perfume.concentration}</p>
|
||||
</div>
|
||||
|
||||
<div className="detail-copy-block">
|
||||
<span className="label-title">EDITION</span>
|
||||
<p>{perfume.edition}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="detail-upsell-bar">
|
||||
<div>
|
||||
<strong>Noch unsicher?</strong>
|
||||
<p>Discovery Set bestellen und Düfte testen</p>
|
||||
</div>
|
||||
<span>—</span>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Bottom CTA */}
|
||||
<section className="detail-bottom-cta">
|
||||
<h2>Lieber erst testen?</h2>
|
||||
<p>
|
||||
Bestelle ein 2ml Sample für CHF 12 oder das komplette Discovery Set
|
||||
mit allen 6 Düften für CHF 48. Beide werden beim späteren Full-Size-Kauf
|
||||
vollständig angerechnet.
|
||||
</p>
|
||||
|
||||
<div className="detail-bottom-actions">
|
||||
<button type="button">SAMPLE BESTELLEN – CHF 12</button>
|
||||
<button type="button">DISCOVERY SET – CHF 48</button>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default ProductDetailPage;
|
||||
Reference in new issue
Block a user