Skip to content

Commit 804b31d

Browse files
committed
Enhance DateTimePicker component and registry updates
This commit adds a new datetimepicker-input component to the registry, along with its dependencies and metadata. It also updates the components.json to include a new registry entry for @shadix-ui. Additionally, several existing datetimepicker components have been refactored for improved structure and consistency, including updates to file paths in the registry. The changes ensure better organization and accessibility of the DateTimePicker components.
1 parent 20b6835 commit 804b31d

34 files changed

Lines changed: 531 additions & 1564 deletions

app/docs/[[...slug]]/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ export default async function Page(props: PageProps<"/docs/[[...slug]]">) {
8080
style: "clerk",
8181
}}
8282
full={page.data.full}
83+
breadcrumb={{
84+
enabled: true,
85+
includePage: true,
86+
includeRoot: true,
87+
}}
8388
>
8489
<div className="flex items-center gap-2 justify-between">
8590
<DocsTitle className="flex-1 text-4xl text-foreground">

components.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"hooks": "@/shadcn/hooks"
2020
},
2121
"registries": {
22-
"@ncdai": "https://chanhdai.com/r/{name}.json"
22+
"@ncdai": "https://chanhdai.com/r/{name}.json",
23+
"@shadix-ui": "https://shadix-ui.vercel.app/r/{name}.json"
2324
}
2425
}

components/AIOpenButton.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type React from "react";
22

3-
import { ChevronDown, MessageCircleIcon } from "lucide-react";
3+
import { Bot, ChevronDown, MessageCircleIcon } from "lucide-react";
44

