2024-09-10 11:25:52 +00:00
|
|
|
import type { Meta } from "@storybook/react";
|
|
|
|
import { useState } from "react";
|
|
|
|
import { Sheets } from "../src/components/Sheets/Sheets";
|
|
|
|
import { fn } from "@storybook/test";
|
|
|
|
|
|
|
|
const meta = {
|
|
|
|
title: "Overlays/Sheets",
|
|
|
|
component: Sheets,
|
|
|
|
parameters: {
|
2024-09-20 09:20:00 +00:00
|
|
|
layout: "fullscreen",
|
2024-09-10 11:25:52 +00:00
|
|
|
},
|
2024-09-20 09:20:00 +00:00
|
|
|
|
2024-09-10 11:25:52 +00:00
|
|
|
tags: ["autodocs"],
|
|
|
|
argTypes: {},
|
|
|
|
args: {
|
|
|
|
onClose: fn(),
|
|
|
|
},
|
|
|
|
} satisfies Meta<typeof Sheets>;
|
|
|
|
|
|
|
|
export default meta;
|
|
|
|
|
|
|
|
const DefaultTemplate = (props: { onClose: () => void }) => {
|
|
|
|
const [open, setOpen] = useState(false);
|
|
|
|
|
|
|
|
const onClick = () => setOpen(true);
|
|
|
|
|
|
|
|
const onClose = () => {
|
|
|
|
props.onClose();
|
|
|
|
setOpen(false);
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
2024-09-20 09:20:00 +00:00
|
|
|
<div style={{ padding: "6rem", position: "relative", overflow: "hidden" }}>
|
2024-09-10 11:25:52 +00:00
|
|
|
<button onClick={onClick}>Make Sheets</button>
|
|
|
|
|
|
|
|
<Sheets open={open} onClose={onClose}>
|
|
|
|
<div
|
|
|
|
style={{
|
|
|
|
height: "100%",
|
|
|
|
width: "100%",
|
|
|
|
display: "flex",
|
|
|
|
alignItems: "center",
|
|
|
|
justifyContent: "center",
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<span>Hello world</span>
|
|
|
|
</div>
|
|
|
|
</Sheets>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export const Default = DefaultTemplate.bind({});
|