|
1 | | -import { Meta, StoryObj } from '@storybook/react'; |
2 | | -import React, { useState } from 'react'; |
3 | | -import { componentColor } from '../../.storybook/stories-helper'; |
4 | | -import { Alert } from '../../src'; |
5 | | - |
6 | | -const meta: Meta<typeof Alert> = { |
7 | | - title: 'Documentazione/Componenti/Alert', |
8 | | - component: Alert, |
9 | | - args: { |
10 | | - color: 'success' |
11 | | - }, |
12 | | - argTypes: { |
13 | | - color: { |
14 | | - control: 'select', |
15 | | - options: componentColor |
16 | | - } |
17 | | - } |
18 | | -}; |
19 | | - |
20 | | -export default meta; |
21 | | - |
22 | | -type Story = StoryObj<typeof Alert>; |
23 | | - |
24 | | -export const _EsempiInterattivi: Story = { |
25 | | - render: ({ ...args }) => ( |
26 | | - <Alert {...args}> |
27 | | - Questo è un alert di<b>{args.color}</b>! |
28 | | - </Alert> |
29 | | - ) |
30 | | -}; |
31 | | - |
32 | | -export const _LinkEvidenziato: Story = { |
33 | | - render: ({ ...args }) => ( |
34 | | - <Alert {...args}> |
35 | | - Questo è un alert con un esempio di |
36 | | - <a href='#' className='alert-link'> |
37 | | - link |
38 | | - </a> |
39 | | - evidenziato. |
40 | | - </Alert> |
41 | | - ), |
42 | | - args: { |
43 | | - color: 'danger' |
44 | | - } |
45 | | -}; |
46 | | - |
47 | | -export const _ContenutoAggiuntivo: Story = { |
48 | | - render: ({ ...args }) => ( |
49 | | - <Alert {...args}> |
50 | | - <h4 className='alert-heading'>Avviso di successo!</h4> |
51 | | - <p> |
52 | | - Stai leggendo questo importante messaggio di avviso di successo. Questo testo di esempio sarà più a lungo in |
53 | | - modo da poter vedere come funzioni la spaziatura all'interno di un avviso con questo tipo di contenuto. |
54 | | - </p> |
55 | | - <hr /> |
56 | | - <p className='mb-0'> |
57 | | - Quando necessario, assicurarti di inserire le utilità di margine per mantenere gli spazi equilibrati. |
58 | | - </p> |
59 | | - </Alert> |
60 | | - ) |
61 | | -}; |
62 | | - |
63 | | -const ChiusuraControllataWithHooks = ({ ...args }) => { |
64 | | - const [open, setOpen] = useState(true); |
65 | | - |
66 | | - const closeAlert = () => setOpen(false); |
67 | | - |
68 | | - return ( |
69 | | - <div> |
70 | | - <Alert {...args} isOpen={open} toggle={closeAlert}> |
71 | | - <strong>Attenzione</strong>Alcuni campi inseriti sono da controllare. |
72 | | - </Alert> |
73 | | - </div> |
74 | | - ); |
75 | | -}; |
76 | | - |
77 | | -export const ChiusuraControllata: Story = { |
78 | | - render: (args) => <ChiusuraControllataWithHooks {...args} />, |
79 | | - parameters: { |
80 | | - docs: { |
81 | | - canvas: { sourceState: 'none' } |
82 | | - } |
83 | | - }, |
84 | | - args: { |
85 | | - color: 'warning' |
86 | | - } |
87 | | -}; |
| 1 | +import { Meta, StoryObj } from '@storybook/react'; |
| 2 | +import React, { useState } from 'react'; |
| 3 | +import { componentColor } from '../../.storybook/stories-helper'; |
| 4 | +import { Alert } from '../../src'; |
| 5 | + |
| 6 | +const meta: Meta<typeof Alert> = { |
| 7 | + title: 'Documentazione/Componenti/Alert', |
| 8 | + component: Alert, |
| 9 | + args: { |
| 10 | + color: 'success' |
| 11 | + }, |
| 12 | + argTypes: { |
| 13 | + color: { |
| 14 | + control: 'select', |
| 15 | + options: componentColor |
| 16 | + } |
| 17 | + } |
| 18 | +}; |
| 19 | + |
| 20 | +export default meta; |
| 21 | + |
| 22 | +type Story = StoryObj<typeof Alert>; |
| 23 | + |
| 24 | +export const _EsempiInterattivi: Story = { |
| 25 | + render: ({ ...args }) => ( |
| 26 | + <Alert {...args}> |
| 27 | + Questo è un alert di <b>{args.color}</b>! |
| 28 | + </Alert> |
| 29 | + ) |
| 30 | +}; |
| 31 | + |
| 32 | +export const _LinkEvidenziato: Story = { |
| 33 | + render: ({ ...args }) => ( |
| 34 | + <Alert {...args}> |
| 35 | + Questo è un alert con un esempio di{' '} |
| 36 | + <a href='#' className='alert-link'> |
| 37 | + link |
| 38 | + </a> |
| 39 | + </Alert> |
| 40 | + ), |
| 41 | + args: { |
| 42 | + color: 'danger' |
| 43 | + } |
| 44 | +}; |
| 45 | + |
| 46 | +export const _ContenutoAggiuntivo: Story = { |
| 47 | + render: ({ ...args }) => ( |
| 48 | + <Alert {...args}> |
| 49 | + <h4 className='alert-heading'>Avviso di successo!</h4> |
| 50 | + <p> |
| 51 | + Stai leggendo questo importante messaggio di avviso di successo. Questo testo di esempio sarà più a lungo in |
| 52 | + modo da poter vedere come funzioni la spaziatura all'interno di un avviso con questo tipo di contenuto. |
| 53 | + </p> |
| 54 | + <hr /> |
| 55 | + <p className='mb-0'> |
| 56 | + Quando necessario, assicurarti di inserire le utilità di margine per mantenere gli spazi equilibrati. |
| 57 | + </p> |
| 58 | + </Alert> |
| 59 | + ) |
| 60 | +}; |
| 61 | + |
| 62 | +const ChiusuraControllataWithHooks = ({ ...args }) => { |
| 63 | + const [open, setOpen] = useState(true); |
| 64 | + |
| 65 | + const closeAlert = () => setOpen(false); |
| 66 | + |
| 67 | + return ( |
| 68 | + <div> |
| 69 | + <Alert {...args} isOpen={open} toggle={closeAlert}> |
| 70 | + <strong>Attenzione:</strong> Alcuni campi inseriti sono da controllare. |
| 71 | + </Alert> |
| 72 | + </div> |
| 73 | + ); |
| 74 | +}; |
| 75 | + |
| 76 | +export const ChiusuraControllata: Story = { |
| 77 | + render: (args) => <ChiusuraControllataWithHooks {...args} />, |
| 78 | + parameters: { |
| 79 | + docs: { |
| 80 | + canvas: { sourceState: 'none' } |
| 81 | + } |
| 82 | + }, |
| 83 | + args: { |
| 84 | + color: 'warning' |
| 85 | + } |
| 86 | +}; |
0 commit comments