|
| 1 | +import { Card, CardContent, CardHeader } from '@/components/ui/card' |
| 2 | +import { cn } from '@/lib/utils' |
| 3 | +import { Calendar, LucideIcon, MapIcon } from 'lucide-react' |
| 4 | +import Image from 'next/image' |
| 5 | +import { ReactNode } from 'react' |
| 6 | + |
| 7 | +export default function Features() { |
| 8 | + return ( |
| 9 | + <section className="bg-zinc-50 py-16 md:py-32 dark:bg-transparent"> |
| 10 | + <div className="mx-auto max-w-2xl px-6 lg:max-w-5xl"> |
| 11 | + <div className="mx-auto grid gap-4 lg:grid-cols-2"> |
| 12 | + <FeatureCard> |
| 13 | + <CardHeader className="pb-3"> |
| 14 | + <CardHeading |
| 15 | + icon={MapIcon} |
| 16 | + title="Real time location tracking" |
| 17 | + description="Advanced tracking system, Instantly locate all your assets." |
| 18 | + /> |
| 19 | + </CardHeader> |
| 20 | + |
| 21 | + <div className="relative mb-6 border-t border-dashed sm:mb-0"> |
| 22 | + <div className="absolute inset-0 [background:radial-gradient(125%_125%_at_50%_0%,transparent_40%,var(--color-blue-600),var(--color-white)_100%)]"></div> |
| 23 | + <div className="aspect-76/59 p-1 px-6"> |
| 24 | + <DualModeImage |
| 25 | + darkSrc="/payments.png" |
| 26 | + lightSrc="/payments-light.png" |
| 27 | + alt="payments illustration" |
| 28 | + width={1207} |
| 29 | + height={929} |
| 30 | + /> |
| 31 | + </div> |
| 32 | + </div> |
| 33 | + </FeatureCard> |
| 34 | + |
| 35 | + <FeatureCard> |
| 36 | + <CardHeader className="pb-3"> |
| 37 | + <CardHeading |
| 38 | + icon={Calendar} |
| 39 | + title="Advanced Scheduling" |
| 40 | + description="Scheduling system, Instantly locate all your assets." |
| 41 | + /> |
| 42 | + </CardHeader> |
| 43 | + |
| 44 | + <CardContent> |
| 45 | + <div className="relative mb-6 sm:mb-0"> |
| 46 | + <div className="absolute -inset-6 [background:radial-gradient(50%_50%_at_75%_50%,transparent,var(--color-background)_100%)]"></div> |
| 47 | + <div className="aspect-76/59 border"> |
| 48 | + <DualModeImage |
| 49 | + darkSrc="/origin-cal-dark.png" |
| 50 | + lightSrc="/origin-cal.png" |
| 51 | + alt="calendar illustration" |
| 52 | + width={1207} |
| 53 | + height={929} |
| 54 | + /> |
| 55 | + </div> |
| 56 | + </div> |
| 57 | + </CardContent> |
| 58 | + </FeatureCard> |
| 59 | + |
| 60 | + <FeatureCard className="p-6 lg:col-span-2"> |
| 61 | + <p className="mx-auto my-6 max-w-md text-balance text-center text-2xl font-semibold">Smart scheduling with automated reminders for maintenance.</p> |
| 62 | + |
| 63 | + <div className="flex justify-center gap-6 overflow-hidden"> |
| 64 | + <CircularUI |
| 65 | + label="Inclusion" |
| 66 | + circles={[{ pattern: 'border' }, { pattern: 'border' }]} |
| 67 | + /> |
| 68 | + |
| 69 | + <CircularUI |
| 70 | + label="Inclusion" |
| 71 | + circles={[{ pattern: 'none' }, { pattern: 'primary' }]} |
| 72 | + /> |
| 73 | + |
| 74 | + <CircularUI |
| 75 | + label="Join" |
| 76 | + circles={[{ pattern: 'blue' }, { pattern: 'none' }]} |
| 77 | + /> |
| 78 | + |
| 79 | + <CircularUI |
| 80 | + label="Exclusion" |
| 81 | + circles={[{ pattern: 'primary' }, { pattern: 'none' }]} |
| 82 | + className="hidden sm:block" |
| 83 | + /> |
| 84 | + </div> |
| 85 | + </FeatureCard> |
| 86 | + </div> |
| 87 | + </div> |
| 88 | + </section> |
| 89 | + ) |
| 90 | +} |
| 91 | + |
| 92 | +interface FeatureCardProps { |
| 93 | + children: ReactNode |
| 94 | + className?: string |
| 95 | +} |
| 96 | + |
| 97 | +const FeatureCard = ({ children, className }: FeatureCardProps) => ( |
| 98 | + <Card className={cn('group relative rounded-none shadow-zinc-950/5', className)}> |
| 99 | + <CardDecorator /> |
| 100 | + {children} |
| 101 | + </Card> |
| 102 | +) |
| 103 | + |
| 104 | +const CardDecorator = () => ( |
| 105 | + <> |
| 106 | + <span className="border-primary absolute -left-px -top-px block size-2 border-l-2 border-t-2"></span> |
| 107 | + <span className="border-primary absolute -right-px -top-px block size-2 border-r-2 border-t-2"></span> |
| 108 | + <span className="border-primary absolute -bottom-px -left-px block size-2 border-b-2 border-l-2"></span> |
| 109 | + <span className="border-primary absolute -bottom-px -right-px block size-2 border-b-2 border-r-2"></span> |
| 110 | + </> |
| 111 | +) |
| 112 | + |
| 113 | +interface CardHeadingProps { |
| 114 | + icon: LucideIcon |
| 115 | + title: string |
| 116 | + description: string |
| 117 | +} |
| 118 | + |
| 119 | +const CardHeading = ({ icon: Icon, title, description }: CardHeadingProps) => ( |
| 120 | + <div className="p-6"> |
| 121 | + <span className="text-muted-foreground flex items-center gap-2"> |
| 122 | + <Icon className="size-4" /> |
| 123 | + {title} |
| 124 | + </span> |
| 125 | + <p className="mt-8 text-2xl font-semibold">{description}</p> |
| 126 | + </div> |
| 127 | +) |
| 128 | + |
| 129 | +interface DualModeImageProps { |
| 130 | + darkSrc: string |
| 131 | + lightSrc: string |
| 132 | + alt: string |
| 133 | + width: number |
| 134 | + height: number |
| 135 | + className?: string |
| 136 | +} |
| 137 | + |
| 138 | +const DualModeImage = ({ darkSrc, lightSrc, alt, width, height, className }: DualModeImageProps) => ( |
| 139 | + <> |
| 140 | + <Image |
| 141 | + src={darkSrc} |
| 142 | + className={cn('hidden dark:block', className)} |
| 143 | + alt={`${alt} dark`} |
| 144 | + width={width} |
| 145 | + height={height} |
| 146 | + /> |
| 147 | + <Image |
| 148 | + src={lightSrc} |
| 149 | + className={cn('shadow dark:hidden', className)} |
| 150 | + alt={`${alt} light`} |
| 151 | + width={width} |
| 152 | + height={height} |
| 153 | + /> |
| 154 | + </> |
| 155 | +) |
| 156 | + |
| 157 | +interface CircleConfig { |
| 158 | + pattern: 'none' | 'border' | 'primary' | 'blue' |
| 159 | +} |
| 160 | + |
| 161 | +interface CircularUIProps { |
| 162 | + label: string |
| 163 | + circles: CircleConfig[] |
| 164 | + className?: string |
| 165 | +} |
| 166 | + |
| 167 | +const CircularUI = ({ label, circles, className }: CircularUIProps) => ( |
| 168 | + <div className={className}> |
| 169 | + <div className="bg-linear-to-b from-border size-fit rounded-2xl to-transparent p-px"> |
| 170 | + <div className="bg-linear-to-b from-background to-muted/25 relative flex aspect-square w-fit items-center -space-x-4 rounded-[15px] p-4"> |
| 171 | + {circles.map((circle, i) => ( |
| 172 | + <div |
| 173 | + key={i} |
| 174 | + className={cn('size-7 rounded-full border sm:size-8', { |
| 175 | + 'border-primary': circle.pattern === 'none', |
| 176 | + 'border-primary bg-[repeating-linear-gradient(-45deg,var(--color-border),var(--color-border)_1px,transparent_1px,transparent_4px)]': circle.pattern === 'border', |
| 177 | + 'border-primary bg-background bg-[repeating-linear-gradient(-45deg,var(--color-primary),var(--color-primary)_1px,transparent_1px,transparent_4px)]': circle.pattern === 'primary', |
| 178 | + 'bg-background z-1 border-blue-500 bg-[repeating-linear-gradient(-45deg,var(--color-blue-500),var(--color-blue-500)_1px,transparent_1px,transparent_4px)]': circle.pattern === 'blue', |
| 179 | + })}></div> |
| 180 | + ))} |
| 181 | + </div> |
| 182 | + </div> |
| 183 | + <span className="text-muted-foreground mt-1.5 block text-center text-sm">{label}</span> |
| 184 | + </div> |
| 185 | +) |
0 commit comments