|
| 1 | +import React from 'react'; |
| 2 | +import type { Meta, StoryObj } from '@storybook/react'; |
| 3 | +import Tabs from '@signozhq/tabs'; |
| 4 | +import { Home, Code, Settings, Zap, BarChart3, History } from 'lucide-react'; |
| 5 | + |
| 6 | +const meta: Meta<typeof Tabs> = { |
| 7 | + title: 'Components/Tabs', |
| 8 | + component: Tabs, |
| 9 | + parameters: { |
| 10 | + layout: 'centered', |
| 11 | + backgrounds: { |
| 12 | + default: 'dark', |
| 13 | + }, |
| 14 | + controls: { |
| 15 | + disable: true, |
| 16 | + }, |
| 17 | + }, |
| 18 | + decorators: [ |
| 19 | + (Story) => ( |
| 20 | + <div className="dark p-4"> |
| 21 | + <Story /> |
| 22 | + </div> |
| 23 | + ), |
| 24 | + ], |
| 25 | +}; |
| 26 | + |
| 27 | +export default meta; |
| 28 | +type Story = StoryObj<typeof Tabs>; |
| 29 | + |
| 30 | +export const Default: Story = { |
| 31 | + args: { |
| 32 | + defaultValue: 'overview', |
| 33 | + items: [ |
| 34 | + { |
| 35 | + key: 'overview', |
| 36 | + label: <span>Overview</span>, |
| 37 | + prefixIcon: <Home size={16} />, |
| 38 | + children: ( |
| 39 | + <div className="text-vanilla-400"> |
| 40 | + <div className="text-xl font-semibold">Overview</div> |
| 41 | + <p>Overview content goes here.</p> |
| 42 | + </div> |
| 43 | + ), |
| 44 | + }, |
| 45 | + { |
| 46 | + key: 'issues', |
| 47 | + label: <span>Issues</span>, |
| 48 | + prefixIcon: <Code size={16} />, |
| 49 | + children: ( |
| 50 | + <div className="text-vanilla-400"> |
| 51 | + <div className="text-xl font-semibold">Issues</div> |
| 52 | + <p>Issues content goes here.</p> |
| 53 | + </div> |
| 54 | + ), |
| 55 | + }, |
| 56 | + { |
| 57 | + key: 'settings', |
| 58 | + label: <span>Settings</span>, |
| 59 | + prefixIcon: <Settings size={16} />, |
| 60 | + children: ( |
| 61 | + <div className="text-vanilla-400"> |
| 62 | + <div className="text-xl font-semibold">Settings</div> |
| 63 | + <p>Settings content goes here.</p> |
| 64 | + </div> |
| 65 | + ), |
| 66 | + }, |
| 67 | + ], |
| 68 | + }, |
| 69 | +}; |
| 70 | + |
| 71 | +export const WithCustomColors: Story = { |
| 72 | + args: { |
| 73 | + defaultValue: 'overview', |
| 74 | + slideColor: 'sienna-500', |
| 75 | + tabColor: 'sienna-500', |
| 76 | + hoverColor: 'sienna-500', |
| 77 | + items: [ |
| 78 | + { |
| 79 | + key: 'overview', |
| 80 | + label: <span>Overview</span>, |
| 81 | + prefixIcon: <Home size={16} />, |
| 82 | + children: ( |
| 83 | + <div className="text-vanilla-400"> |
| 84 | + <div className="text-xl font-semibold">Overview</div> |
| 85 | + <p>Overview content goes here.</p> |
| 86 | + </div> |
| 87 | + ), |
| 88 | + }, |
| 89 | + { |
| 90 | + key: 'issues', |
| 91 | + label: <span>Issues</span>, |
| 92 | + prefixIcon: <Code size={16} />, |
| 93 | + children: ( |
| 94 | + <div className="text-vanilla-400"> |
| 95 | + <div className="text-xl font-semibold">Issues</div> |
| 96 | + <p>Issues content goes here.</p> |
| 97 | + </div> |
| 98 | + ), |
| 99 | + }, |
| 100 | + { |
| 101 | + key: 'autofix', |
| 102 | + label: <span>Autofix</span>, |
| 103 | + prefixIcon: <Zap size={16} />, |
| 104 | + children: ( |
| 105 | + <div className="text-vanilla-400"> |
| 106 | + <div className="text-xl font-semibold">Autofix</div> |
| 107 | + <p>Autofix content goes here.</p> |
| 108 | + </div> |
| 109 | + ), |
| 110 | + }, |
| 111 | + { |
| 112 | + key: 'metrics', |
| 113 | + label: <span>Metrics</span>, |
| 114 | + prefixIcon: <BarChart3 size={16} />, |
| 115 | + children: ( |
| 116 | + <div className="text-vanilla-400"> |
| 117 | + <div className="text-xl font-semibold">Metrics</div> |
| 118 | + <p>Metrics content goes here.</p> |
| 119 | + </div> |
| 120 | + ), |
| 121 | + }, |
| 122 | + ], |
| 123 | + }, |
| 124 | +}; |
| 125 | + |
| 126 | +export const WithIconsAndDisabled: Story = { |
| 127 | + args: { |
| 128 | + defaultValue: 'overview', |
| 129 | + items: [ |
| 130 | + { |
| 131 | + key: 'overview', |
| 132 | + label: <span>Overview</span>, |
| 133 | + prefixIcon: <Home size={16} />, |
| 134 | + suffixIcon: <Code size={16} />, |
| 135 | + children: ( |
| 136 | + <div className="text-vanilla-400"> |
| 137 | + <div className="text-xl font-semibold">Overview</div> |
| 138 | + <p>Overview content goes here.</p> |
| 139 | + </div> |
| 140 | + ), |
| 141 | + }, |
| 142 | + { |
| 143 | + key: 'issues', |
| 144 | + label: <span>Issues</span>, |
| 145 | + prefixIcon: <Code size={16} />, |
| 146 | + disabled: true, |
| 147 | + children: ( |
| 148 | + <div className="text-vanilla-400"> |
| 149 | + <div className="text-xl font-semibold">Issues</div> |
| 150 | + <p>Issues content goes here.</p> |
| 151 | + </div> |
| 152 | + ), |
| 153 | + }, |
| 154 | + { |
| 155 | + key: 'history', |
| 156 | + label: <span>History</span>, |
| 157 | + prefixIcon: <History size={16} />, |
| 158 | + children: ( |
| 159 | + <div className="text-vanilla-400"> |
| 160 | + <div className="text-xl font-semibold">History</div> |
| 161 | + <p>History content goes here.</p> |
| 162 | + </div> |
| 163 | + ), |
| 164 | + }, |
| 165 | + ], |
| 166 | + }, |
| 167 | +}; |
0 commit comments