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