Skip to content

Commit a6e1b97

Browse files
committed
[no ci] Add story for the Confirm component
1 parent 873ef5f commit a6e1b97

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import * as React from 'react';
2+
3+
import { Confirm } from './Confirm';
4+
5+
export default {
6+
title: 'ra-ui-materialui/layout/Confirm',
7+
};
8+
9+
export const BackClick = () => {
10+
const [isOpen, setIsOpen] = React.useState(false);
11+
const [isClicked, setIsClicked] = React.useState(false);
12+
13+
return (
14+
<>
15+
<button
16+
onClick={e => {
17+
setIsOpen(true);
18+
e.stopPropagation();
19+
}}
20+
>
21+
Open Dialog
22+
</button>
23+
<div
24+
onClick={() => setIsClicked(true)}
25+
style={{
26+
height: '100vh',
27+
width: '100%',
28+
backgroundColor: 'red',
29+
padding: 10,
30+
}}
31+
>
32+
<div>Back layer {isClicked ? 'clicked' : 'not Clicked'}</div>
33+
<Confirm
34+
isOpen={isOpen}
35+
title="Delete Item"
36+
content="Are you sure you want to delete this item?"
37+
confirm="Yes"
38+
confirmColor="primary"
39+
onConfirm={() => setIsOpen(false)}
40+
onClose={() => setIsOpen(false)}
41+
/>
42+
</div>
43+
</>
44+
);
45+
};

0 commit comments

Comments
 (0)