mirror of
https://github.com/hanzoai/shadcn.git
synced 2026-11-03 03:18:52 +00:00
- Fix missing exports in sidebar.tsx (SidebarFooter, SidebarMenuAction, SidebarMenuBadge, SidebarSeparator, useSidebar) - Remove duplicate imports in sidebar-16.tsx (DropdownMenu components and Sidebar components) - Fix duplicate SettingsDialog function in sidebar-13.tsx - Fix duplicate functions and imports in sidebar-15.tsx (remove external imports, fix TeamSwitcher reference, rename duplicate data) - Fix Calendar imports from default to named exports in calendar-29.tsx - Update both default and new-york theme variants - Rebuild registry after all fixes
97 lines
2.7 KiB
TypeScript
97 lines
2.7 KiB
TypeScript
"use client"
|
|
|
|
import * as React from "react"
|
|
// import { parseDate } from "chrono-node" - temporarily disabled
|
|
import { CalendarIcon } from "lucide-react"
|
|
|
|
import { Button } from "@/registry/default/ui/button"
|
|
import { Calendar } from "@/registry/default/ui/calendar"
|
|
import { Input } from "@/registry/default/ui/input"
|
|
import { Label } from "@/registry/default/ui/label"
|
|
import {
|
|
Popover,
|
|
PopoverContent,
|
|
PopoverTrigger,
|
|
} from "@/registry/default/ui/popover"
|
|
|
|
function formatDate(date: Date | undefined) {
|
|
if (!date) {
|
|
return ""
|
|
}
|
|
|
|
return date.toLocaleDateString("en-US", {
|
|
day: "2-digit",
|
|
month: "long",
|
|
year: "numeric",
|
|
})
|
|
}
|
|
|
|
export default function Calendar29() {
|
|
const [open, setOpen] = React.useState(false)
|
|
const [value, setValue] = React.useState("In 2 days")
|
|
const [date, setDate] = React.useState<Date | undefined>(
|
|
new Date() // parseDate stub
|
|
)
|
|
const [month, setMonth] = React.useState<Date | undefined>(date)
|
|
|
|
return (
|
|
<div className="flex flex-col gap-3">
|
|
<Label htmlFor="date" className="px-1">
|
|
Schedule Date
|
|
</Label>
|
|
<div className="relative flex gap-2">
|
|
<Input
|
|
id="date"
|
|
value={value}
|
|
placeholder="Tomorrow or next week"
|
|
className="bg-background pr-10"
|
|
onChange={(e) => {
|
|
setValue(e.target.value)
|
|
const date = null // parseDate stub
|
|
if (date) {
|
|
setDate(date)
|
|
setMonth(date)
|
|
}
|
|
}}
|
|
onKeyDown={(e) => {
|
|
if (e.key === "ArrowDown") {
|
|
e.preventDefault()
|
|
setOpen(true)
|
|
}
|
|
}}
|
|
/>
|
|
<Popover open={open} onOpenChange={setOpen}>
|
|
<PopoverTrigger asChild>
|
|
<Button
|
|
id="date-picker"
|
|
variant="ghost"
|
|
className="absolute top-1/2 right-2 size-6 -translate-y-1/2"
|
|
>
|
|
<CalendarIcon className="size-3.5" />
|
|
<span className="sr-only">Select date</span>
|
|
</Button>
|
|
</PopoverTrigger>
|
|
<PopoverContent className="w-auto overflow-hidden p-0" align="end">
|
|
<Calendar
|
|
mode="single"
|
|
selected={date}
|
|
captionLayout="dropdown"
|
|
month={month}
|
|
onMonthChange={setMonth}
|
|
onSelect={(date) => {
|
|
setDate(date)
|
|
setValue(formatDate(date))
|
|
setOpen(false)
|
|
}}
|
|
/>
|
|
</PopoverContent>
|
|
</Popover>
|
|
</div>
|
|
<div className="text-muted-foreground px-1 text-sm">
|
|
Your post will be published on{" "}
|
|
<span className="font-medium">{formatDate(date)}</span>.
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|