Skip to content

Commit a0e2b8a

Browse files
committed
style: prettier formatting
1 parent 846358b commit a0e2b8a

5 files changed

Lines changed: 90 additions & 76 deletions

File tree

app/components/CountdownTimer.tsx

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,78 @@
1-
import { Fragment, useEffect, useState } from "react";
1+
import { Fragment, useEffect, useState } from 'react'
22

33
interface CountdownProps {
4-
targetDate: string; // YYYY-MM-DD format
4+
targetDate: string // YYYY-MM-DD format
55
}
66

77
interface TimeLeft {
8-
days: number;
9-
hours: number;
10-
minutes: number;
11-
seconds: number;
8+
days: number
9+
hours: number
10+
minutes: number
11+
seconds: number
1212
}
1313

1414
function calculateTimeLeft(targetDate: string): TimeLeft {
15-
const target = new Date(`${targetDate}T00:00:00-08:00`);
16-
const now = new Date();
17-
const difference = +target - +now;
15+
const target = new Date(`${targetDate}T00:00:00-08:00`)
16+
const now = new Date()
17+
const difference = +target - +now
1818

1919
if (difference <= 0) {
2020
return {
2121
days: 0,
2222
hours: 0,
2323
minutes: 0,
2424
seconds: 0,
25-
};
25+
}
2626
}
2727

2828
return {
2929
days: Math.floor(difference / (1000 * 60 * 60 * 24)),
3030
hours: Math.floor((difference / (1000 * 60 * 60)) % 24),
3131
minutes: Math.floor((difference / 1000 / 60) % 60),
3232
seconds: Math.floor((difference / 1000) % 60),
33-
};
33+
}
3434
}
3535

36-
const formatNumber = (number: number) => number.toString().padStart(2, "0");
36+
const formatNumber = (number: number) => number.toString().padStart(2, '0')
3737

3838
const Countdown: React.FC<CountdownProps> = ({ targetDate }) => {
3939
const [timeLeft, setTimeLeft] = useState<TimeLeft>(
40-
calculateTimeLeft(targetDate),
41-
);
40+
calculateTimeLeft(targetDate)
41+
)
4242

4343
useEffect(() => {
4444
const timer = setInterval(() => {
45-
const newTimeLeft = calculateTimeLeft(targetDate);
46-
setTimeLeft(newTimeLeft);
45+
const newTimeLeft = calculateTimeLeft(targetDate)
46+
setTimeLeft(newTimeLeft)
4747
if (
4848
newTimeLeft.days === 0 &&
4949
newTimeLeft.hours === 0 &&
5050
newTimeLeft.minutes === 0 &&
5151
newTimeLeft.seconds === 0
5252
) {
53-
clearInterval(timer);
53+
clearInterval(timer)
5454
}
55-
}, 1000);
55+
}, 1000)
5656

57-
return () => clearInterval(timer);
58-
}, [targetDate]);
57+
return () => clearInterval(timer)
58+
}, [targetDate])
5959

6060
if (
6161
timeLeft.days === 0 &&
6262
timeLeft.hours === 0 &&
6363
timeLeft.minutes === 0 &&
6464
timeLeft.seconds === 0
6565
) {
66-
return null;
66+
return null
6767
}
6868

6969
return (
7070
<div className="flex gap-2 justify-center">
71-
{["days", "hours", "minutes", "seconds"].map((unit, index) => (
71+
{['days', 'hours', 'minutes', 'seconds'].map((unit, index) => (
7272
<Fragment key={unit}>
73-
{index > 0 && <span className="h-[2rem] grid place-content-center">:</span>}
73+
{index > 0 && (
74+
<span className="h-[2rem] grid place-content-center">:</span>
75+
)}
7476

7577
<div className={`${unit} grid grid-cols-2 gap-x-1 gap-y-1.5`}>
7678
<span className="h-[2.3rem] aspect-[6/7] grid place-content-center rounded-sm bg-[#f9f4da] bg-opacity-10 font-semibold">
@@ -84,7 +86,7 @@ const Countdown: React.FC<CountdownProps> = ({ targetDate }) => {
8486
</Fragment>
8587
))}
8688
</div>
87-
);
88-
};
89+
)
90+
}
8991

90-
export default Countdown;
92+
export default Countdown
Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,69 @@
1-
import { Fragment, useEffect, useState } from "react";
1+
import { Fragment, useEffect, useState } from 'react'
22

33
interface CountdownProps {
4-
targetDate: string; // YYYY-MM-DD format
4+
targetDate: string // YYYY-MM-DD format
55
}
66

77
interface TimeLeft {
8-
days: number;
9-
hours: number;
10-
minutes: number;
8+
days: number
9+
hours: number
10+
minutes: number
1111
}
1212

1313
function calculateTimeLeft(targetDate: string): TimeLeft {
14-
const target = new Date(`${targetDate}T00:00:00-08:00`);
15-
const now = new Date();
16-
const difference = +target - +now;
14+
const target = new Date(`${targetDate}T00:00:00-08:00`)
15+
const now = new Date()
16+
const difference = +target - +now
1717

1818
if (difference <= 0) {
1919
return {
2020
days: 0,
2121
hours: 0,
2222
minutes: 0,
23-
};
23+
}
2424
}
2525

2626
return {
2727
days: Math.floor(difference / (1000 * 60 * 60 * 24)),
2828
hours: Math.floor((difference / (1000 * 60 * 60)) % 24),
2929
minutes: Math.floor((difference / 1000 / 60) % 60),
30-
};
30+
}
3131
}
3232

