|
1 | | -import { TimelineLayout } from '@/components/timeline'; |
2 | | -import Link from 'next/link'; |
3 | | -import { Github, Calendar } from 'lucide-react'; |
4 | | -import { buttonVariants } from '@/components/ui/button'; |
5 | | -import { cn } from '@/lib/utils'; |
6 | | -import { timelineData } from './data'; |
7 | | -import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; |
8 | | -import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; |
9 | | -import { ThemeToggle } from '@/components/theme-toggle'; |
10 | | -import { CodeBlock } from '@/components/code-block'; |
11 | | - |
12 | | -const installCode = `# 1. Clone the repository |
13 | | -git clone https://github.com/timDeHof/shadcn-timeline.git |
14 | | -
|
15 | | -# 2. Open the folder |
16 | | -cd shadcn-timeline |
17 | | -
|
18 | | -# 3. Install dependencies |
19 | | -npm install |
20 | | -
|
21 | | -# 4. Copy the timeline components to your project |
22 | | -# Copy from: |
23 | | -# /src/app/components/timeline/timeline-layout.tsx |
24 | | -# /src/app/components/timeline/timeline.tsx`; |
25 | | - |
26 | | -const usageCode = `# Add to your component: |
27 | | -import { TimelineLayout } from "@/components/timeline/timeline-layout"; |
28 | | -
|
29 | | -# Copy the timeline components to: |
30 | | -# /src/components/timeline/timeline-layout.tsx |
31 | | -# /src/components/timeline/timeline.tsx`; |
32 | | - |
33 | | -const examples = { |
34 | | - basic: { |
35 | | - name: 'Basic', |
36 | | - code: `<TimelineLayout |
37 | | - items={timelineData} |
38 | | - size="md" |
39 | | - />`, |
40 | | - component: <TimelineLayout items={timelineData} size="md" />, |
41 | | - }, |
42 | | - customIcon: { |
43 | | - name: 'Custom Icon', |
44 | | - code: `<TimelineLayout |
45 | | - items={timelineData} |
46 | | - size="lg" |
47 | | - iconColor="primary" |
48 | | - customIcon={<CalendarIcon />} |
49 | | - />`, |
50 | | - component: ( |
51 | | - <TimelineLayout |
52 | | - items={timelineData} |
53 | | - size="lg" |
54 | | - iconColor="primary" |
55 | | - customIcon={<Calendar />} |
56 | | - /> |
57 | | - ), |
58 | | - }, |
59 | | - animated: { |
60 | | - name: 'Animated', |
61 | | - code: `<TimelineLayout |
62 | | - items={timelineData} |
63 | | - size="md" |
64 | | - animate={true} |
65 | | - />`, |
66 | | - component: <TimelineLayout items={timelineData} size="md" animate={true} />, |
67 | | - }, |
68 | | -}; |
69 | | - |
70 | | - |
| 1 | +import { Hero, Sidebar, Installation, Usage, Examples } from '@/components/sections'; |
71 | 2 |
|
72 | 3 | export default function Home() { |
73 | 4 | return ( |
74 | 5 | <div className="container flex min-h-screen w-full flex-col space-y-8 pb-16 pt-6 md:flex-row md:space-x-8 md:space-y-0 md:px-8"> |
75 | | - {/* Sidebar */} |
76 | | - <aside className="flex-shrink-0 md:w-64"> |
77 | | - <div className="sticky top-6"> |
78 | | - <div className="space-y-4"> |
79 | | - <div className="flex items-center justify-between"> |
80 | | - <Link href="#" className="text-2xl font-bold"> |
81 | | - shadcn-timeline |
82 | | - </Link> |
83 | | - <div className="flex items-center gap-2"> |
84 | | - <ThemeToggle /> |
85 | | - <Link |
86 | | - href="https://github.com/timDeHof/shadcn-timeline" |
87 | | - className={cn(buttonVariants({ variant: 'ghost', size: 'icon' }))} |
88 | | - > |
89 | | - <Github className="size-5" /> |
90 | | - </Link> |
91 | | - </div> |
92 | | - </div> |
93 | | - <nav className="flex flex-col space-y-2"> |
94 | | - <Link href="#installation" className="text-muted-foreground hover:text-foreground"> |
95 | | - Installation |
96 | | - </Link> |
97 | | - <Link href="#usage" className="text-muted-foreground hover:text-foreground"> |
98 | | - Usage |
99 | | - </Link> |
100 | | - <Link href="#examples" className="text-muted-foreground hover:text-foreground"> |
101 | | - Examples |
102 | | - </Link> |
103 | | - </nav> |
104 | | - </div> |
105 | | - </div> |
106 | | - </aside> |
107 | | - |
108 | | - {/* Main content */} |
| 6 | + <Sidebar /> |
109 | 7 | <main className="flex-1 space-y-12"> |
110 | | - {/* Hero section */} |
111 | | - <div className="space-y-2"> |
112 | | - <h1 className="scroll-m-20 text-4xl font-bold tracking-tight">Timeline</h1> |
113 | | - <p className="text-lg text-muted-foreground"> |
114 | | - A customizable timeline component for displaying chronological events. |
115 | | - </p> |
116 | | - </div> |
117 | | - |
118 | | - {/* Installation section */} |
119 | | - <section id="installation" className="space-y-4"> |
120 | | - <h2 className="scroll-m-20 text-2xl font-semibold tracking-tight">Manual Installation</h2> |
121 | | - <p className="mb-4 text-muted-foreground"> |
122 | | - Copy the timeline components into your project structure: |
123 | | - </p> |
124 | | - <div className="overflow-hidden rounded-lg"> |
125 | | - <CodeBlock code={installCode} language="bash" /> |
126 | | - </div> |
127 | | - </section> |
128 | | - |
129 | | - {/* Usage section */} |
130 | | - <section id="usage" className="space-y-4"> |
131 | | - <h2 className="scroll-m-20 text-2xl font-semibold tracking-tight">Usage</h2> |
132 | | - <div className="overflow-hidden rounded-lg"> |
133 | | - <CodeBlock code={usageCode} /> |
134 | | - </div> |
135 | | - </section> |
136 | | - |
137 | | - {/* Examples section */} |
138 | | - <section id="examples" className="space-y-6"> |
139 | | - <h2 className="scroll-m-20 text-2xl font-semibold tracking-tight">Examples</h2> |
140 | | - <div className="grid gap-6"> |
141 | | - {Object.entries(examples).map(([key, example]) => ( |
142 | | - <Card key={key} id={example.name}> |
143 | | - <CardHeader> |
144 | | - <CardTitle className="scroll-m-20 text-xl font-semibold tracking-tight"> |
145 | | - {example.name} |
146 | | - </CardTitle> |
147 | | - </CardHeader> |
148 | | - <CardContent className="group relative my-4 flex flex-col space-y-2 [&_input]:max-w-xs"> |
149 | | - <Tabs defaultValue="preview" className="mr-auto w-full"> |
150 | | - <TabsList className="inline-flex h-9 w-full items-center justify-start rounded-none border-b bg-transparent p-0 text-muted-foreground"> |
151 | | - <TabsTrigger |
152 | | - value="preview" |
153 | | - className="relative inline-flex h-9 items-center justify-center whitespace-nowrap rounded-none border-b-2 border-b-transparent bg-transparent px-4 py-1 pb-3 pt-2 text-sm font-semibold text-muted-foreground shadow-none ring-offset-background transition-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:border-b-primary data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-none" |
154 | | - > |
155 | | - Preview |
156 | | - </TabsTrigger> |
157 | | - <TabsTrigger |
158 | | - value="code" |
159 | | - className="relative inline-flex h-9 items-center justify-center whitespace-nowrap rounded-none border-b-2 border-b-transparent bg-transparent px-4 py-1 pb-3 pt-2 text-sm font-semibold text-muted-foreground shadow-none ring-offset-background transition-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:border-b-primary data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-none" |
160 | | - > |
161 | | - Code |
162 | | - </TabsTrigger> |
163 | | - </TabsList> |
164 | | - <TabsContent |
165 | | - value="preview" |
166 | | - className="relative mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2" |
167 | | - > |
168 | | - <div className="w-full"> |
169 | | - <div className="flex min-h-[350px] w-full items-center justify-center"> |
170 | | - {example.component} |
171 | | - </div> |
172 | | - </div> |
173 | | - </TabsContent> |
174 | | - <TabsContent |
175 | | - value="code" |
176 | | - className="mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2" |
177 | | - > |
178 | | - <CodeBlock code={example.code} /> |
179 | | - </TabsContent> |
180 | | - </Tabs> |
181 | | - </CardContent> |
182 | | - </Card> |
183 | | - ))} |
184 | | - </div> |
185 | | - </section> |
| 8 | + <Hero /> |
| 9 | + <Installation /> |
| 10 | + <Usage /> |
| 11 | + <Examples /> |
186 | 12 | </main> |
187 | 13 | </div> |
188 | 14 | ); |
|
0 commit comments