Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
fix: downgrade date-picker
Browse files Browse the repository at this point in the history
  • Loading branch information
jspark2000 committed Oct 7, 2024
1 parent 0beaea2 commit b019931
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 42 deletions.
2 changes: 1 addition & 1 deletion frontend/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"next-auth": "^4.24.8",
"next-themes": "^0.3.0",
"react": "18.3.1",
"react-day-picker": "^9.1.3",
"react-day-picker": "^8.10.1",
"react-dom": "18.3.1",
"react-hook-form": "^7.53.0",
"sharp": "^0.33.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export default function AttendanceRangeForm() {
mode="single"
selected={field.value}
onSelect={field.onChange}
autoFocus
initialFocus
/>
</PopoverContent>
</Popover>
Expand Down Expand Up @@ -167,7 +167,7 @@ export default function AttendanceRangeForm() {
mode="single"
selected={field.value}
onSelect={field.onChange}
autoFocus
initialFocus
/>
</PopoverContent>
</Popover>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export default function UpdateSurveyGroupForm({
mode="single"
selected={field.value}
onSelect={field.onChange}
autoFocus
initialFocus
/>
</PopoverContent>
</Popover>
Expand Down Expand Up @@ -235,7 +235,7 @@ export default function UpdateSurveyGroupForm({
mode="single"
selected={field.value}
onSelect={field.onChange}
autoFocus
initialFocus
/>
</PopoverContent>
</Popover>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export default function CreateSurveyForm() {
mode="single"
selected={field.value}
onSelect={field.onChange}
autoFocus
initialFocus
/>
</PopoverContent>
</Popover>
Expand Down Expand Up @@ -290,7 +290,7 @@ export default function CreateSurveyForm() {
mode="single"
selected={field.value}
onSelect={field.onChange}
autoFocus
initialFocus
/>
</PopoverContent>
</Popover>
Expand Down Expand Up @@ -434,7 +434,7 @@ export default function CreateSurveyForm() {
mode="single"
selected={field.value}
onSelect={field.onChange}
autoFocus
initialFocus
/>
</PopoverContent>
</Popover>
Expand Down Expand Up @@ -493,7 +493,7 @@ export default function CreateSurveyForm() {
mode="single"
selected={field.value}
onSelect={field.onChange}
autoFocus
initialFocus
/>
</PopoverContent>
</Popover>
Expand Down
35 changes: 15 additions & 20 deletions frontend/src/components/ui/calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ import { buttonVariants } from '@/components/ui/button'
import { cn } from '@/lib/utils'
import { ChevronLeftIcon, ChevronRightIcon } from '@radix-ui/react-icons'
import * as React from 'react'
import { Chevron, DayPicker } from 'react-day-picker'
import { DayPicker } from 'react-day-picker'

export type CalendarProps = React.ComponentProps<typeof DayPicker>

const Calendar = ({
// eslint-disable-next-line func-style
function Calendar({
className,
classNames,
showOutsideDays = true,
...props
}: CalendarProps) => {
}: CalendarProps) {
return (
<DayPicker
showOutsideDays={showOutsideDays}
Expand All @@ -33,10 +34,10 @@ const Calendar = ({
table: 'w-full border-collapse space-y-1',
head_row: 'flex',
head_cell:
'text-zinc-500 rounded-md w-8 font-normal text-[0.8rem] dark:text-zinc-400',
'text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]',
row: 'flex w-full mt-2',
cell: cn(
'relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-zinc-100 [&:has([aria-selected].day-outside)]:bg-zinc-100/50 [&:has([aria-selected].day-range-end)]:rounded-r-md dark:[&:has([aria-selected])]:bg-zinc-800 dark:[&:has([aria-selected].day-outside)]:bg-zinc-800/50',
'relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-r-md',
props.mode === 'range'
? '[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md'
: '[&:has([aria-selected])]:rounded-md'
Expand All @@ -48,27 +49,21 @@ const Calendar = ({
day_range_start: 'day-range-start',
day_range_end: 'day-range-end',
day_selected:
'bg-zinc-900 text-zinc-50 hover:bg-zinc-900 hover:text-zinc-50 focus:bg-zinc-900 focus:text-zinc-50 dark:bg-zinc-50 dark:text-zinc-900 dark:hover:bg-zinc-50 dark:hover:text-zinc-900 dark:focus:bg-zinc-50 dark:focus:text-zinc-900',
day_today:
'bg-zinc-100 text-zinc-900 dark:bg-zinc-800 dark:text-zinc-50',
'bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground',
day_today: 'bg-accent text-accent-foreground',
day_outside:
'day-outside text-zinc-500 opacity-50 aria-selected:bg-zinc-100/50 aria-selected:text-zinc-500 aria-selected:opacity-30 dark:text-zinc-400 dark:aria-selected:bg-zinc-800/50 dark:aria-selected:text-zinc-400',
day_disabled: 'text-zinc-500 opacity-50 dark:text-zinc-400',
'day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30',
day_disabled: 'text-muted-foreground opacity-50',
day_range_middle:
'aria-selected:bg-zinc-100 aria-selected:text-zinc-900 dark:aria-selected:bg-zinc-800 dark:aria-selected:text-zinc-50',
'aria-selected:bg-accent aria-selected:text-accent-foreground',
day_hidden: 'invisible',
...classNames
}}
components={{
Chevron(props) {
if (props.orientation === 'left') {
return <ChevronLeftIcon className="h-4 w-4" />
} else if (props.orientation === 'right') {
return <ChevronRightIcon className="h-4 w-4" />
} else {
return <Chevron {...props} />
}
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
IconLeft: ({ ...props }) => <ChevronLeftIcon className="h-4 w-4" />,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
IconRight: ({ ...props }) => <ChevronRightIcon className="h-4 w-4" />
}}
{...props}
/>
Expand Down
19 changes: 7 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b019931

Please sign in to comment.