Skip to content

Commit 7f90fe2

Browse files
authored
Merge pull request #913 from flags-gg/k-branch-1
✨ feat(calendar): improve calendar component styles and structure
2 parents 216f55e + 9568ed5 commit 7f90fe2

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
"clsx": "^2.1.1",
5555
"cmdk": "1.1.1",
5656
"cookies-next": "^5.1.0",
57-
"date-fns": "^4.1.0",
5857
"embla-carousel-react": "^8.6.0",
5958
"geist": "^1.3.1",
6059
"input-otp": "^1.4.2",

pnpm-lock.yaml

-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/ui/calendar.tsx

+10-9
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ function Calendar({
3434
head_cell:
3535
"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",
3636
row: "flex w-full mt-2",
37-
cell: cn(
37+
day: cn(
3838
"relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md",
3939
props.mode === "range"
4040
? "[&: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"
4141
: "[&:has([aria-selected])]:rounded-md"
4242
),
43-
day: cn(
43+
day_button: cn(
4444
buttonVariants({ variant: "ghost" }),
4545
"size-8 p-0 font-normal aria-selected:opacity-100"
4646
),
@@ -53,19 +53,20 @@ function Calendar({
5353
day_today: "bg-accent text-accent-foreground",
5454
day_outside:
5555
"day-outside text-muted-foreground aria-selected:text-muted-foreground",
56-
day_disabled: "text-muted-foreground opacity-50",
56+
disabled: "text-muted-foreground opacity-50",
5757
day_range_middle:
5858
"aria-selected:bg-accent aria-selected:text-accent-foreground",
5959
day_hidden: "invisible",
6060
...classNames,
6161
}}
6262
components={{
63-
IconLeft: ({ className, ...props }) => (
64-
<ChevronLeft className={cn("size-4", className)} {...props} />
65-
),
66-
IconRight: ({ className, ...props }) => (
67-
<ChevronRight className={cn("size-4", className)} {...props} />
68-
),
63+
Chevron: (className, props) => {
64+
if (props.orientation === "left") {
65+
return <ChevronLeft className={cn("size-4", className)} {...props} />
66+
}
67+
68+
return <ChevronRight className={cn("size-4", className)} {...props} />
69+
}
6970
}}
7071
{...props}
7172
/>

0 commit comments

Comments
 (0)