forked from deriv-com/ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPageLayout.stories.tsx
88 lines (83 loc) · 2.86 KB
/
PageLayout.stories.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import React from "react";
import type { Meta, StoryObj } from "@storybook/react";
import { PageLayout } from "../../lib/components/PageLayout";
const Pane: React.FC<React.PropsWithChildren<{ name: string }>> = ({
children,
name,
}) => {
return (
<div
style={{
display: "flex",
flexDirection: "column",
border: "solid 1px black",
}}
>
<span style={{ fontSize: "xx-large", fontWeight: "bold" }}>
{name} Pane
</span>
<span>{children}</span>
</div>
);
};
const meta = {
title: "Components/PageLayout",
component: PageLayout,
args: {
sidebar: (
<Pane name="Left">
<div style={{ fontWeight: "bold" }}>
*This pane is hidden in mobile view.
</div>
The content on the left. Change the preview size to see mobile
view.
</Pane>
),
children: (
<Pane name="Content">
<div style={{ fontWeight: "bold" }}>
The content is rendered here. The content can be passed as
children.
</div>
<div style={{ textWrap: "wrap" }}>
Lorem Ipsum is simply dummy text of the printing and
typesetting industry. Lorem Ipsum has been the industry's
standard dummy text ever since the 1500s, when an unknown
printer took a galley of type and scrambled it to make a
type specimen book. It has survived not only five centuries,
but also the leap into electronic typesetting, remaining
essentially unchanged. It was popularised in the 1960s with
the release of Letraset sheets containing Lorem Ipsum
passages, and more recently with desktop publishing software
like Aldus PageMaker including versions of Lorem Ipsum.
</div>
</Pane>
),
},
argTypes: {
sidebar: {
control: false,
description:
"JSX element to be rendered on the left of the content as render-prop.",
},
children: {
control: false,
description: "Children to be rendered as the content.",
},
},
parameters: {
layout: "centered",
},
tags: ["autodocs"],
render: ({ children, sidebar }) => (
<PageLayout sidebar={sidebar}>
{children}
</PageLayout>
),
} satisfies Meta<typeof PageLayout>;
export default meta;
type Story = StoryObj<typeof meta>;
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
export const Default: Story = {
name: "PageLayout",
};