Skip to content

Commit 3c4964b

Browse files
Merge pull request #549 from datasektionen/545-update-homepage-2026
545 update homepage 2026
2 parents 07ce695 + 261befb commit 3c4964b

4 files changed

Lines changed: 56 additions & 53 deletions

File tree

src/components/Countdown.tsx

Lines changed: 42 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,16 @@
11
import {useLocale} from "@/locales";
22
import {useEffect, useState} from "react";
33

4-
function TimeUnit({time, timeString, index = 0}: {time: number; timeString: string, index?: number}){
5-
// "w-1/2 max-auto bg-cerise py-2.5 rounded-full"
6-
return(
7-
<div className={`w-16 h-32 sm:w-24 sm:h-48
8-
flex flex-col bg-cover bg-16
9-
${
10-
index == 2 && "bg-[url('/img/ballonger/ballong_2.svg')]"
11-
||
12-
index == 3 && "bg-[url('/img/ballonger/ballong_3.svg')]"
13-
||
14-
index == 4 && "bg-[url('/img/ballonger/ballong_4.svg')]"
15-
||
16-
"bg-[url('/img/ballonger/ballong_1.svg')]"
17-
}`}>
18-
19-
<div className="w-16 h-20 sm:w-24 sm:h-[7.75rem]
20-
flex flex-col items-center justify-center">
21-
<div className="text-white text-xl sm:text-4xl leading-[1.25rem] sm:leading-[1.75rem] text-center">
22-
{time}
23-
</div>
24-
<div className="text-white text-xs sm:text-lg text-center">
25-
{timeString}
26-
</div>
27-
</div>
28-
29-
</div>
30-
31-
4+
function TimeUnit({time, timeString,}: {time: number; timeString: string;}) {
5+
return (
6+
<div className="flex flex-col items-center text-center">
7+
<div className="text-white text-3xl sm:text-4xl leading-none">
8+
{time}
9+
</div>
10+
<div className="text-white text-sm sm:text-lg mt-1">
11+
{timeString}
12+
</div>
13+
</div>
3214
);
3315
}
3416

@@ -40,38 +22,46 @@ export function Countdown() {
4022
const [minutes, setMinutes] = useState(0);
4123
const [seconds, setSeconds] = useState(0);
4224

43-
useEffect(()=>{
44-
const target = new Date("10/8/2026 10:00:00+02:00") // vilket datum är d-dagen?
45-
const interval = setInterval(() =>{
25+
useEffect(() => {
26+
const target = new Date("10/8/2026 10:00:00+02:00");
27+
const interval = setInterval(() => {
4628
const now = new Date();
4729
const difference = target.getTime() - now.getTime();
48-
49-
30+
5031
const d_diff = difference / (1000 * 60 * 60 * 24);
51-
const d = difference < 0 ? Math.ceil(d_diff) : Math.floor(d_diff);
52-
setDays(d)
32+
setDays(difference < 0 ? Math.ceil(d_diff) : Math.floor(d_diff));
33+
34+
const h_diff =
35+
(difference % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60);
36+
setHours(difference < 0 ? Math.ceil(h_diff) : Math.floor(h_diff));
5337

54-
const h_diff = (difference % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)
55-
const h = difference < 0 ? Math.ceil(h_diff) : Math.floor(h_diff);
56-
setHours(h)
38+
const m_diff = (difference % (1000 * 60 * 60)) / (1000 * 60);
39+
setMinutes(difference < 0 ? Math.ceil(m_diff) : Math.floor(m_diff));
5740

58-
const m_diff = (difference % (1000 * 60 * 60))/(1000*60)
59-
const m = difference < 0 ? Math.ceil(m_diff) : Math.floor(m_diff)
60-
setMinutes(m)
41+
const s_diff = (difference % (1000 * 60)) / 1000;
42+
setSeconds(difference < 0 ? Math.ceil(s_diff) : Math.floor(s_diff));
43+
}, 1000);
6144

62-
const s_diff = (difference % (1000 * 60))/1000
63-
const s = difference < 0 ? Math.ceil(s_diff) : Math.floor(s_diff)
64-
setSeconds(s)
65-
},1000)
66-
return () => clearInterval(interval)
67-
},[]);
45+
return () => clearInterval(interval);
46+
}, []);
6847

6948
return (
70-
<div className="hover:cursor-default gap-5 columns-4 flex items-center justify-center">
71-
<TimeUnit time={days} timeString={t.home.countDown.days} index={1}/>
72-
<TimeUnit time={hours} timeString={t.home.countDown.hours} index={2}/>
73-
<TimeUnit time={minutes} timeString={t.home.countDown.minutes} index={3}/>
74-
<TimeUnit time={seconds} timeString={t.home.countDown.seconds} index={4}/>
49+
<div className="hover:cursor-default flex items-center justify-center">
50+
51+
<TimeUnit time={days} timeString={t.home.countDown.days} />
52+
53+
<div className="mx-6 h-14 w-[3px] bg-cerise" />
54+
55+
<TimeUnit time={hours} timeString={t.home.countDown.hours} />
56+
57+
<div className="mx-6 h-14 w-[3px] bg-cerise" />
58+
59+
<TimeUnit time={minutes} timeString={t.home.countDown.minutes} />
60+
61+
<div className="mx-6 h-14 w-[3px] bg-cerise" />
62+
63+
<TimeUnit time={seconds} timeString={t.home.countDown.seconds} />
64+
7565
</div>
7666
);
7767
}

src/locales/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export default {
2828
minutes: "minutes",
2929
seconds: "seconds",
3030
},
31+
exhibitButton: "Exhibit at D-Dagen",
3132
stats: [
3233
{
3334
value: "90+",

src/locales/sv.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export default {
2828
minutes: "minuter",
2929
seconds: "sekunder",
3030
},
31+
exhibitButton: "Ställ ut på D-Dagen",
3132
stats: [
3233
{
3334
value: "90+",

src/pages/index.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,25 @@ export default function Home() {
9090
></img>
9191
</div>
9292

93+
{/* Countdown wrapper */}
9394
<div className={`
94-
mx-auto pt-[40px] mt-2 md:mt-8
95+
mx-auto pt-[0px] mt-2 md:mt-8
9596
transition-all ease-in-out
9697
${ hasLoadedBefore ? 'duration-0': 'delay-[300ms] duration-[800ms]'}
9798
${ showPage ? "opacity-100" : "opacity-0" }
9899
`}>
99100
<Countdown />
100101
</div>
102+
103+
{/* Button wrapper (separat div) */}
104+
<div className="flex justify-center mt-8">
105+
<Link
106+
className="bg-cerise py-2.5 px-6 rounded-full text-white text-center hover:scale-105 transition-transform"
107+
href="/företagsanmälan"
108+
>
109+
{t.home.exhibitButton}
110+
</Link>
111+
</div>
101112

102113
<div className="hover:cursor-default pt-[40px] pb-[50px]">
103114
<h2

0 commit comments

Comments
 (0)