Skip to content

Commit a45fdaa

Browse files
refactor: update ProjectCarousel to use formatDates utility and enhance layout with section label
1 parent c26ccaa commit a45fdaa

3 files changed

Lines changed: 21 additions & 58 deletions

File tree

src/app/globals.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,13 @@
2424
--swiper-navigation-size: 24px !important;
2525
--swiper-navigation-sides-offset: 16px !important;
2626
}
27+
}
28+
29+
.swiper-button-next,
30+
.swiper-button-prev {
31+
display: none !important;
32+
}
33+
34+
.swiper-button-disabled {
35+
opacity: 1 !important;
2736
}

src/components/BackgroundImage.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,24 @@ export default function BackgroundImage({ portrait, landscape, visible = true })
44
<source media="(max-width: 768px)" srcSet={portrait} />
55
<img src={landscape} className="size-full object-cover opacity-15" loading="lazy" alt="" />
66

7-
{/* ── Grain overlay ── */}
7+
{/* Grain overlay */}
88
<div
9-
className="pointer-events-none absolute inset-0 opacity-25"
9+
className="pointer-events-none absolute inset-0 opacity-10"
1010
style={{
1111
backgroundImage: `url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")`,
1212
backgroundRepeat: 'repeat',
1313
backgroundSize: '128px',
1414
}}
1515
/>
1616

17-
{/* ── Vignettes ── */}
17+
{/* Vignettes */}
1818
<div
1919
className="pointer-events-none absolute inset-0"
20-
style={{
21-
background:
22-
'linear-gradient(to top, rgba(0,0,0,0.80) 0%, rgba(0,0,0,0.2) 45%, transparent 70%)',
23-
}}
20+
style={{ background: 'linear-gradient(to top, rgba(0,0,0,0.80) 0%, rgba(0,0,0,0.2) 45%, transparent 70%)', }}
2421
/>
2522
<div
2623
className="pointer-events-none absolute inset-0"
27-
style={{
28-
background:
29-
'linear-gradient(to bottom, rgba(0,0,0,0.45) 0%, transparent 30%)',
30-
}}
24+
style={{ background: 'linear-gradient(to bottom, rgba(0,0,0,0.45) 0%, transparent 30%)', }}
3125
/>
3226
</picture>
3327
);

src/components/ProjectCarousel/ProjectCarousel.js

Lines changed: 7 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,13 @@
33
import { Swiper, SwiperSlide } from 'swiper/react';
44
import { Pagination, Navigation, Mousewheel, EffectFade } from 'swiper/modules';
55
import BackgroundImage from '../BackgroundImage';
6-
import ProjectStatus from '../ProjectGrid/ProjectStatus';
6+
import { formatDates } from '@/utilities/formatDates';
77

88
import 'swiper/css';
99
import 'swiper/css/pagination';
1010
import 'swiper/css/navigation';
1111
import 'swiper/css/effect-fade';
1212

13-
// ─── Helper ───────────────────────────────────────────────────────────────────
14-
function formatDateRange(start, end) {
15-
const opts = { day: 'numeric', month: 'short', year: 'numeric' };
16-
const s = new Date(start).toLocaleDateString('da-DK', opts);
17-
const e = new Date(end).toLocaleDateString('da-DK', opts);
18-
return `${s}${e}`;
19-
}
20-
21-
// ─── Component ────────────────────────────────────────────────────────────────
2213
export default function ProjectCarousel({ projects }) {
2314
const total = projects.length;
2415

@@ -64,6 +55,11 @@ export default function ProjectCarousel({ projects }) {
6455
</span>
6556
</div>
6657

58+
{/* Section label */}
59+
<p className="text-paper/50 text-[10px] uppercase tracking-[0.25em] mb-2">
60+
Kommende projekter
61+
</p>
62+
6763
{/* Big title */}
6864
<h2
6965
className="text-paper font-black uppercase leading-none"
@@ -72,17 +68,10 @@ export default function ProjectCarousel({ projects }) {
7268
{project.title}
7369
</h2>
7470

75-
{/* Status badge */}
76-
{project.startDate && (
77-
<div className="mt-3">
78-
<ProjectStatus startDate={project.startDate} endDate={project.endDate} />
79-
</div>
80-
)}
81-
8271
{/* Date & location */}
8372
<div className="mt-2">
8473
<p className="text-paper text-xs tracking-widest">
85-
{formatDateRange(project.startDate, project.endDate)}
74+
{formatDates(project.startDate, project.endDate)}
8675
</p>
8776
{project.location && (
8877
<p className="text-paper/50 text-[11px] mt-1 tracking-wider">
@@ -121,35 +110,6 @@ export default function ProjectCarousel({ projects }) {
121110
Næste
122111
</span>
123112
</button>
124-
125-
{/* ── Styles ── */}
126-
<style>{`
127-
.swiper-pagination-progressbar {
128-
display: none;
129-
}
130-
.swiper-pagination-custom .swiper-pagination-bullet {
131-
width: 6px;
132-
height: 6px;
133-
border-radius: 9999px;
134-
background: rgba(var(--color-paper-rgb, 255 255 255) / 0.5);
135-
transition: all 0.3s ease;
136-
display: inline-block;
137-
cursor: pointer;
138-
}
139-
.swiper-pagination-custom .swiper-pagination-bullet-active {
140-
width: 24px;
141-
height: 2px;
142-
border-radius: 2px;
143-
background: var(--color-paper, #fff);
144-
}
145-
.swiper-button-next,
146-
.swiper-button-prev {
147-
display: none !important;
148-
}
149-
.swiper-button-disabled {
150-
opacity: 1 !important;
151-
}
152-
`}</style>
153113
</section>
154114
);
155115
}

0 commit comments

Comments
 (0)