-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add: close show next airing episode box
- Loading branch information
1 parent
91701aa
commit 5cd1ad0
Showing
2 changed files
with
32 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"use client"; | ||
import React, { useCallback, useMemo, useState } from "react"; | ||
import { X } from "lucide-react"; | ||
interface NextAiringEpisodeProps { | ||
nextAiringEpisode: { | ||
episode: number; | ||
} | null; | ||
formattedAiringDate: string; | ||
} | ||
|
||
const NextAiringEpisode: React.FC<NextAiringEpisodeProps> = ({ nextAiringEpisode, formattedAiringDate }) => { | ||
const initialCloseState = useMemo(() => false, []); | ||
const [close, setClose] = useState<boolean>(initialCloseState); | ||
|
||
const handleClose = useCallback(() => { | ||
setClose((prevClose) => !prevClose); | ||
}, []); | ||
return ( | ||
<> | ||
{!close && ( | ||
<span className="bg-white flex relative justify-between items-center lg:text-lg text-md mt-4 text-black w-full font-bold text-center p-4 rounded-lg"> | ||
Episode {nextAiringEpisode?.episode} expected on {formattedAiringDate} | ||
<X onClick={handleClose} className=" absolute md:top-2 cursor-pointer top-1 md:right-4 right-2" /> | ||
</span> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default NextAiringEpisode; |