Skip to content

Commit

Permalink
remove as any
Browse files Browse the repository at this point in the history
  • Loading branch information
veej committed Aug 29, 2023
1 parent 45de125 commit ba50061
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions packages/bento-design-system/src/DateField/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ function CalendarGrid(
}

export function CalendarPopover(
props: {
type: "single" | "range";
props: (
| { type: "single"; state: CalendarState }
| { type: "range"; state: RangeCalendarState }
) & {
prevButtonProps: AriaButtonProps<"button">;
nextButtonProps: AriaButtonProps<"button">;
onClose: () => void;
Expand Down Expand Up @@ -126,6 +128,14 @@ export function CalendarPopover(
shouldFlip: true,
});

const gridProps =
props.type === "single"
? {
type: "single" as const,
state: state as CalendarState,
}
: { type: "range" as const, state: state as RangeCalendarState };

return createPortal(
<Box
className={calendar}
Expand All @@ -145,7 +155,7 @@ export function CalendarPopover(
minDate={state.minValue}
maxDate={state.maxValue}
/>
<CalendarGrid type={props.type} state={state as any} />
<CalendarGrid {...gridProps} />
{props.shortcuts && <Box style={{ maxWidth: config.dayWidth * 7 }}>{props.shortcuts}</Box>}
</Stack>
</Box>
Expand Down

0 comments on commit ba50061

Please sign in to comment.