Skip to content

Commit 65b7d9b

Browse files
authored
docs: fix alert stories
1 parent d7cb946 commit 65b7d9b

File tree

2 files changed

+90
-91
lines changed

2 files changed

+90
-91
lines changed
Lines changed: 86 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,86 @@
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&#39;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&#39;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+
};

test/__snapshots__/Storybook.test.tsx.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ exports[`Stories Snapshots Documentazione/Componenti/Alert _EsempiInterattivi 1`
583583
class="alert alert-success fade"
584584
role="alert"
585585
>
586-
Questo è un alert di
586+
Questo è un alert di
587587
<b>
588588
success
589589
</b>
@@ -599,13 +599,13 @@ exports[`Stories Snapshots Documentazione/Componenti/Alert _LinkEvidenziato 1`]
599599
role="alert"
600600
>
601601
Questo è un alert con un esempio di
602+
602603
<a
603604
class="alert-link"
604605
href="#"
605606
>
606607
link
607608
</a>
608-
evidenziato.
609609
</div>
610610
</div>
611611
`;
@@ -623,9 +623,9 @@ exports[`Stories Snapshots Documentazione/Componenti/Alert ChiusuraControllata 1
623623
type="button"
624624
/>
625625
<strong>
626-
Attenzione
626+
Attenzione:
627627
</strong>
628-
Alcuni campi inseriti sono da controllare.
628+
Alcuni campi inseriti sono da controllare.
629629
</div>
630630
</div>
631631
</div>

0 commit comments

Comments
 (0)