-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
Modal.story.tsx
66 lines (58 loc) · 1.62 KB
/
Modal.story.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
import React, { useState } from 'react';
import { Modal } from './Modal';
import { Button } from '../Button';
import { ColorInput } from '../ColorInput';
export default { title: 'Modal' };
function WrappedModal(
props: Omit<React.ComponentPropsWithoutRef<typeof Modal>, 'opened' | 'onClose'>
) {
const [opened, setOpened] = useState(false);
return (
<div style={{ padding: 50 }}>
<Button onClick={() => setOpened(true)}>Open Modal</Button>
<Modal opened={opened} onClose={() => setOpened(false)} {...props} />
</div>
);
}
const content = Array(40)
.fill(0)
.map((_, index) => (
<p key={index}>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Perspiciatis nesciunt architecto
beatae iure, aliquam laborum molestias ratione delectus sed cupiditate, nobis impedit eos vero
neque magni minima repellendus! Beatae, illo.
</p>
));
export function FullScreenWithOverflow() {
return (
<div style={{ padding: 40 }}>
<WrappedModal fullScreen>{content}</WrappedModal>
{content}
</div>
);
}
export function SizeAuto() {
return (
<div style={{ padding: 40 }}>
<WrappedModal size="auto">{content}</WrappedModal>
</div>
);
}
export function WithPageScrollbars() {
return (
<div style={{ padding: 40 }}>
<WrappedModal>Wrapped modal</WrappedModal>
{content}
</div>
);
}
export function WithPortalChildren() {
return (
<div style={{ padding: 40 }}>
<WrappedModal>
<ColorInput label="No Portal" mb="md" />
<ColorInput label="Within Portal" mb="md" withinPortal />
</WrappedModal>
</div>
);
}