55
import { Icons } from "@/components/Icons";
66
import { Button } from "@/shadcn/components/ui/button";
@@ -79,7 +79,8 @@ const AIOpenButton: React.FC<AIOpenButtonProps> = ({ url }) => {
7979
variant={"secondary"}
8080
className="extend-touch-target ml-auto shadow-none h-8 md:h-7"
8181
>
82-
Open
82+
<Bot />
83+
Ask AI
8384
<ChevronDown />
8485
</Button>
8586
</DropdownMenuTrigger>

components/InstalationDocs.tsx

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
import type React from "react";
22

3+
import Link from "next/link";
4+
35
import { ComponentSource } from "@/components/ComponentSource";
6+
import { Icons } from "@/components/Icons";
47
import InstallTabs from "@/components/InstallTabs";
58
import { Index } from "@/registry/__index__";
9+
import { Button } from "@/shadcn/components/ui/button";
610
import {
711
Tabs,
812
TabsContent,
913
TabsList,
1014
TabsTrigger,
1115
} from "@/shadcn/components/ui/tabs";
16+
import {
17+
Tooltip,
18+
TooltipContent,
19+
TooltipTrigger,
20+
} from "@/shadcn/components/ui/tooltip";
1221

1322
const getFileName = (filepath: string) => {
1423
const files = filepath.split("/");
@@ -23,20 +32,37 @@ const InstalationDocs: React.FC<InstalationDocsProps> = ({
2332

2433
return (
2534
<Tabs defaultValue="cli">
26-
<TabsList className="bg-transparent gap-2">
27-
<TabsTrigger
28-
className="border-0 rounded-none data-[state=active]:shadow-none !bg-transparent data-[state=active]:border-b-muted-foreground dark:data-[state=active]:border-b-muted-foreground data-[state=active]:border-b-2"
29-
value="cli"
30-
>
31-
CLI
32-
</TabsTrigger>
33-
<TabsTrigger
34-
className="border-0 rounded-none data-[state=active]:shadow-none !bg-transparent data-[state=active]:border-b-muted-foreground dark:data-[state=active]:border-b-muted-foreground data-[state=active]:border-b-2"
35-
value="manual"
36-
>
37-
Manual
38-
</TabsTrigger>
35+
<TabsList className="bg-transparent gap-2 justify-between flex w-full">
36+
<div>
37+
<TabsTrigger
38+
className="border-0 rounded-none data-[state=active]:shadow-none !bg-transparent data-[state=active]:border-b-muted-foreground dark:data-[state=active]:border-b-muted-foreground data-[state=active]:border-b-2"
39+
value="cli"
40+
>
41+
CLI
42+
</TabsTrigger>
43+
<TabsTrigger
44+
className="border-0 rounded-none data-[state=active]:shadow-none !bg-transparent data-[state=active]:border-b-muted-foreground dark:data-[state=active]:border-b-muted-foreground data-[state=active]:border-b-2"
45+
value="manual"
46+
>
47+
Manual
48+
</TabsTrigger>
49+
</div>
50+
51+
<Tooltip>
52+
<TooltipTrigger asChild>
53+
<Button variant="ghost" size="sm" asChild>
54+
<Link
55+
href={pkg.files?.[0]?.githubUrl ?? "#"}
56+
target="_blank"
57+
>
58+
<Icons.gitHub />
59+
</Link>
60+
</Button>
61+
</TooltipTrigger>
62+
<TooltipContent>Open in GitHub</TooltipContent>
63+
</Tooltip>
3964
</TabsList>
65+
4066
<TabsContent value="cli">
4167
<InstallTabs pkg={name} />
4268
</TabsContent>

components/InstallTabs.tsx

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,17 @@ const getCommands = (command: string): Record<PackageManager, string> => {
2525

2626
const InstallTabs: React.FC<InstallTabsProps> = ({ pkg, external = false }) => {
2727
const [value, setValue] = React.useState<PackageManager>("pnpm");
28-
const [origin, setOrigin] = React.useState<string>("");
28+
// const [origin, setOrigin] = React.useState<string>('');
2929

3030
// fix: Handle window access safely for SSR
31-
React.useEffect(() => {
32-
if (typeof window !== "undefined") {
33-
setOrigin(window.location.origin);
34-
}
35-
}, []);
31+
// React.useEffect(() => {
32+
// if (typeof window !== 'undefined') {
33+
// setOrigin(window.location.origin);
34+
// }
35+
// }, []);
3636

37-
let command = `shadcn@latest add ${origin}/r/${pkg}`;
37+
let command = `shadcn@latest add @shadix-ui/${pkg}`;
38+
// let command = `shadcn@latest add ${origin}/r/${pkg}`;
3839

3940
if (external) {
4041
const packages = Array.isArray(pkg) ? pkg.join(" ") : pkg;
@@ -65,17 +66,6 @@ const InstallTabs: React.FC<InstallTabsProps> = ({ pkg, external = false }) => {
6566
</TabsList>
6667

6768
<CopyButton value={getCommands(command)[value]} />
68-
69-
{/* <Button
70-
variant='ghost'
71-
size='icon'
72-
onClick={handleCopy}
73-
title='Copy command'
74-
className='h-7 w-7 text-muted-foreground hover:text-foreground'
75-
>
76-
<Clipboard className='h-4 w-4' />
77-
<span className='sr-only'>Copy command</span>
78-
</Button> */}
7969
</div>
8070
</div>
8171

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
title: DateTime Picker Input
3+
description: A datetime picker input component with modern animations
4+
author: Gihan Rangana
5+
authorUrl: https://github.com/gihanrangana
6+
authorImage: https://github.com/gihanrangana.png
7+
---
8+
9+
<ComponentPreview name="datetimepicker-input-demo" />
10+
11+
## Installation
12+
13+
<InstalationDocs name="datetimepicker-input" filepath="components/ui" />
14+
15+
## Usage
16+
17+
### Import the component
18+
19+
```tsx
20+
import { DateTimePickerInput } from '@/components/ui/datetimepicker-input';
21+
```
22+
23+
### Basic Usage
24+
25+
```tsx
26+
const DateTimePickerInputDemo = () => {
27+
return (
28+
<DateTimePickerInput
29+
mode="single"
30+
value={new Date()}
31+
onValueChange={(date) => {
32+
console.log(date);
33+
}}
34+
placeholder="Select date"
35+
/>
36+
);
37+
};
38+
```
39+
40+
#### With Range Mode
41+
42+
```tsx
43+
const DateTimePickerDemo = () => {
44+
return (
45+
<DateTimePickerInput
46+
mode="range"
47+
onValueChange={(date) => {
48+
console.log(date);
49+
}}
50+
placeholder="Select date range"
51+
/>
52+
);
53+
};
54+
```
55+
56+
#### With Time Mode
57+
58+
```tsx
59+
const DateTimePickerDemo = () => {
60+
return (
61+
<DateTimePickerInput
62+
mode="single"
63+
enableTime={true}
64+
timeFormat="24h" // 12h or 24h
65+
value={new Date()}
66+
onValueChange={(date) => {
67+
console.log(date);
68+
}}
69+
placeholder="Select date and time"
70+
/>
71+
);
72+
};
73+
```
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
title: DateTime Picker
3+
description: A datetime picker component with modern animations
4+
author: Gihan Rangana
5+
authorUrl: https://github.com/gihanrangana
6+
authorImage: https://github.com/gihanrangana.png
7+
---
8+
9+
<ComponentPreview name="datetimepicker-demo" />
10+
11+
## Installation
12+
13+
<InstalationDocs name="datetimepicker" filepath="components/ui" />
14+
15+
## Usage
16+
17+
### Import the component
18+
19+
```tsx
20+
import { DateTimePicker } from '@/components/datetimepicker';
21+
```
22+
23+
### Basic Usage
24+
25+
```tsx
26+
const DateTimePickerDemo = () => {
27+
return (
28+
<DateTimePicker
29+
mode="single"
30+
value={new Date()}
31+
onDateChange={(date) => {
32+
console.log(date);
33+
}}
34+
placeholder="Select date"
35+
/>
36+
);
37+
};
38+
```
39+
40+
#### With Range Mode
41+
42+
```tsx
43+
const DateTimePickerDemo = () => {
44+
return (
45+
<DateTimePicker
46+
mode="range"
47+
onDateChange={(date) => {
48+
console.log(date);
49+
}}
50+
placeholder="Select date range"
51+
/>
52+
);
53+
};
54+
```
55+
56+
#### With Time Mode
57+
58+
```tsx
59+
const DateTimePickerDemo = () => {
60+
return (
61+
<DateTimePicker
62+
mode="single"
63+
enableTime={true}
64+
timeFormat="24h" // 12h or 24h
65+
value={new Date()}
66+
onDateChange={(date) => {
67+
console.log(date);
68+
}}
69+
placeholder="Select date and time"
70+
/>
71+
);
72+
};
73+
```

0 commit comments

Comments
 (0)