Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions frontend/src/components/cartIllustration/CartIllustration.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/* CartIllustration – handlevogna på startsiden */

/* ---------- Oppsett ---------- */

.cart-illustration {
margin: 24px 0 0;
}

/* «Veien» handlevogna ruller på. container-type gjør at vi kan bruke
bredden (cqw) i animasjonen under. */
.cart-illustration__track {
container-type: inline-size;
border-bottom: 1px dashed var(--border-hairline);
}

.cart-illustration__cart {
display: block;
width: 13.75rem;
max-width: 60%;
height: auto;
color: var(--text-primary);
overflow: visible;
}

.cart-illustration__grid {
stroke: var(--border-brand);
stroke-width: 1.4;
opacity: 0.55;
}

/* Hjulene roterer rundt sitt eget midtpunkt */
.cart-illustration__wheel {
transform-box: fill-box;
transform-origin: center;
}

/* ---------- Ruller når man blar ----------
Scroll-drevet animasjon: framdriften følger hvor langt siden er blått,
ikke tid. Ren CSS, ingen JavaScript.
- Nettlesere uten støtte (f.eks. Firefox): handlevogna står til venstre.
- Redusert bevegelse i systemet: handlevogna står stille. */

@supports (animation-timeline: scroll()) {
@media (prefers-reduced-motion: no-preference) {
.cart-illustration__cart {
animation: cart-roll linear both;
animation-timeline: scroll(root);
animation-range: 0 60vh;
}

.cart-illustration__wheel {
animation: cart-wheel linear both;
animation-timeline: scroll(root);
animation-range: 0 60vh;
}
}
}

@keyframes cart-roll {
from {
translate: 0 0;
}
to {
/* Helt til høyre: bredden på veien minus bredden på handlevogna */
translate: calc(100cqw - 100%) 0;
}
}

@keyframes cart-wheel {
to {
rotate: 720deg;
}
}

/* ---------- Mobil ----------
Skjules på smale skjermer, så søket ikke skyves langt ned. */

@media (max-width: 600px) {
.cart-illustration {
display: none;
}
}
71 changes: 71 additions & 0 deletions frontend/src/components/cartIllustration/CartIllustration.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import "./CartIllustration.css";

// Håndtegnet handlevogn på startsiden, i samme strek som lappen ved siden av.
// Den ruller mot høyre når man blar nedover (se CartIllustration.css).
//
// Ren pynt: aria-hidden, så skjermlesere hopper over den.
// Fargene kommer fra theme.css, så den virker i lys og mørk modus.

export default function CartIllustration() {
return (
<div className="cart-illustration" aria-hidden="true">
<div className="cart-illustration__track">
<svg
className="cart-illustration__cart"
viewBox="0 0 300 240"
fill="none"
stroke="currentColor"
strokeWidth="2.2"
strokeLinecap="round"
strokeLinejoin="round"
>
{/* ---------- Varer i kurven ---------- */}
{/* Melkekartong */}
<path d="M112 88 l10 -46 h22 l8 46" fill="var(--note-tint)" />
<path d="M122 42 h22 M126 58 h14" />
{/* Brød */}
<path
d="M150 90 c-4 -26 10 -40 28 -40 c18 0 30 14 26 40"
fill="var(--bg-page)"
/>
<path d="M162 62 l6 8 M176 58 l6 8 M190 62 l6 8" />
{/* Noe grønt */}
<path
d="M206 90 c2 -16 8 -26 18 -32 M218 90 c0 -14 4 -22 12 -26"
stroke="var(--text-accent)"
/>

{/* ---------- Kurven ---------- */}
<path
d="M30 40 h28 l10 22 h200 l-26 86 h-150 z"
fill="var(--note-tint)"
/>
<path d="M68 62 l24 86" />
{/* Rutenett i kurven */}
<path
className="cart-illustration__grid"
d="M74 84 h186 M80 106 h174 M86 128 h162 M112 62 l6 86 M156 62 l0 86 M200 62 l-6 86 M240 62 l-14 86"
/>

{/* ---------- Ramme og hjul ---------- */}
<path d="M92 148 l-10 28 h158" />
<g className="cart-illustration__wheel">
<circle cx="102" cy="198" r="14" fill="var(--bg-page)" />
<path d="M102 186 v24 M90 198 h24" strokeWidth="1.4" />
</g>
<g className="cart-illustration__wheel">
<circle cx="222" cy="198" r="14" fill="var(--bg-page)" />
<path d="M222 186 v24 M210 198 h24" strokeWidth="1.4" />
</g>

{/* Tapebit, som på lappen */}
<path
d="M18 34 l26 -6 l4 14 l-26 6 z"
fill="var(--note-tape)"
stroke="none"
/>
</svg>
</div>
</div>
);
}
3 changes: 3 additions & 0 deletions frontend/src/pages/home/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import SearchField from "../../components/searchfield/SearchField";
import Button from "../../components/button/Button";
import NoteItem from "../../components/noteItem/NoteItem";
import CategoryCard from "../../components/categoryCard/CategoryCard";
import CartIllustration from "../../components/cartIllustration/CartIllustration";

// ==========================================
// MIDLERTIDIG HANDLELAPP
Expand Down Expand Up @@ -73,6 +74,8 @@ function HomePage({ onSearch, onCategorySelect }: HomePageProps) {
<p className="hero__stats">
12 400 VARER · 6 KJEDER · OPPDATERT DAGLIG
</p>

<CartIllustration />
</div>

{/* ======================================
Expand Down