|
| 1 | +import { Badge } from '@/components/ui/badge'; |
| 2 | +import { Button } from '@/components/ui/button'; |
| 3 | +import { InputText } from '@/components/ui/inputtext'; |
| 4 | +import { Label } from '@/components/ui/label'; |
| 5 | +import { Switch } from '@/components/ui/switch'; |
| 6 | +import { Tabs, TabsList, TabsPanel, TabsPanels, TabsTab } from '@/components/ui/tabs'; |
| 7 | +import { Cog } from '@primeicons/react/cog'; |
| 8 | +import { CreditCard } from '@primeicons/react/credit-card'; |
| 9 | +import { User } from '@primeicons/react/user'; |
| 10 | + |
| 11 | +const tabs = [ |
| 12 | + { |
| 13 | + id: 'tab1', |
| 14 | + title: 'Account Info', |
| 15 | + icon: User, |
| 16 | + content: 'Update your personal information such as name, email address, and profile picture.' |
| 17 | + }, |
| 18 | + { |
| 19 | + id: 'tab2', |
| 20 | + title: 'Payment', |
| 21 | + icon: CreditCard, |
| 22 | + badge: 'New', |
| 23 | + content: 'Manage your subscription plan, view invoices, and update your payment method.' |
| 24 | + }, |
| 25 | + { |
| 26 | + id: 'tab3', |
| 27 | + title: 'Preferences', |
| 28 | + icon: Cog, |
| 29 | + content: 'Customize how the application looks and behaves to match your personal preferences.' |
| 30 | + } |
| 31 | +]; |
| 32 | + |
| 33 | +export default function TemplateDemo() { |
| 34 | + return ( |
| 35 | + <Tabs defaultValue="tab1" className="max-w-md mx-auto"> |
| 36 | + <TabsList> |
| 37 | + {tabs.map((tab) => ( |
| 38 | + <TabsTab key={tab.id} value={tab.id} className="flex items-center gap-2"> |
| 39 | + <tab.icon /> |
| 40 | + {tab.title} |
| 41 | + {tab.badge && <Badge size="small">{tab.badge}</Badge>} |
| 42 | + </TabsTab> |
| 43 | + ))} |
| 44 | + </TabsList> |
| 45 | + <TabsPanels> |
| 46 | + <TabsPanel value="tab1"> |
| 47 | + <p className="mt-2 mb-8 text-surface-500">Update your personal information such as name, email address, and profile picture.</p> |
| 48 | + <form> |
| 49 | + <div className="space-y-4"> |
| 50 | + <div className="flex flex-col gap-1"> |
| 51 | + <Label htmlFor="username">Username</Label> |
| 52 | + <InputText id="username" placeholder="john.doe" /> |
| 53 | + </div> |
| 54 | + <div className="flex flex-col gap-1"> |
| 55 | + <Label htmlFor="email">Email</Label> |
| 56 | + <InputText id="email" placeholder="john.doe@example.com" /> |
| 57 | + </div> |
| 58 | + </div> |
| 59 | + <Button className="mt-8 w-fit">Save Changes</Button> |
| 60 | + </form> |
| 61 | + </TabsPanel> |
| 62 | + <TabsPanel value="tab2"> |
| 63 | + <p className="mt-2 mb-8 text-surface-500">Manage your subscription plan, view invoices, and update your payment method.</p> |
| 64 | + <form> |
| 65 | + <div className="space-y-4"> |
| 66 | + <div className="flex flex-col gap-1"> |
| 67 | + <Label htmlFor="cardName">Cardholder Name</Label> |
| 68 | + <InputText id="cardName" placeholder="John Doe" /> |
| 69 | + </div> |
| 70 | + <div className="flex flex-col gap-1"> |
| 71 | + <Label htmlFor="cardNumber">Card Number</Label> |
| 72 | + <InputText id="cardNumber" placeholder="0000 0000 0000 0000" /> |
| 73 | + </div> |
| 74 | + <div className="flex flex-col gap-1"> |
| 75 | + <Label htmlFor="expiryDate">Expiry Date</Label> |
| 76 | + <InputText id="expiryDate" placeholder="MM/YY" /> |
| 77 | + </div> |
| 78 | + </div> |
| 79 | + <Button className="mt-8 w-fit">Update Payment</Button> |
| 80 | + </form> |
| 81 | + </TabsPanel> |
| 82 | + <TabsPanel value="tab3"> |
| 83 | + <p className="mt-2 mb-8 text-surface-500">Customize how the application looks and behaves to match your personal preferences.</p> |
| 84 | + <form> |
| 85 | + <div className="space-y-4"> |
| 86 | + <div className="flex items-center justify-between"> |
| 87 | + <Label htmlFor="darkMode">Dark Mode</Label> |
| 88 | + <Switch inputId="darkMode" /> |
| 89 | + </div> |
| 90 | + <div className="flex items-center justify-between"> |
| 91 | + <Label htmlFor="emailNotifications">Email Notifications</Label> |
| 92 | + <Switch inputId="emailNotifications" defaultChecked /> |
| 93 | + </div> |
| 94 | + <div className="flex items-center justify-between"> |
| 95 | + <Label htmlFor="desktopNotifications">Desktop Notifications</Label> |
| 96 | + <Switch inputId="desktopNotifications" /> |
| 97 | + </div> |
| 98 | + </div> |
| 99 | + <Button className="w-fit mt-8 ml-auto mr-0">Save Preferences</Button> |
| 100 | + </form> |
| 101 | + </TabsPanel> |
| 102 | + </TabsPanels> |
| 103 | + </Tabs> |
| 104 | + ); |
| 105 | +} |
0 commit comments