|
1 | 1 | import type { ReactNode } from "react"; |
2 | 2 |
|
3 | 3 | import { cn } from "@/utils/cn"; |
4 | | -import { PaletteIcon } from "lucide-react"; |
5 | | - |
6 | | -import { ShadcnUI } from "@/components/ui/svgs/shadcn"; |
7 | | -import { Card, CardHeader } from "@/components/ui/card"; |
8 | | - |
9 | | -export default function Features() { |
10 | | - return ( |
11 | | - <section> |
12 | | - <div className="mx-auto grid gap-4 pt-6 lg:grid-cols-2"> |
13 | | - <FeatureCard> |
14 | | - <CardHeader> |
15 | | - <CardHeading |
16 | | - icon={<PaletteIcon size={20} />} |
17 | | - title="Customizable" |
18 | | - description="Copy, extend and modify all components and utilities" |
19 | | - /> |
20 | | - </CardHeader> |
21 | | - </FeatureCard> |
22 | | - <FeatureCard> |
23 | | - <CardHeader> |
24 | | - <CardHeading |
25 | | - icon={<ShadcnUI width={20} height={20} />} |
26 | | - title="shadcn/ui" |
27 | | - description="Add components to your shadcn registry" |
28 | | - /> |
29 | | - </CardHeader> |
30 | | - </FeatureCard> |
31 | | - </div> |
32 | | - </section> |
33 | | - ); |
34 | | -} |
| 4 | +import { BoxIcon, ClipboardIcon, HighlighterIcon } from "lucide-react"; |
| 5 | +import { ShadcnUI } from "@/components/ui/svgs"; |
35 | 6 |
|
36 | 7 | interface FeatureCardProps { |
37 | | - children: ReactNode; |
38 | | - className?: string; |
| 8 | + icon: ReactNode; |
| 9 | + title: string; |
| 10 | + description: string; |
| 11 | + children?: ReactNode; |
39 | 12 | } |
40 | 13 |
|
41 | | -const FeatureCard = ({ children, className }: FeatureCardProps) => ( |
42 | | - <Card className={cn("group relative rounded-none", className)}> |
43 | | - <CardDecorator /> |
44 | | - {children} |
45 | | - </Card> |
46 | | -); |
| 14 | +const iconSize = 24; |
| 15 | +const iconClassName = cn("text-neutral-600 dark:text-neutral-400"); |
47 | 16 |
|
48 | 17 | const CardDecorator = () => ( |
49 | 18 | <> |
50 | | - <span className="absolute -top-px -left-px block size-2 border-t-2 border-l-2 border-neutral-900 dark:border-neutral-600"></span> |
51 | | - <span className="absolute -top-px -right-px block size-2 border-t-2 border-r-2 border-neutral-900 dark:border-neutral-600"></span> |
52 | | - <span className="absolute -bottom-px -left-px block size-2 border-b-2 border-l-2 border-neutral-900 dark:border-neutral-600"></span> |
53 | | - <span className="absolute -right-px -bottom-px block size-2 border-r-2 border-b-2 border-neutral-900 dark:border-neutral-600"></span> |
| 19 | + <span className="absolute -top-px -left-px block size-2 border-t-2 border-l-2 border-neutral-400 dark:border-neutral-600"></span> |
| 20 | + <span className="absolute -top-px -right-px block size-2 border-t-2 border-r-2 border-neutral-400 dark:border-neutral-600"></span> |
| 21 | + <span className="absolute -bottom-px -left-px block size-2 border-b-2 border-l-2 border-neutral-400 dark:border-neutral-600"></span> |
| 22 | + <span className="absolute -right-px -bottom-px block size-2 border-r-2 border-b-2 border-neutral-400 dark:border-neutral-600"></span> |
54 | 23 | </> |
55 | 24 | ); |
56 | 25 |
|
57 | | -interface CardHeadingProps { |
58 | | - icon: ReactNode |
59 | | - title: string; |
60 | | - description: string; |
61 | | -} |
| 26 | +const FeatureCard = ({ |
| 27 | + icon, |
| 28 | + title, |
| 29 | + description, |
| 30 | + children, |
| 31 | +}: FeatureCardProps) => { |
| 32 | + return ( |
| 33 | + <div |
| 34 | + className={cn( |
| 35 | + "group relative", |
| 36 | + "not-prose flex flex-col", |
| 37 | + "border border-neutral-200 p-8 dark:border-neutral-800", |
| 38 | + )} |
| 39 | + > |
| 40 | + <CardDecorator /> |
| 41 | + <div className="mb-4">{icon}</div> |
| 42 | + <h2 className="font-headings text-2xl font-semibold tracking-tight text-black dark:text-white"> |
| 43 | + {title} |
| 44 | + </h2> |
| 45 | + <p className="mt-2 text-pretty text-neutral-600 dark:text-neutral-400"> |
| 46 | + {description} |
| 47 | + </p> |
| 48 | + {children} |
| 49 | + </div> |
| 50 | + ); |
| 51 | +}; |
62 | 52 |
|
63 | | -const CardHeading = ({ icon: Icon, title, description }: CardHeadingProps) => ( |
64 | | - <div className="p-3"> |
65 | | - <span className="flex items-center gap-2 text-neutral-500 dark:text-neutral-400"> |
66 | | - {Icon} |
67 | | - {title} |
68 | | - </span> |
69 | | - <p className="mt-4 text-2xl font-semibold">{description}</p> |
70 | | - </div> |
71 | | -); |
| 53 | +export default function Features() { |
| 54 | + return ( |
| 55 | + <section className="mx-auto grid gap-4 pt-6 lg:grid-cols-2"> |
| 56 | + <FeatureCard |
| 57 | + icon={<ClipboardIcon size={iconSize} className={iconClassName} />} |
| 58 | + title="Copy-Paste" |
| 59 | + description="Copy the components and utilities you need and paste them into your project. It's 100% yours." |
| 60 | + /> |
| 61 | + <FeatureCard |
| 62 | + icon={<HighlighterIcon className={iconClassName} />} |
| 63 | + title="Syntax Highlighter" |
| 64 | + description="Use Shiki or Sugar-High to add syntax highlighting to your code blocks." |
| 65 | + /> |
| 66 | + <FeatureCard |
| 67 | + icon={<BoxIcon size={iconSize} className={iconClassName} />} |
| 68 | + title="Blocks" |
| 69 | + description="Built-in components to extend your code blocks with extra content and interactivity." |
| 70 | + /> |
| 71 | + <FeatureCard |
| 72 | + icon={ |
| 73 | + <ShadcnUI |
| 74 | + width={iconSize} |
| 75 | + height={iconSize} |
| 76 | + className={iconClassName} |
| 77 | + /> |
| 78 | + } |
| 79 | + title="shadcn/ui compatible" |
| 80 | + description="Add components & utilities using shadcn/ui CLI." |
| 81 | + /> |
| 82 | + </section> |
| 83 | + ); |
| 84 | +} |
0 commit comments