design upgrade
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
"use client"
|
||||
|
||||
import * as AccordionPrimitive from "@radix-ui/react-accordion"
|
||||
import { Plus, Minus } from "@medusajs/icons"
|
||||
import LocalizedClientLink from "@modules/common/components/localized-client-link"
|
||||
import landing from "@/config/landing.json"
|
||||
import faqConfig from "@/config/faq.json"
|
||||
|
||||
export default function LandingFaq() {
|
||||
const { kicker, title, sideLabel, cta, notFound } = landing.faq
|
||||
|
||||
return (
|
||||
<section className="py-20 sm:py-28">
|
||||
<div className="content-container text-center">
|
||||
<p className="eyebrow">{kicker}</p>
|
||||
<h2 className="display-heading mt-5 text-3xl sm:text-5xl text-foreground">
|
||||
{title}
|
||||
</h2>
|
||||
<p className="mt-4 text-sm text-muted-foreground">
|
||||
{notFound}{" "}
|
||||
<LocalizedClientLink
|
||||
href={cta.href}
|
||||
className="text-primary underline underline-offset-4 hover:opacity-80"
|
||||
>
|
||||
{cta.label}
|
||||
</LocalizedClientLink>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="mt-12 sm:mt-16 border-t border-border/70">
|
||||
<div className="content-container grid grid-cols-1 lg:grid-cols-12 gap-8 pt-10 sm:pt-12">
|
||||
<p className="lg:col-span-5 eyebrow text-muted-foreground">
|
||||
{sideLabel}
|
||||
</p>
|
||||
|
||||
<AccordionPrimitive.Root
|
||||
type="single"
|
||||
collapsible
|
||||
defaultValue="item-0"
|
||||
className="lg:col-span-7 divide-y divide-border/70"
|
||||
>
|
||||
{faqConfig.items.map((item, idx) => (
|
||||
<AccordionPrimitive.Item key={idx} value={`item-${idx}`}>
|
||||
<AccordionPrimitive.Header className="flex">
|
||||
<AccordionPrimitive.Trigger className="group flex flex-1 items-center justify-between gap-6 py-5 text-left text-sm sm:text-[15px] text-foreground hover:text-primary transition-colors">
|
||||
<span>{item.question}</span>
|
||||
<Plus className="h-4 w-4 shrink-0 text-muted-foreground group-data-[state=open]:hidden" />
|
||||
<Minus className="h-4 w-4 shrink-0 text-muted-foreground hidden group-data-[state=open]:block" />
|
||||
</AccordionPrimitive.Trigger>
|
||||
</AccordionPrimitive.Header>
|
||||
<AccordionPrimitive.Content className="overflow-hidden text-sm text-muted-foreground leading-relaxed data-[state=closed]:animate-accordion-close data-[state=open]:animate-accordion-open">
|
||||
<div className="pb-6 pr-10">{item.answer}</div>
|
||||
</AccordionPrimitive.Content>
|
||||
</AccordionPrimitive.Item>
|
||||
))}
|
||||
</AccordionPrimitive.Root>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
188
apps/suman-hrvatska/src/modules/home/components/landing/hero.tsx
Normal file
188
apps/suman-hrvatska/src/modules/home/components/landing/hero.tsx
Normal file
@@ -0,0 +1,188 @@
|
||||
"use client"
|
||||
|
||||
import Image from "next/image"
|
||||
import { useCallback, useRef, useState } from "react"
|
||||
import LocalizedClientLink from "@modules/common/components/localized-client-link"
|
||||
import landing from "@/config/landing.json"
|
||||
|
||||
type Slide = (typeof landing.hero.slides)[number]
|
||||
|
||||
/**
|
||||
* Home hero carousel (suncobrani, pergole, tende). Each slide brings its own
|
||||
* headline, CTA and three product facts on the right.
|
||||
*
|
||||
* Autoplay is driven by the CSS progress bar (`.hero-progress` in
|
||||
* globals.css): when the active bar's animation ends, the next slide shows.
|
||||
* Keyboard focus pauses the bar; reduced motion disables the animation and so
|
||||
* autoplay. Slides under the transparent header (see HeaderShell).
|
||||
*/
|
||||
export default function LandingHero() {
|
||||
const { slides, intervalMs } = landing.hero
|
||||
const [active, setActive] = useState(0)
|
||||
const [paused, setPaused] = useState(false)
|
||||
const touchX = useRef<number | null>(null)
|
||||
|
||||
const go = useCallback(
|
||||
(index: number) => setActive((index + slides.length) % slides.length),
|
||||
[slides.length]
|
||||
)
|
||||
|
||||
return (
|
||||
<section
|
||||
data-hero-overlay
|
||||
aria-roledescription="carousel"
|
||||
aria-label="Suman proizvodi"
|
||||
className="relative -mt-[57px] sm:-mt-[65px] h-[100svh] min-h-[600px] max-h-[1020px] w-full overflow-hidden bg-muted"
|
||||
// Pause only for keyboard users (visible focus); hover and mouse clicks
|
||||
// never pause, so the progress bar always runs smoothly
|
||||
onFocus={(e) => setPaused((e.target as HTMLElement).matches(":focus-visible"))}
|
||||
onBlur={() => setPaused(false)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "ArrowRight") go(active + 1)
|
||||
if (e.key === "ArrowLeft") go(active - 1)
|
||||
}}
|
||||
onTouchStart={(e) => (touchX.current = e.touches[0].clientX)}
|
||||
onTouchEnd={(e) => {
|
||||
if (touchX.current === null) return
|
||||
const dx = e.changedTouches[0].clientX - touchX.current
|
||||
if (Math.abs(dx) > 50) go(active + (dx < 0 ? 1 : -1))
|
||||
touchX.current = null
|
||||
}}
|
||||
>
|
||||
{/* Images, cross-faded */}
|
||||
{slides.map((slide, i) => (
|
||||
<div
|
||||
key={slide.id}
|
||||
aria-hidden={i !== active}
|
||||
className={`absolute inset-0 transition-opacity duration-1000 ease-out ${
|
||||
i === active ? "opacity-100" : "opacity-0"
|
||||
}`}
|
||||
>
|
||||
<Image
|
||||
src={slide.image}
|
||||
alt={slide.title}
|
||||
fill
|
||||
priority={i === 0}
|
||||
// Only three slides: load all up front so a switch never shows a blank frame
|
||||
loading={i === 0 ? undefined : "eager"}
|
||||
sizes="100vw"
|
||||
className={`object-cover will-change-transform transition-transform duration-[8000ms] ease-out ${
|
||||
i === active ? "scale-100" : "scale-105"
|
||||
}`}
|
||||
/>
|
||||
{/* Per-slide darkening (landing.json hero.slides[].overlay, 0–1) */}
|
||||
{slide.overlay > 0 && (
|
||||
<div className="absolute inset-0 bg-black" style={{ opacity: slide.overlay }} />
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
<div className="absolute inset-0 bg-gradient-to-t from-black/65 via-black/15 to-transparent" />
|
||||
<div className="absolute inset-x-0 top-0 h-40 bg-gradient-to-b from-black/40 to-transparent" />
|
||||
|
||||
<div className="absolute inset-x-0 bottom-0 content-container pb-8 sm:pb-12">
|
||||
<div className="flex flex-col gap-10 lg:flex-row lg:items-end lg:justify-between">
|
||||
{/* Text: all slides stacked in one grid cell, only the active one visible */}
|
||||
<div className="grid max-w-3xl text-white">
|
||||
{slides.map((slide, i) => (
|
||||
<SlideText key={slide.id} slide={slide} index={i} total={slides.length} active={i === active} />
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Product facts for the visible slide */}
|
||||
<div className="grid">
|
||||
{slides.map((slide, i) => (
|
||||
<dl
|
||||
key={slide.id}
|
||||
aria-hidden={i !== active}
|
||||
className={`col-start-1 row-start-1 grid grid-cols-3 divide-x divide-white/25 text-white transition-[opacity,transform] duration-700 ${
|
||||
i === active ? "translate-y-0 opacity-100" : "pointer-events-none translate-y-2 opacity-0"
|
||||
}`}
|
||||
>
|
||||
{slide.stats.map((stat) => (
|
||||
<div key={stat.label} className="px-4 sm:px-6 first:pl-0 last:pr-0 text-center lg:text-left">
|
||||
<dt className="font-display text-lg sm:text-2xl whitespace-nowrap">{stat.value}</dt>
|
||||
<dd className="mt-1 text-[11px] sm:text-xs text-white/70">{stat.label}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Slide selector with progress (drives autoplay) */}
|
||||
<div className="mt-8 grid grid-cols-3 gap-3 sm:gap-6 border-t border-white/20 pt-4 sm:max-w-xl" role="tablist" aria-label="Odaberite proizvod">
|
||||
{slides.map((slide, i) => (
|
||||
<button
|
||||
key={slide.id}
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={i === active}
|
||||
aria-label={`Prikaži: ${slide.kicker}`}
|
||||
onClick={() => go(i)}
|
||||
className="group text-left"
|
||||
>
|
||||
<span className="relative block h-0.5 w-full overflow-hidden bg-white/25">
|
||||
{i === active && (
|
||||
<span
|
||||
key={`${slide.id}-${active}`}
|
||||
className="hero-progress absolute inset-0 origin-left bg-white will-change-transform"
|
||||
style={{
|
||||
animationDuration: `${intervalMs}ms`,
|
||||
animationPlayState: paused ? "paused" : "running",
|
||||
}}
|
||||
onAnimationEnd={() => go(active + 1)}
|
||||
/>
|
||||
)}
|
||||
{i < active && <span className="absolute inset-0 bg-white/60" />}
|
||||
</span>
|
||||
<span
|
||||
className={`mt-3 flex items-baseline gap-2 text-xs sm:text-sm transition-colors ${
|
||||
i === active ? "text-white" : "text-white/60 group-hover:text-white"
|
||||
}`}
|
||||
>
|
||||
<span className="tabular-nums opacity-70">0{i + 1}</span>
|
||||
{slide.kicker}
|
||||
</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
function SlideText({
|
||||
slide,
|
||||
index,
|
||||
total,
|
||||
active,
|
||||
}: {
|
||||
slide: Slide
|
||||
index: number
|
||||
total: number
|
||||
active: boolean
|
||||
}) {
|
||||
const Heading = index === 0 ? "h1" : "h2"
|
||||
return (
|
||||
<div
|
||||
role="group"
|
||||
aria-roledescription="slide"
|
||||
aria-label={`${index + 1} od ${total}: ${slide.kicker}`}
|
||||
aria-hidden={!active}
|
||||
className={`col-start-1 row-start-1 transition-[opacity,transform] duration-700 ${
|
||||
active ? "translate-y-0 opacity-100" : "pointer-events-none translate-y-3 opacity-0"
|
||||
}`}
|
||||
>
|
||||
<p className="eyebrow text-white/80">{slide.kicker}</p>
|
||||
<Heading className="display-heading mt-4 text-[2.6rem] sm:text-6xl lg:text-7xl">{slide.title}</Heading>
|
||||
<p className="mt-5 max-w-lg text-sm sm:text-base text-white/80 leading-relaxed">{slide.subtitle}</p>
|
||||
<LocalizedClientLink
|
||||
href={slide.cta.href}
|
||||
tabIndex={active ? 0 : -1}
|
||||
className="mt-7 inline-flex h-11 items-center rounded-md bg-white px-6 text-sm text-foreground transition-colors hover:bg-white/90"
|
||||
>
|
||||
{slide.cta.label}
|
||||
</LocalizedClientLink>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import Image from "next/image"
|
||||
import landing from "@/config/landing.json"
|
||||
|
||||
export default function LandingImpact() {
|
||||
const { kicker, title, text, image } = landing.impact
|
||||
|
||||
return (
|
||||
<section className="bg-gradient-to-b from-background via-muted to-background py-20 sm:py-28">
|
||||
<div className="content-container">
|
||||
<div className="text-center max-w-2xl mx-auto">
|
||||
<p className="eyebrow">{kicker}</p>
|
||||
<h2 className="display-heading mt-5 text-3xl sm:text-5xl text-foreground">
|
||||
{title}
|
||||
</h2>
|
||||
<p className="mt-5 text-sm sm:text-base text-muted-foreground leading-relaxed">
|
||||
{text}
|
||||
</p>
|
||||
</div>
|
||||
<div className="relative mt-12 sm:mt-16 aspect-[4/3] sm:aspect-[16/9] overflow-hidden rounded-2xl bg-muted">
|
||||
<Image
|
||||
src={image}
|
||||
alt={title}
|
||||
fill
|
||||
sizes="100vw"
|
||||
className="object-cover"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
import Image from "next/image"
|
||||
import LocalizedClientLink from "@modules/common/components/localized-client-link"
|
||||
import landing from "@/config/landing.json"
|
||||
|
||||
export default function LandingMethod() {
|
||||
const { kicker, title, text, cta, steps } = landing.method
|
||||
|
||||
return (
|
||||
<section className="content-container py-20 sm:py-28">
|
||||
<div className="text-center max-w-2xl mx-auto">
|
||||
<p className="eyebrow">{kicker}</p>
|
||||
<h2 className="display-heading mt-5 text-3xl sm:text-5xl text-foreground">
|
||||
{title}
|
||||
</h2>
|
||||
<p className="mt-5 text-sm sm:text-base text-muted-foreground leading-relaxed">
|
||||
{text}
|
||||
</p>
|
||||
<LocalizedClientLink
|
||||
href={cta.href}
|
||||
className="mt-6 inline-flex items-center h-9 px-4 rounded-md bg-muted text-sm text-foreground hover:bg-border transition-colors"
|
||||
>
|
||||
{cta.label}
|
||||
</LocalizedClientLink>
|
||||
</div>
|
||||
|
||||
<ol className="mt-12 sm:mt-16 grid grid-cols-1 md:grid-cols-3 gap-6 md:gap-4 lg:gap-6">
|
||||
{steps.map((step, i) => (
|
||||
<li key={step.title}>
|
||||
<div className="relative aspect-[4/5] overflow-hidden rounded-xl bg-muted">
|
||||
<Image
|
||||
src={step.image}
|
||||
alt={step.title}
|
||||
fill
|
||||
sizes="(min-width: 768px) 33vw, 100vw"
|
||||
className="object-cover"
|
||||
/>
|
||||
</div>
|
||||
<h3 className="mt-4 text-sm font-medium text-foreground">
|
||||
{i + 1}. {step.title}
|
||||
</h3>
|
||||
<p className="mt-2 text-sm text-muted-foreground leading-relaxed max-w-sm">
|
||||
{step.text}
|
||||
</p>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
import landing from "@/config/landing.json"
|
||||
|
||||
// Overlapping sine waves, drawn once as static SVG paths
|
||||
function wavePath(amplitude: number, phase: number, yOffset: number) {
|
||||
const width = 1440
|
||||
const points: string[] = []
|
||||
for (let x = 0; x <= width; x += 24) {
|
||||
const y =
|
||||
yOffset + amplitude * Math.sin((x / width) * Math.PI * 2 + phase)
|
||||
points.push(`${x === 0 ? "M" : "L"}${x},${y.toFixed(1)}`)
|
||||
}
|
||||
return points.join(" ")
|
||||
}
|
||||
|
||||
const waves = [
|
||||
{ amplitude: 70, phase: 0.4, y: 130, opacity: 0.18 },
|
||||
{ amplitude: 85, phase: 1.3, y: 140, opacity: 0.3 },
|
||||
{ amplitude: 60, phase: 2.2, y: 125, opacity: 0.45 },
|
||||
{ amplitude: 90, phase: 3.0, y: 145, opacity: 0.7 },
|
||||
]
|
||||
|
||||
export default function LandingMission() {
|
||||
const { kicker, title, text } = landing.mission
|
||||
|
||||
return (
|
||||
<section className="pt-24 sm:pt-32 overflow-hidden">
|
||||
<div className="content-container text-center max-w-3xl">
|
||||
<p className="eyebrow">{kicker}</p>
|
||||
<h2 className="display-heading mt-5 text-3xl sm:text-5xl text-foreground">
|
||||
{title}
|
||||
</h2>
|
||||
<p className="mt-5 text-sm sm:text-base text-muted-foreground leading-relaxed max-w-xl mx-auto">
|
||||
{text}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<svg
|
||||
viewBox="0 0 1440 280"
|
||||
preserveAspectRatio="none"
|
||||
className="mt-8 w-full h-40 sm:h-56 text-primary"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<defs>
|
||||
<linearGradient id="wave-fade" x1="0" x2="1" y1="0" y2="0">
|
||||
<stop offset="0" stopColor="white" stopOpacity="0" />
|
||||
<stop offset="0.2" stopColor="white" stopOpacity="1" />
|
||||
<stop offset="0.8" stopColor="white" stopOpacity="1" />
|
||||
<stop offset="1" stopColor="white" stopOpacity="0" />
|
||||
</linearGradient>
|
||||
<mask id="wave-mask">
|
||||
<rect width="1440" height="280" fill="url(#wave-fade)" />
|
||||
</mask>
|
||||
</defs>
|
||||
<g mask="url(#wave-mask)" fill="none" stroke="currentColor" strokeWidth="1.25">
|
||||
{waves.map((w, i) => (
|
||||
<path
|
||||
key={i}
|
||||
d={wavePath(w.amplitude, w.phase, w.y)}
|
||||
strokeOpacity={w.opacity}
|
||||
/>
|
||||
))}
|
||||
</g>
|
||||
</svg>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
import Image from "next/image"
|
||||
import LocalizedClientLink from "@modules/common/components/localized-client-link"
|
||||
import { ArrowRight } from "@medusajs/icons"
|
||||
import landing from "@/config/landing.json"
|
||||
|
||||
export default function LandingProducts() {
|
||||
const { kicker, title, featured, secondary } = landing.products
|
||||
|
||||
return (
|
||||
<section className="content-container pb-20 sm:pb-28">
|
||||
<div className="text-center max-w-2xl mx-auto mb-12 sm:mb-16">
|
||||
<p className="eyebrow">{kicker}</p>
|
||||
<h2 className="display-heading mt-5 text-3xl sm:text-5xl text-foreground">
|
||||
{title}
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
{/* Featured: configurable umbrellas, sold directly */}
|
||||
<LocalizedClientLink
|
||||
href={featured.href}
|
||||
className="group grid grid-cols-1 lg:grid-cols-2 overflow-hidden rounded-2xl bg-muted border border-border/60"
|
||||
>
|
||||
<div className="flex flex-col justify-between gap-12 p-7 sm:p-10 lg:p-14 order-2 lg:order-1">
|
||||
<div>
|
||||
<p className="eyebrow text-muted-foreground">{featured.kicker}</p>
|
||||
<h3 className="display-heading mt-4 text-3xl sm:text-[2.75rem] text-foreground max-w-md">
|
||||
{featured.title}
|
||||
</h3>
|
||||
<p className="mt-4 text-sm sm:text-base text-muted-foreground leading-relaxed max-w-md">
|
||||
{featured.text}
|
||||
</p>
|
||||
<span className="mt-7 inline-flex items-center gap-2 h-10 px-5 rounded-md bg-primary text-primary-foreground text-sm transition-colors group-hover:bg-primary/90">
|
||||
{featured.cta}
|
||||
<ArrowRight className="h-4 w-4 transition-transform group-hover:translate-x-0.5" />
|
||||
</span>
|
||||
</div>
|
||||
<dl className="flex divide-x divide-border">
|
||||
{featured.stats.map((s) => (
|
||||
<div key={s.label} className="px-5 first:pl-0">
|
||||
<dt className="text-sm font-medium text-foreground">{s.value}</dt>
|
||||
<dd className="mt-1 text-xs text-muted-foreground">{s.label}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
</div>
|
||||
<div className="relative min-h-[320px] lg:min-h-[520px] order-1 lg:order-2">
|
||||
<Image
|
||||
src={featured.image}
|
||||
alt={featured.kicker}
|
||||
fill
|
||||
sizes="(min-width: 1024px) 50vw, 100vw"
|
||||
className="object-cover transition-transform duration-700 group-hover:scale-[1.02]"
|
||||
/>
|
||||
</div>
|
||||
</LocalizedClientLink>
|
||||
|
||||
{/* Secondary: made-to-measure, quote only */}
|
||||
<div className="mt-4 lg:mt-6 grid grid-cols-1 md:grid-cols-2 gap-4 lg:gap-6">
|
||||
{secondary.map((item) => (
|
||||
<LocalizedClientLink
|
||||
key={item.href}
|
||||
href={item.href}
|
||||
className="group overflow-hidden rounded-2xl border border-border/60 bg-background"
|
||||
>
|
||||
<div className="relative aspect-[16/10] bg-muted">
|
||||
<Image
|
||||
src={item.image}
|
||||
alt={item.kicker}
|
||||
fill
|
||||
sizes="(min-width: 768px) 50vw, 100vw"
|
||||
className="object-cover transition-transform duration-700 group-hover:scale-[1.02]"
|
||||
/>
|
||||
</div>
|
||||
<div className="p-7 sm:p-9">
|
||||
<p className="eyebrow text-muted-foreground">{item.kicker}</p>
|
||||
<h3 className="display-heading mt-3 text-2xl sm:text-3xl text-foreground">
|
||||
{item.title}
|
||||
</h3>
|
||||
<p className="mt-3 text-sm text-muted-foreground leading-relaxed max-w-md">
|
||||
{item.text}
|
||||
</p>
|
||||
<span className="mt-5 inline-flex items-center gap-2 text-sm text-primary">
|
||||
{item.cta}
|
||||
<ArrowRight className="h-4 w-4 transition-transform group-hover:translate-x-0.5" />
|
||||
</span>
|
||||
</div>
|
||||
</LocalizedClientLink>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import landing from "@/config/landing.json"
|
||||
|
||||
export default function LandingStats() {
|
||||
return (
|
||||
<section className="content-container pb-20 sm:pb-28">
|
||||
<div className="grid grid-cols-1 md:grid-cols-3 rounded-2xl border border-border/80 divide-y md:divide-y-0 md:divide-x divide-border/80">
|
||||
{landing.stats.map((stat) => (
|
||||
<div
|
||||
key={stat.value}
|
||||
className="flex flex-col justify-between gap-16 md:gap-28 p-7 sm:p-9"
|
||||
>
|
||||
<p className="display-heading text-6xl sm:text-7xl text-primary">
|
||||
{stat.value}
|
||||
{stat.suffix && (
|
||||
<sup className="ml-1 text-2xl sm:text-3xl align-super">
|
||||
{stat.suffix}
|
||||
</sup>
|
||||
)}
|
||||
</p>
|
||||
<p className="text-sm text-muted-foreground leading-relaxed max-w-xs">
|
||||
{stat.text}
|
||||
</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user