feat: enhance Giveaway component with skeleton loading state

This commit is contained in:
TrèsAbhi committed 2025-12-04 14:19:35 -06:00
1 parent 814192c0b0
commit 9286104391
1 file changed
+4 -2
+4 -2
View File
@@ -1,6 +1,7 @@
import { Code, Flex, Heading, Link, Text } from "@radix-ui/themes"; import { Code, Flex, Heading, Link, Text } from "@radix-ui/themes";
import { useEffect, useState, type ReactNode } from "react"; import { useEffect, useState, type ReactNode } from "react";
import type { MaybeSkeletonComponentProps } from "../types/maybeSkeletonComponentProps"; import type { MaybeSkeletonComponentProps } from "../types/maybeSkeletonComponentProps";
import { InlineSkeleton } from "./InlineSkeleton";
const TIME = 1764898200 * 1000; const TIME = 1764898200 * 1000;
@@ -10,7 +11,7 @@ export function Giveaway({ skeleton }: MaybeSkeletonComponentProps) {
useEffect(() => { useEffect(() => {
const interval = setInterval(() => { const interval = setInterval(() => {
setTimeLeft(TIME - Date.now()); setTimeLeft(TIME - Date.now());
}); }, 1000);
return () => { return () => {
clearInterval(interval); clearInterval(interval);
@@ -66,7 +67,8 @@ export function Giveaway({ skeleton }: MaybeSkeletonComponentProps) {
<Flex direction="column"> <Flex direction="column">
<Heading size={{ initial: "4", sm: "6" }}> <Heading size={{ initial: "4", sm: "6" }}>
Music Box giveaway {string} Music Box giveaway {!skeleton && string}{" "}
{skeleton && <InlineSkeleton width="10rem" />}
</Heading> </Heading>
<Text size={{ initial: "2", sm: "3" }}> <Text size={{ initial: "2", sm: "3" }}>
Join the BlitzKit Discord server event Join the BlitzKit Discord server event