|
| 1 | +import { Canvas, Meta, Story, ArgsTable } from '@storybook/addon-docs'; |
| 2 | +import { Customization, Codesandbox } from '../../../../.storybook/components'; |
| 3 | +import { Toast, useToastExtension } from '../../../../packages/react/src'; |
| 4 | + |
| 5 | +<Meta |
| 6 | + title="🧩Elements/Extensions/Toast" |
| 7 | + argTypes={{ |
| 8 | + title: { |
| 9 | + name: 'title', |
| 10 | + description: 'A sample of attribute title', |
| 11 | + table: {}, |
| 12 | + control: 'text' |
| 13 | + } |
| 14 | + }} |
| 15 | +/> |
| 16 | + |
| 17 | +export const Template = (args) => ( |
| 18 | + <div className="toast-example"> |
| 19 | + {(() => { |
| 20 | + window.toast = useToastExtension(); |
| 21 | + return ''; |
| 22 | + })()} |
| 23 | + <div> |
| 24 | + <Toast /> |
| 25 | + <span |
| 26 | + onClick={() => { |
| 27 | + // toast.success({ message: 'example' }) |
| 28 | + window.toast.success({ message: 'example' + Math.random() }); |
| 29 | + }} |
| 30 | + > |
| 31 | + Click me |
| 32 | + </span> |
| 33 | + </div> |
| 34 | + </div> |
| 35 | +); |
| 36 | + |
| 37 | +# Toast |
| 38 | + |
| 39 | +TODO |
| 40 | + |
| 41 | +## Showcase |
| 42 | + |
| 43 | +<Canvas> |
| 44 | + <Story |
| 45 | + name="Toast" |
| 46 | + args={{ |
| 47 | + title: 'Title of my tooltip' |
| 48 | + }} |
| 49 | + > |
| 50 | + {Template.bind({})} |
| 51 | + </Story> |
| 52 | +</Canvas> |
| 53 | + |
| 54 | +### Customization |
| 55 | + |
| 56 | +<Customization showCode={false} /> |
| 57 | + |
| 58 | +### Properties |
| 59 | + |
| 60 | +<ArgsTable story="Tooltip" /> |
| 61 | + |
| 62 | +## How to use this extension |
| 63 | + |
| 64 | +### Angular |
| 65 | + |
| 66 | +<Codesandbox |
| 67 | + extensions={['useTooltipExtension']} |
| 68 | + platform="angular" |
| 69 | + code={` |
| 70 | + <span title="Example of a tooltip">Hover me</span>`} |
| 71 | +/> |
| 72 | + |
| 73 | +### Preact |
| 74 | + |
| 75 | +<Codesandbox |
| 76 | + extensions={['useTooltipExtension']} |
| 77 | + platform="preact" |
| 78 | + code={` |
| 79 | + <span title="Example of a tooltip">Hover me</span>`} |
| 80 | +/> |
| 81 | + |
| 82 | +### Qwik |
| 83 | + |
| 84 | +<Codesandbox |
| 85 | + extensions={['useTooltipExtension']} |
| 86 | + platform="qwik" |
| 87 | + code={` |
| 88 | + <span title="Example of a tooltip">Hover me</span>`} |
| 89 | +/> |
| 90 | + |
| 91 | +### React |
| 92 | + |
| 93 | +<Codesandbox |
| 94 | + extensions={['useTooltipExtension']} |
| 95 | + platform="react" |
| 96 | + code={` |
| 97 | + <span title="Example of a tooltip">Hover me</span>`} |
| 98 | +/> |
| 99 | + |
| 100 | +### Solid |
| 101 | + |
| 102 | +<Codesandbox |
| 103 | + extensions={['useTooltipExtension']} |
| 104 | + platform="solid" |
| 105 | + code={` |
| 106 | + <span title="Example of a tooltip">Hover me</span>`} |
| 107 | +/> |
| 108 | + |
| 109 | +### Svelte |
| 110 | + |
| 111 | +<Codesandbox |
| 112 | + extensions={['useTooltipExtension']} |
| 113 | + platform="svelte" |
| 114 | + code={` |
| 115 | + <span title="Example of a tooltip">Hover me</span>`} |
| 116 | +/> |
| 117 | + |
| 118 | +### Vue |
| 119 | + |
| 120 | +<Codesandbox |
| 121 | + extensions={['useTooltipExtension']} |
| 122 | + platform="vue" |
| 123 | + code={` |
| 124 | + <span title="Example of a tooltip">Hover me</span>`} |
| 125 | +/> |
| 126 | + |
| 127 | +### Web Components |
| 128 | + |
| 129 | +<Codesandbox |
| 130 | + extensions={['useTooltipExtension']} |
| 131 | + platform="webcomponents" |
| 132 | + code={`<span title="Example of a tooltip">Hover me</span>`} |
| 133 | +/> |
0 commit comments