-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: map components into individual files
- Loading branch information
Showing
6 changed files
with
313 additions
and
300 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 |
---|---|---|
@@ -1,38 +1,38 @@ | ||
import type { ThemeColor } from '@shared/types/ThemeColors'; | ||
import React from 'react'; | ||
|
||
import { Button } from '../common/Button'; | ||
import type { DayCode } from './types'; | ||
import { DAY_MAPPING } from './types'; | ||
|
||
type DaySelectorProps = { | ||
interface DaySelectorProps { | ||
selectedDay: DayCode | null; | ||
onDaySelect: (day: DayCode) => void; | ||
}; | ||
} | ||
|
||
/** | ||
* DaySelector component allows users to select a day from a predefined set of days. | ||
* DaySelector component allows users to select a day from a list of days. | ||
* | ||
* @param selectedDay - The currently selected day. | ||
* @param onDaySelect - Callback function to handle day selection. | ||
* | ||
* @returns The rendered DaySelector component. | ||
*/ | ||
export const DaySelector = ({ selectedDay, onDaySelect }: DaySelectorProps) => ( | ||
<div className='flex gap-2 rounded-md bg-white/90 p-2 shadow-sm'> | ||
{(Object.keys(DAY_MAPPING) as DayCode[]).map(day => { | ||
const color = (selectedDay === day ? 'ut-burntorange' : 'ut-white') as ThemeColor; | ||
return ( | ||
// const DaySelector = ({ selectedDay, onDaySelect }: DaySelectorProps): JSX.Element => ( | ||
export default function DaySelector({ selectedDay, onDaySelect }: DaySelectorProps): JSX.Element { | ||
return ( | ||
<div className='flex gap-2 rounded-md bg-white/90 p-2 shadow-sm'> | ||
{(Object.keys(DAY_MAPPING) as DayCode[]).map(day => ( | ||
<Button | ||
key={day} | ||
onClick={() => onDaySelect(day)} | ||
variant={selectedDay === day ? 'filled' : 'outline'} | ||
color={color} | ||
className='rounded-sm' | ||
color='ut-burntorange' | ||
variant={selectedDay === day ? 'filled' : 'minimal'} | ||
size='mini' | ||
className='px-3 py-1' | ||
> | ||
{day} | ||
</Button> | ||
); | ||
})} | ||
</div> | ||
); | ||
))} | ||
</div> | ||
); | ||
} |
Oops, something went wrong.