|
| 1 | +import type { Meta, StoryObj } from "@storybook/react-vite" |
| 2 | +import { |
| 3 | + Alert02Icon, |
| 4 | + CheckmarkCircle02Icon, |
| 5 | + InformationCircleIcon |
| 6 | +} from "@hugeicons/core-free-icons" |
| 7 | +import { HugeiconsIcon } from "@hugeicons/react" |
| 8 | + |
| 9 | +import { Callout, CalloutDescription, CalloutIcon } from "@conty/ui" |
| 10 | + |
| 11 | +const meta = { |
| 12 | + title: "Components/Callout", |
| 13 | + component: Callout, |
| 14 | + tags: ["autodocs"], |
| 15 | + parameters: { |
| 16 | + controls: { |
| 17 | + include: ["variant", "size"] |
| 18 | + } |
| 19 | + }, |
| 20 | + argTypes: { |
| 21 | + variant: { |
| 22 | + control: "select", |
| 23 | + options: ["default", "info", "success", "warning", "destructive"] |
| 24 | + }, |
| 25 | + size: { |
| 26 | + control: "select", |
| 27 | + options: ["sm", "md", "lg"] |
| 28 | + } |
| 29 | + } |
| 30 | +} satisfies Meta<typeof Callout> |
| 31 | + |
| 32 | +export default meta |
| 33 | + |
| 34 | +type Story = StoryObj<typeof meta> |
| 35 | + |
| 36 | +function SemanticCallouts() { |
| 37 | + return ( |
| 38 | + <> |
| 39 | + <Callout variant="info"> |
| 40 | + <CalloutIcon> |
| 41 | + <HugeiconsIcon icon={InformationCircleIcon} size={20} strokeWidth={1.8} /> |
| 42 | + </CalloutIcon> |
| 43 | + <CalloutDescription> |
| 44 | + A new Frosted-UI update is available and ready to install.{" "} |
| 45 | + <a href="#" onClick={(event) => event.preventDefault()}> |
| 46 | + Learn what changed |
| 47 | + </a> |
| 48 | + . |
| 49 | + </CalloutDescription> |
| 50 | + </Callout> |
| 51 | + <Callout variant="success"> |
| 52 | + <CalloutIcon> |
| 53 | + <HugeiconsIcon icon={CheckmarkCircle02Icon} size={20} strokeWidth={1.8} /> |
| 54 | + </CalloutIcon> |
| 55 | + <CalloutDescription> |
| 56 | + Your changes were saved successfully and synced to the cloud.{" "} |
| 57 | + <a href="#" onClick={(event) => event.preventDefault()}> |
| 58 | + View details |
| 59 | + </a> |
| 60 | + . |
| 61 | + </CalloutDescription> |
| 62 | + </Callout> |
| 63 | + <Callout variant="warning"> |
| 64 | + <CalloutIcon> |
| 65 | + <HugeiconsIcon icon={Alert02Icon} size={20} strokeWidth={1.8} /> |
| 66 | + </CalloutIcon> |
| 67 | + <CalloutDescription> |
| 68 | + Your session will expire soon. Save your work to avoid losing data.{" "} |
| 69 | + <a href="#" onClick={(event) => event.preventDefault()}> |
| 70 | + Extend session |
| 71 | + </a> |
| 72 | + . |
| 73 | + </CalloutDescription> |
| 74 | + </Callout> |
| 75 | + <Callout variant="destructive"> |
| 76 | + <CalloutIcon> |
| 77 | + <HugeiconsIcon icon={Alert02Icon} size={20} strokeWidth={1.8} /> |
| 78 | + </CalloutIcon> |
| 79 | + <CalloutDescription> |
| 80 | + We could not complete your request. Please check your data and try again.{" "} |
| 81 | + <a href="#" onClick={(event) => event.preventDefault()}> |
| 82 | + Read troubleshooting tips |
| 83 | + </a> |
| 84 | + . |
| 85 | + </CalloutDescription> |
| 86 | + </Callout> |
| 87 | + </> |
| 88 | + ) |
| 89 | +} |
| 90 | + |
| 91 | +export const Default: Story = { |
| 92 | + render: (args) => ( |
| 93 | + <Callout {...args} className="max-w-md"> |
| 94 | + <CalloutIcon> |
| 95 | + <HugeiconsIcon icon={InformationCircleIcon} size={20} strokeWidth={1.8} /> |
| 96 | + </CalloutIcon> |
| 97 | + <CalloutDescription> |
| 98 | + You will need to upgrade to the{" "} |
| 99 | + <a href="#" onClick={(event) => event.preventDefault()}> |
| 100 | + newest Frosted-UI |
| 101 | + </a>{" "} |
| 102 | + version now. |
| 103 | + </CalloutDescription> |
| 104 | + </Callout> |
| 105 | + ) |
| 106 | +} |
| 107 | + |
| 108 | +export const Destructive: Story = { |
| 109 | + args: { |
| 110 | + variant: "destructive" |
| 111 | + }, |
| 112 | + render: (args) => ( |
| 113 | + <Callout {...args} className="max-w-md"> |
| 114 | + <CalloutIcon> |
| 115 | + <HugeiconsIcon icon={InformationCircleIcon} size={20} strokeWidth={1.8} /> |
| 116 | + </CalloutIcon> |
| 117 | + <CalloutDescription> |
| 118 | + We could not complete your request. Please check your data and try again. |
| 119 | + </CalloutDescription> |
| 120 | + </Callout> |
| 121 | + ) |
| 122 | +} |
| 123 | + |
| 124 | +export const SemanticColors: Story = { |
| 125 | + render: () => ( |
| 126 | + <div className="flex w-full max-w-2xl flex-col gap-4"> |
| 127 | + <SemanticCallouts /> |
| 128 | + </div> |
| 129 | + ) |
| 130 | +} |
| 131 | + |
| 132 | +export const Sizes: Story = { |
| 133 | + name: "Size Scale", |
| 134 | + render: () => ( |
| 135 | + <div className="flex w-full max-w-2xl flex-col gap-4"> |
| 136 | + <Callout size="sm"> |
| 137 | + <CalloutIcon> |
| 138 | + <HugeiconsIcon icon={InformationCircleIcon} size={16} strokeWidth={1.8} /> |
| 139 | + </CalloutIcon> |
| 140 | + <CalloutDescription> |
| 141 | + Small callout for compact contexts and supporting messages. |
| 142 | + </CalloutDescription> |
| 143 | + </Callout> |
| 144 | + <Callout size="md"> |
| 145 | + <CalloutIcon> |
| 146 | + <HugeiconsIcon icon={InformationCircleIcon} size={20} strokeWidth={1.8} /> |
| 147 | + </CalloutIcon> |
| 148 | + <CalloutDescription> |
| 149 | + Medium callout as the default option for most product screens. |
| 150 | + </CalloutDescription> |
| 151 | + </Callout> |
| 152 | + <Callout size="lg"> |
| 153 | + <CalloutIcon> |
| 154 | + <HugeiconsIcon icon={InformationCircleIcon} size={24} strokeWidth={1.8} /> |
| 155 | + </CalloutIcon> |
| 156 | + <CalloutDescription> |
| 157 | + Large callout for stronger emphasis in onboarding or key updates. |
| 158 | + </CalloutDescription> |
| 159 | + </Callout> |
| 160 | + </div> |
| 161 | + ) |
| 162 | +} |
0 commit comments