mirror of
https://github.com/hanzoai/shadcn.git
synced 2026-11-02 13:07:46 +00:00
Squash merge of shadcn-ui/ui main branch into hanzo/ui, bringing in: - [email protected] through [email protected] releases - New apps/v4 directory structure - Registry system improvements and MCP server - Framework support (Vue, Svelte, React Native) - New templates (vite-app, monorepo-next, laravel) - Zod 4 compatibility (scoped override for zod@>4) - Test fixture corrections for alias resolution All 867 merge conflicts resolved preserving Hanzo customizations. 1020/1020 shadcn tests pass.
51 lines
1.6 KiB
TypeScript
51 lines
1.6 KiB
TypeScript
"use client"
|
|
|
|
import * as React from "react"
|
|
import { Calendar, CalendarDayButton } from "@/examples/base/ui/calendar"
|
|
import { Card, CardContent } from "@/examples/base/ui/card"
|
|
import { addDays } from "date-fns"
|
|
import { type DateRange } from "react-day-picker"
|
|
|
|
export function CalendarCustomDays() {
|
|
const [range, setRange] = React.useState<DateRange | undefined>({
|
|
from: new Date(new Date().getFullYear(), 11, 8),
|
|
to: addDays(new Date(new Date().getFullYear(), 11, 8), 10),
|
|
})
|
|
|
|
return (
|
|
<Card className="mx-auto w-fit p-0">
|
|
<CardContent className="p-0">
|
|
<Calendar
|
|
mode="range"
|
|
defaultMonth={range?.from}
|
|
selected={range}
|
|
onSelect={setRange}
|
|
numberOfMonths={1}
|
|
captionLayout="dropdown"
|
|
className="[--cell-size:--spacing(10)] md:[--cell-size:--spacing(12)]"
|
|
formatters={{
|
|
formatMonthDropdown: (date) => {
|
|
return date.toLocaleString("default", { month: "long" })
|
|
},
|
|
}}
|
|
components={{
|
|
DayButton: ({ children, modifiers, day, ...props }) => {
|
|
const isWeekend =
|
|
day.date.getDay() === 0 || day.date.getDay() === 6
|
|
|
|
return (
|
|
<CalendarDayButton day={day} modifiers={modifiers} {...props}>
|
|
{children}
|
|
{!modifiers.outside && (
|
|
<span>{isWeekend ? "$120" : "$100"}</span>
|
|
)}
|
|
</CalendarDayButton>
|
|
)
|
|
},
|
|
}}
|
|
/>
|
|
</CardContent>
|
|
</Card>
|
|
)
|
|
}
|