2021-03-03 15:09:00 +00:00
|
|
|
import React, { useState } from "react";
|
2021-03-01 14:58:42 +00:00
|
|
|
|
|
|
|
import Backdrop from "./";
|
2020-10-16 13:16:01 +00:00
|
|
|
import Button from "../button";
|
2019-07-15 08:11:13 +00:00
|
|
|
|
2021-03-01 14:58:42 +00:00
|
|
|
export default {
|
|
|
|
title: "Components/Backdrop",
|
|
|
|
component: Backdrop,
|
|
|
|
argTypes: {
|
|
|
|
visible: {
|
|
|
|
description: "Display or not",
|
|
|
|
},
|
|
|
|
zIndex: {
|
|
|
|
description: "CSS z-index",
|
|
|
|
},
|
|
|
|
className: { description: "Accepts class" },
|
|
|
|
id: { description: "Accepts id" },
|
|
|
|
style: { description: "Accepts CSS style" },
|
|
|
|
withBackground: {
|
|
|
|
description:
|
|
|
|
"The background is not displayed if the viewport width is less than 1024, set it to true for display",
|
|
|
|
},
|
|
|
|
isAside: { description: "Must be true if used with Aside component" },
|
|
|
|
onClick: { action: "On Hide", table: { disable: true } },
|
|
|
|
},
|
|
|
|
parameters: {
|
|
|
|
docs: {
|
|
|
|
description: {
|
|
|
|
component: "Backdrop for displaying modal dialogs or other components",
|
|
|
|
},
|
|
|
|
source: {
|
|
|
|
code: `
|
|
|
|
import Backdrop from "@appserver/components/backdrop";
|
|
|
|
|
|
|
|
<Backdrop visible={true} zIndex={200}/>`,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-03-03 15:09:00 +00:00
|
|
|
};
|
2021-03-01 14:58:42 +00:00
|
|
|
|
2021-03-03 15:09:00 +00:00
|
|
|
const Template = (args) => {
|
|
|
|
const [isVisible, setIsVisible] = useState(args.visible);
|
|
|
|
const toggleVisible = () => setIsVisible(!isVisible);
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Button
|
|
|
|
label="Show Backdrop"
|
|
|
|
primary
|
|
|
|
size="medium"
|
|
|
|
onClick={toggleVisible}
|
|
|
|
/>
|
|
|
|
<Backdrop
|
|
|
|
{...args}
|
|
|
|
visible={isVisible}
|
|
|
|
onClick={(e) => {
|
|
|
|
args.onClick(e);
|
|
|
|
toggleVisible(false);
|
2021-03-01 14:58:42 +00:00
|
|
|
}}
|
2021-03-03 15:09:00 +00:00
|
|
|
/>
|
|
|
|
</>
|
|
|
|
);
|
2021-03-01 14:58:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export const Default = Template.bind({});
|