-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
98 additions
and
7 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
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
export { default as TopCard } from './top-card'; | ||
export { default as LineUp } from './line-up'; |
Empty file.
51 changes: 51 additions & 0 deletions
51
app/components/festival/line-up/date-selector/date-block.tsx
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,51 @@ | ||
'use client'; | ||
|
||
import { useRouter } from '@lib/navigation'; | ||
import { cn } from '@lib/utils'; | ||
import { Dayjs } from 'dayjs'; | ||
import 'dayjs/locale/ko'; | ||
import { motion } from 'framer-motion'; | ||
import { useLocale } from 'next-intl'; | ||
|
||
type DateBlockProps = { | ||
date: Dayjs; | ||
className?: string; | ||
disabled?: boolean; | ||
selected?: boolean; | ||
}; | ||
|
||
export default function DateBlock({ | ||
date, | ||
className, | ||
disabled, | ||
selected, | ||
}: DateBlockProps) { | ||
const locale = useLocale(); | ||
const router = useRouter(); | ||
|
||
const onClick = () => { | ||
if (disabled) return; | ||
router.replace(`/lineup?day=`); | ||
}; | ||
|
||
return ( | ||
<motion.div | ||
tabIndex={disabled ? -1 : 0} | ||
aria-disabled={disabled} | ||
onClick={onClick} | ||
whileTap={{ scale: disabled ? 1 : 0.95 }} | ||
className={cn( | ||
'flex flex-col h-full justify-center items-center rounded-lg flex-1 relative gap-2', | ||
disabled && | ||
'text-neutral-400 dark:text-neutral-700 pointer-events-none', | ||
selected && 'text-white bg-primary', | ||
className, | ||
)} | ||
> | ||
<div className="text-xl font-bold z-10">{date.date()}</div> | ||
<div className="text-xs font-medium z-10"> | ||
{date.locale(locale).format('ddd')} | ||
</div> | ||
</motion.div> | ||
); | ||
} |
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,25 @@ | ||
'use client'; | ||
|
||
import dayjs from 'dayjs'; | ||
|
||
import DateBlock from './date-block'; | ||
|
||
type DateSelectorProps = { | ||
availableDays: string[]; | ||
}; | ||
|
||
export default function DateSelector({ availableDays }: DateSelectorProps) { | ||
const selectedDate = dayjs(availableDays[0]); | ||
const daysArr = Array.from({ length: 5 }, (_, i) => | ||
selectedDate.add(i - 2, 'day'), | ||
); | ||
|
||
return ( | ||
<div className="w-full h-[70px] flex items-center justify-between relative"> | ||
{daysArr.map((date, index) => ( | ||
<DateBlock key={index} date={date} /> | ||
))} | ||
<div className="bg-primary rounded-xl h-full w-[20%] absolute left-1/2 -translate-x-1/2" /> | ||
</div> | ||
); | ||
} |
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,10 @@ | ||
import DateSelector from './date-selector'; | ||
|
||
export default function LineUp() { | ||
return ( | ||
<section className="flex flex-col gap-5"> | ||
<h1 className="w-full text-center text-xl font-bold">라인업</h1> | ||
<DateSelector availableDays={['2024-05-16', '2024-05-17']} /> | ||
</section> | ||
); | ||
} |
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