Skip to content

Commit

Permalink
feat: make early bird in home page clickable
Browse files Browse the repository at this point in the history
  • Loading branch information
dada878 committed Dec 2, 2024
1 parent 4a44e74 commit 49b36c4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions app/cfp/(submission)/_components/early-bird.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { SHOW_EARLY_BIRD } from "@/lib/const";
import { AnimatePresence, motion } from "framer-motion";
import { useState } from "react";
import { createPortal } from "react-dom";

export default function EarlyBird() {
const [isOpen, setIsOpen] = useState(false);
Expand Down Expand Up @@ -33,6 +34,7 @@ export default function EarlyBird() {
}

export function EarlyBirdHome() {
const [isOpen, setIsOpen] = useState(false);
const expiredTime = new Date("2024-12-25T23:59:00+08:00").getTime();
const isExpired = Date.now() > expiredTime;

Expand All @@ -41,7 +43,10 @@ export function EarlyBirdHome() {
return (
<>
{!isExpired ? (
<span className="relative z-10 flex w-full items-center gap-5 rounded-[28px] border border-accent bg-[#271A3A] px-7 py-2 text-xl font-bold text-accent transition hover:brightness-125 max-sm:flex-row">
<span
onClick={() => setIsOpen(true)}
className="relative z-10 flex w-full cursor-pointer items-center gap-5 rounded-[28px] border border-accent bg-[#271A3A] px-7 py-2 text-xl font-bold text-accent transition hover:brightness-125 max-sm:flex-row"
>
<ExclamationMark />
<div className="max-sm:flex-col">
<a>早鳥投稿計劃開催中!</a>
Expand All @@ -51,6 +56,10 @@ export function EarlyBirdHome() {
</div>
</span>
) : null}
{createPortal(
<Dialog isOpen={isOpen} setIsOpen={setIsOpen} />,
document.body,
)}
</>
);
}
Expand Down Expand Up @@ -93,7 +102,7 @@ function Dialog({
exit={{ opacity: 0 }}
transition={{ duration: 0.25 }}
style={{ pointerEvents: "auto" }}
className="fixed inset-0 z-50 m-0 flex scale-110 items-center justify-center bg-black/60"
className="fixed inset-0 z-50 m-0 flex scale-110 items-center justify-center bg-black/60 text-foreground"
onClick={() => {
setIsOpen(false);
}}
Expand Down

0 comments on commit 49b36c4

Please sign in to comment.