33-
const formatNumber = (number: number) => number.toString().padStart(2, "0");
33+
const formatNumber = (number: number) => number.toString().padStart(2, '0')
3434

3535
const Countdown: React.FC<CountdownProps> = ({ targetDate }) => {
3636
const [timeLeft, setTimeLeft] = useState<TimeLeft>(
37-
calculateTimeLeft(targetDate),
38-
);
37+
calculateTimeLeft(targetDate)
38+
)
3939

4040
useEffect(() => {
4141
const timer = setInterval(() => {
42-
const newTimeLeft = calculateTimeLeft(targetDate);
43-
setTimeLeft(newTimeLeft);
42+
const newTimeLeft = calculateTimeLeft(targetDate)
43+
setTimeLeft(newTimeLeft)
4444
if (
4545
newTimeLeft.days === 0 &&
4646
newTimeLeft.hours === 0 &&
4747
newTimeLeft.minutes === 0
4848
) {
49-
clearInterval(timer);
49+
clearInterval(timer)
5050
}
51-
}, 1000);
51+
}, 1000)
5252

53-
return () => clearInterval(timer);
54-
}, [targetDate]);
53+
return () => clearInterval(timer)
54+
}, [targetDate])
5555

56-
if (
57-
timeLeft.days === 0 &&
58-
timeLeft.hours === 0 &&
59-
timeLeft.minutes === 0
60-
) {
61-
return null;
56+
if (timeLeft.days === 0 && timeLeft.hours === 0 && timeLeft.minutes === 0) {
57+
return null
6258
}
6359

6460
return (
6561
<div className="countdown flex gap-1.5 justify-center">
66-
{["days", "hours", "minutes"].map((unit, index) => (
62+
{['days', 'hours', 'minutes'].map((unit, index) => (
6763
<Fragment key={unit}>
68-
{index > 0 && <span className="h-[1.4em] grid place-content-center">:</span>}
64+
{index > 0 && (
65+
<span className="h-[1.4em] grid place-content-center">:</span>
66+
)}
6967

7068
<div className={`${unit} grid grid-cols-2 gap-x-1 gap-y-1.5`}>
7169
<span className="h-[1.8em] w-[1.7em] grid place-content-center rounded-sm bg-gray-200 bg-opacity-75 dark:bg-gray-600 dark:bg-opacity-50 text-sm font-semibold">
@@ -79,7 +77,7 @@ const Countdown: React.FC<CountdownProps> = ({ targetDate }) => {
7977
</Fragment>
8078
))}
8179
</div>
82-
);
83-
};
80+
)
81+
}
8482

85-
export default Countdown;
83+
export default Countdown

app/components/DocsCalloutQueryGG.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ export function DocsCalloutQueryGG() {
2929
<h2 className="mt-1 mb-1 px-2 text-md font-semibold">
3030
Launch week sale
3131
</h2>
32-
<p className="normal-case mb-4 text-sm text-balance">Up to 25% off through May 10th</p>
32+
<p className="normal-case mb-4 text-sm text-balance">
33+
Up to 25% off through May 10th
34+
</p>
3335
<CountdownTimerSmall targetDate="2025-05-10" />
3436
</div>
3537

app/components/QueryGGBannerSale.tsx

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,43 @@
1-
import headerCourse from '~/images/query-header-course.svg';
2-
import cornerTopLeft from '~/images/query-corner-top-left.svg';
3-
import cornerTopRight from '~/images/query-corner-top-right.svg';
4-
import cornerFishBottomRight from '~/images/query-corner-fish-bottom-right.svg';
1+
import headerCourse from '~/images/query-header-course.svg'
2+
import cornerTopLeft from '~/images/query-corner-top-left.svg'
3+
import cornerTopRight from '~/images/query-corner-top-right.svg'
4+
import cornerFishBottomRight from '~/images/query-corner-fish-bottom-right.svg'
55
import CountdownTimer from '~/components/CountdownTimer'
66

77
export function QueryGGBannerSale(props: React.HTMLProps<HTMLDivElement>) {
88
return (
9-
<aside {...props} className="mx-auto w-full max-w-[1200px] p-8 -mt-32 flex justify-between items-center">
9+
<aside
10+
{...props}
11+
className="mx-auto w-full max-w-[1200px] p-8 -mt-32 flex justify-between items-center"
12+
>
1013
<div className="w-full xl:flex xl:gap-6 bg-[#f9f4da] border-4 border-[#231f20]">
11-
<a href="https://query.gg?s=tanstack" className="xl:w-[50%] pb-4 grid grid-cols-[70px_1fr_70px] sm:grid-cols-[100px_1fr_100px] md:grid-cols-[140px_1fr_140px] xl:grid-cols-[110px_1fr] 2xl:grid-cols-[150px_1fr]">
12-
<img
13-
src={cornerTopLeft}
14-
alt="sun"
15-
className=""
16-
/>
14+
<a
15+
href="https://query.gg?s=tanstack"
16+
className="xl:w-[50%] pb-4 grid grid-cols-[70px_1fr_70px] sm:grid-cols-[100px_1fr_100px] md:grid-cols-[140px_1fr_140px] xl:grid-cols-[110px_1fr] 2xl:grid-cols-[150px_1fr]"
17+
>
18+
<img src={cornerTopLeft} alt="sun" className="" />
1719
<img
1820
src={headerCourse}
1921
alt="Query.gg - The Official React Query Course"
2022
className="-mt-[1px] w-10/12 max-w-[400px] justify-self-center"
2123
/>
22-
<img
23-
src={cornerTopRight}
24-
alt="moon"
25-
className="xl:hidden"
26-
/>
24+
<img src={cornerTopRight} alt="moon" className="xl:hidden" />
2725
</a>
2826
<div className="hidden xl:block w-[80px] mr-[-60px] bg-[#231f20] border-4 border-r-0 border-[#f9f4da] border-s-[#f9f4da] shadow-[-4px_0_0_#231f20] -skew-x-[15deg] z-0"></div>
2927
<div className="xl:w-[50%] py-2 xl:pb-0 grid xl:grid-cols-[1fr_90px] 2xl:grid-cols-[1fr_120px] justify-center bg-[#231f20] border-2 xl:border-4 xl:border-l-0 border-[#f9f4da] text-[#f9f4da] z-10">
3028
<div className="my-2 uppercase text-center place-self-center">
3129
{/* <h2 className="mt-1 mb-3 px-2 text-sm font-semibold">Launch sale happening now</h2> */}
3230
<h2 className="mb-1 text-lg lg:text-2xl xl:text-3xl font-semibold">
33-
Launch week sale
31+
Launch week sale
3432
</h2>
3533
<p className="normal-case mb-4">Up to 25% off through May 10th</p>
3634
<CountdownTimer targetDate="2025-05-10" />
37-
<a href="https://query.gg?s=tanstack" className="mt-4 mb-1 xl:mb-2 px-6 py-2 inline-block bg-[#fcba28] text-[#231f20] rounded-full uppercase border border-black cursor-pointer font-black">Join now</a>
35+
<a
36+
href="https://query.gg?s=tanstack"
37+
className="mt-4 mb-1 xl:mb-2 px-6 py-2 inline-block bg-[#fcba28] text-[#231f20] rounded-full uppercase border border-black cursor-pointer font-black"
38+
>
39+
Join now
40+
</a>
3841
</div>
3942
<img
4043
src={cornerFishBottomRight}

app/routes/_libraries/query.$version.index.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,16 @@ export default function VersionIndex() {
8585
>
8686
Read the Docs
8787
</Link>
88-
<p>(or <a href="https://query.gg?s=tanstack" className="font-semibold underline">check out our official course</a>. It’s on sale!)</p>
88+
<p>
89+
(or{' '}
90+
<a
91+
href="https://query.gg?s=tanstack"
92+
className="font-semibold underline"
93+
>
94+
check out our official course
95+
</a>
96+
. It’s on sale!)
97+
</p>
8998
</div>
9099
{/* <QueryGGBanner /> */}
91100
</div>

0 commit comments

Comments
 (0)