@campxdev/react-blueprint 0.1.13 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/.storybook/main.ts +4 -3
  2. package/.storybook/preview.tsx +30 -13
  3. package/package.json +3 -1
  4. package/src/components/DataDisplay/DataTable/DataTable.stories.tsx +15 -6
  5. package/src/components/DataDisplay/DataTable/DataTable.tsx +21 -25
  6. package/src/components/DataDisplay/DataTable/TablePagination.tsx +22 -0
  7. package/src/components/DataDisplay/styles.tsx +5 -0
  8. package/src/components/Layout/LayoutWrapper/LayoutWrapper.stories.tsx +47 -4
  9. package/src/components/Layout/LayoutWrapper/LayoutWrapper.tsx +41 -22
  10. package/src/components/Layout/ComponentBackground/ComponentBackground.tsx +0 -83
  11. package/src/components/Layout/ComponentBackground/DefaultBackground.tsx +0 -12
  12. package/src/components/Layout/ComponentBackground/PaperBackground.tsx +0 -12
  13. package/src/components/Layout/SideNavigation/SideNavigation.stories.tsx +0 -30
  14. package/src/components/Typography/Typography.stories.tsx +0 -95
  15. package/src/stories/Button.stories.ts +0 -52
  16. package/src/stories/Button.tsx +0 -48
  17. package/src/stories/Configure.mdx +0 -364
  18. package/src/stories/Header.stories.ts +0 -33
  19. package/src/stories/Header.tsx +0 -56
  20. package/src/stories/Page.stories.ts +0 -32
  21. package/src/stories/Page.tsx +0 -73
  22. package/src/stories/assets/accessibility.png +0 -0
  23. package/src/stories/assets/accessibility.svg +0 -5
  24. package/src/stories/assets/addon-library.png +0 -0
  25. package/src/stories/assets/assets.png +0 -0
  26. package/src/stories/assets/avif-test-image.avif +0 -0
  27. package/src/stories/assets/context.png +0 -0
  28. package/src/stories/assets/discord.svg +0 -15
  29. package/src/stories/assets/docs.png +0 -0
  30. package/src/stories/assets/figma-plugin.png +0 -0
  31. package/src/stories/assets/github.svg +0 -3
  32. package/src/stories/assets/share.png +0 -0
  33. package/src/stories/assets/styling.png +0 -0
  34. package/src/stories/assets/testing.png +0 -0
  35. package/src/stories/assets/theming.png +0 -0
  36. package/src/stories/assets/tutorials.svg +0 -12
  37. package/src/stories/assets/youtube.svg +0 -4
  38. package/src/stories/button.css +0 -30
  39. package/src/stories/header.css +0 -32
  40. package/src/stories/page.css +0 -69
@@ -10,7 +10,8 @@ const config: StorybookConfig = {
10
10
  "@storybook/addon-essentials",
11
11
  "@chromatic-com/storybook",
12
12
  "@storybook/addon-interactions",
13
- "@storybook/addon-mdx-gfm"
13
+ "@storybook/addon-mdx-gfm",
14
+ "storybook-dark-mode",
14
15
  ],
15
16
 
16
17
  framework: {
@@ -23,7 +24,7 @@ const config: StorybookConfig = {
23
24
  staticDirs: ["../public"],
24
25
 
25
26
  typescript: {
26
- reactDocgen: "react-docgen-typescript"
27
- }
27
+ reactDocgen: "react-docgen-typescript",
28
+ },
28
29
  };
29
30
  export default config;
@@ -1,17 +1,12 @@
1
1
  import { CssBaseline } from "@mui/material";
2
2
  import type { Preview } from "@storybook/react";
3
3
  import React from "react";
4
+ import { MuiThemeProvider } from "../src/themes/MuiThemeProvider";
5
+ import { useDarkMode } from "storybook-dark-mode";
6
+ import { darkTheme } from "../src/themes/darkTheme";
7
+ import { lightTheme } from "../src/themes/lightTheme";
8
+ import { DarkColorTokens, LightColorTokens } from "../src/themes/colorTokens";
4
9
  import { BrowserRouter } from "react-router-dom";
5
- import { ComponentBackground } from "../src/components/Layout/ComponentBackground/ComponentBackground";
6
-
7
- const withThemeProvider = (Story) => (
8
- <ComponentBackground>
9
- <BrowserRouter>
10
- <Story />
11
- </BrowserRouter>
12
- <CssBaseline />
13
- </ComponentBackground>
14
- );
15
10
 
16
11
  const preview: Preview = {
17
12
  parameters: {
@@ -21,10 +16,32 @@ const preview: Preview = {
21
16
  date: /Date$/i,
22
17
  },
23
18
  },
19
+ backgrounds: {
20
+ default: "light", // name of the default background to use
21
+ values: [
22
+ { name: "light", value: LightColorTokens.background.default },
23
+ { name: "light paper", value: LightColorTokens.background.paper },
24
+ { name: "dark", value: DarkColorTokens.background.default },
25
+ { name: "dark paper", value: DarkColorTokens.background.paper },
26
+ ],
27
+ },
24
28
  },
25
-
26
- decorators: [withThemeProvider],
27
- tags: ["autodocs"]
29
+ decorators: [
30
+ (Story) => {
31
+ const isDarkMode = useDarkMode();
32
+ console.log(isDarkMode);
33
+ const theme = isDarkMode ? darkTheme : lightTheme;
34
+ return (
35
+ <BrowserRouter>
36
+ <MuiThemeProvider theme={theme}>
37
+ <CssBaseline />
38
+ <Story />
39
+ </MuiThemeProvider>
40
+ </BrowserRouter>
41
+ );
42
+ },
43
+ ],
44
+ tags: ["autodocs"],
28
45
  };
29
46
 
30
47
  export default preview;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@campxdev/react-blueprint",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "main": "./export.ts",
5
5
  "private": false,
6
6
  "dependencies": {
@@ -9,6 +9,7 @@
9
9
  "@mui/icons-material": "^5.14.11",
10
10
  "@mui/material": "^5.14.11",
11
11
  "@mui/x-data-grid": "^7.5.1",
12
+ "@storybook/addon-backgrounds": "^8.1.4",
12
13
  "@testing-library/jest-dom": "^5.14.1",
13
14
  "@testing-library/react": "^13.0.0",
14
15
  "@testing-library/user-event": "^13.2.1",
@@ -24,6 +25,7 @@
24
25
  "react-error-boundary": "^3.1.4",
25
26
  "react-router-dom": "^6.4.2",
26
27
  "react-scripts": "5.0.1",
28
+ "storybook-dark-mode": "^4.0.1",
27
29
  "typescript": "^5.3.3",
28
30
  "web-vitals": "^2.1.0"
29
31
  },
@@ -1,7 +1,6 @@
1
- import * as React from "react";
2
- import { Meta, StoryObj } from "@storybook/react";
3
- import DataTable from "./DataTable"; // Make sure the path to your component is correct
4
1
  import { GridColDef } from "@mui/x-data-grid";
2
+ import { Meta, StoryObj } from "@storybook/react";
3
+ import { DataTable } from "./DataTable"; // Make sure the path to your component is correct
5
4
 
6
5
  const columns: GridColDef[] = [
7
6
  { field: "id", headerName: "ID", width: 70 },
@@ -33,9 +32,18 @@ const rows = [
33
32
  const meta: Meta<typeof DataTable> = {
34
33
  title: "DataDisplay/DataTable",
35
34
  component: DataTable,
36
- parameters: {
37
- controls: {
38
- include: ["rows", "columns"], // Specify the controls you want to include
35
+ argTypes: {
36
+ totalCount: {
37
+ control: "number",
38
+ description: "Total Number of rows",
39
+ },
40
+ limit: {
41
+ control: "number",
42
+ description: "Total Number of rows",
43
+ },
44
+ offset: {
45
+ control: "number",
46
+ description: "Total Number of rows",
39
47
  },
40
48
  },
41
49
  };
@@ -43,6 +51,7 @@ const meta: Meta<typeof DataTable> = {
43
51
  export default meta;
44
52
  const Template: StoryObj<typeof DataTable> = {
45
53
  render: (args) => <DataTable {...args} />,
54
+
46
55
  args: {
47
56
  columns,
48
57
  rows,
@@ -1,31 +1,27 @@
1
- import * as React from "react";
2
- import { DataGrid, GridColDef, GridRowsProp } from "@mui/x-data-grid";
1
+ import { Pagination } from "@mui/material";
2
+ import {
3
+ DataGrid as MuiDataGrid,
4
+ DataGridProps as MuiDataGridProps,
5
+ } from "@mui/x-data-grid";
6
+ import { DataGridContainer } from "../styles";
3
7
 
4
- interface DataTableProps {
5
- columns: GridColDef[];
6
- rows: GridRowsProp;
7
- }
8
+ export type DataTableProps = {
9
+ limit: number;
10
+ offset: number;
11
+ totalCount: number;
12
+ } & MuiDataGridProps;
8
13
 
9
- export default function DataTable({ columns, rows }: DataTableProps) {
14
+ export const DataTable = (props: DataTableProps) => {
15
+ const pages = Math.ceil(props.totalCount / props.limit);
16
+ const currentPage = Math.ceil(props.offset / props.limit);
10
17
  return (
11
- <div style={{ height: 400, width: "100%" }}>
12
- <DataGrid
13
- rows={rows}
14
- columns={columns}
15
- initialState={{
16
- pagination: {
17
- paginationModel: { page: 0, pageSize: 5 },
18
- },
19
- }}
20
- pageSizeOptions={[5, 10]}
21
- checkboxSelection
22
- onPaginationMetaChange={(params) => {
23
- console.log(params);
24
- }}
25
- onPaginationModelChange={(params) => {
26
- console.log(params);
18
+ <DataGridContainer>
19
+ <MuiDataGrid
20
+ {...props}
21
+ slots={{
22
+ pagination: () => <Pagination count={pages} page={currentPage} />,
27
23
  }}
28
24
  />
29
- </div>
25
+ </DataGridContainer>
30
26
  );
31
- }
27
+ };
@@ -0,0 +1,22 @@
1
+ import {
2
+ Pagination as MuiPagination,
3
+ PaginationProps as MuiPaginationProps,
4
+ Stack,
5
+ } from "@mui/material";
6
+ import { Typography } from "../../Typography/Typography";
7
+
8
+ export type PaginationProps = {
9
+ pageStart: number;
10
+ pageEnd: number;
11
+ totalCount: number;
12
+ } & MuiPaginationProps;
13
+
14
+ export const TablePagination = (props: PaginationProps) => {
15
+ const { pageStart, pageEnd, totalCount } = props;
16
+ return (
17
+ <Stack direction="row">
18
+ <Typography variant="caption">{`${pageStart} - ${pageEnd} of ${totalCount}`}</Typography>
19
+ <MuiPagination {...props} variant="outlined" shape="rounded" />
20
+ </Stack>
21
+ );
22
+ };
@@ -0,0 +1,5 @@
1
+ import { Box, styled } from "@mui/material";
2
+
3
+ export const DataGridContainer = styled(Box)(({ theme }) => ({
4
+ backgroundColor: theme.palette.background.paper,
5
+ }));
@@ -1,11 +1,21 @@
1
1
  import { Meta, StoryObj } from "@storybook/react";
2
2
  import { DashBoardIcon } from "../../../assets/images/icons";
3
3
  import { LayoutWrapper, LayoutWrapperProps } from "./LayoutWrapper";
4
+ import DialogButton from "../../Modals/DialogButton";
5
+ import { Button } from "@mui/material";
6
+
7
+ const LayoutWrapperStory = (props: LayoutWrapperProps) => {
8
+ return (
9
+ <div style={{ minHeight: "300px" }}>
10
+ <LayoutWrapper {...props} />
11
+ </div>
12
+ );
13
+ };
4
14
 
5
15
  // Define the default export with Meta type including the component type
6
- const meta: Meta<typeof LayoutWrapper> = {
16
+ const meta: Meta<typeof LayoutWrapperStory> = {
7
17
  title: "Layout/LayoutWrapper",
8
- component: LayoutWrapper,
18
+ component: LayoutWrapperStory,
9
19
  tags: ["autodocs"],
10
20
  // argTypes: {
11
21
  // menu: {
@@ -16,16 +26,49 @@ const meta: Meta<typeof LayoutWrapper> = {
16
26
  };
17
27
 
18
28
  export default meta;
19
- type Story = StoryObj<typeof LayoutWrapper>;
29
+ type Story = StoryObj<typeof LayoutWrapperStory>;
20
30
 
21
31
  // Primary story
22
32
  export const Primary: Story = {
23
- render: (args: LayoutWrapperProps) => <LayoutWrapper {...args} />,
33
+ render: (args: LayoutWrapperProps) => <LayoutWrapperStory {...args} />,
24
34
  args: {
25
35
  menu: [
26
36
  { name: "Tickets", path: "/home", icon: DashBoardIcon },
27
37
  { name: "Item 2", path: "/item2" },
28
38
  ],
29
39
  children: <>hi</>,
40
+ actionButtons: [
41
+ <DialogButton
42
+ anchor={({ open }) => (
43
+ <Button variant="contained" onClick={open}>
44
+ Create
45
+ </Button>
46
+ )}
47
+ content={({ close }) => <Button onClick={close}>Click Me</Button>}
48
+ title="Dialog Title"
49
+ />,
50
+ ],
51
+ },
52
+ };
53
+
54
+ export const WithActionButtons: Story = {
55
+ render: (args: LayoutWrapperProps) => <LayoutWrapperStory {...args} />,
56
+ args: {
57
+ menu: [
58
+ { name: "Tickets", path: "/home", icon: DashBoardIcon },
59
+ { name: "Item 2", path: "/item2" },
60
+ ],
61
+ children: <>hi</>,
62
+ actionButtons: [
63
+ <DialogButton
64
+ anchor={({ open }) => (
65
+ <Button variant="contained" onClick={open}>
66
+ Click Me
67
+ </Button>
68
+ )}
69
+ content={({ close }) => <Button onClick={close}>Click Me</Button>}
70
+ title="Dialog Title"
71
+ />,
72
+ ],
30
73
  },
31
74
  };
@@ -1,4 +1,4 @@
1
- import { IconButton, Toolbar, Typography } from "@mui/material";
1
+ import { Box, IconButton, Stack, Toolbar, Typography } from "@mui/material";
2
2
 
3
3
  import MenuIcon from "@mui/icons-material/Menu";
4
4
  import { useState } from "react";
@@ -12,6 +12,7 @@ import {
12
12
 
13
13
  export interface LayoutWrapperProps {
14
14
  title?: string;
15
+ actionButtons?: React.ReactNode[];
15
16
  children: React.ReactNode;
16
17
  showIcon?: boolean;
17
18
  menu?: any;
@@ -21,6 +22,7 @@ export const LayoutWrapper = ({
21
22
  title,
22
23
  showIcon = true,
23
24
  menu,
25
+ actionButtons,
24
26
  }: LayoutWrapperProps) => {
25
27
  const [open, setOpen] = useState<boolean>(
26
28
  window.innerWidth > 1024 ? true : false
@@ -36,29 +38,46 @@ export const LayoutWrapper = ({
36
38
  return (
37
39
  <StyledLayoutContainer>
38
40
  <StyledMainContainer>
39
- <Toolbar sx={{ paddingLeft: "0px !important" }}>
41
+ <Toolbar
42
+ sx={{
43
+ padding: "0px !important",
44
+ }}
45
+ >
40
46
  {showIcon && (
41
- <IconButton
42
- color="inherit"
43
- aria-label="open drawer"
44
- onClick={handleDrawer}
45
- edge="start"
46
- sx={{ mr: 0.5, padding: "6px", marginLeft: "0px" }}
47
- onMouseEnter={() => setIsHovered(true)}
48
- onMouseLeave={() => setIsHovered(false)}
49
- >
50
- {open && isHovered ? (
51
- <LeftIcon />
52
- ) : !open && isHovered ? (
53
- <RightIcon />
54
- ) : (
55
- <MenuIcon />
56
- )}
57
- </IconButton>
47
+ <>
48
+ <Stack
49
+ direction={"row"}
50
+ width={"100%"}
51
+ justifyContent={"space-between"}
52
+ >
53
+ <Stack direction={"row"}>
54
+ <IconButton
55
+ color="inherit"
56
+ aria-label="open drawer"
57
+ onClick={handleDrawer}
58
+ edge="start"
59
+ sx={{ mr: 0.5, padding: "6px", marginLeft: "0px" }}
60
+ onMouseEnter={() => setIsHovered(true)}
61
+ onMouseLeave={() => setIsHovered(false)}
62
+ >
63
+ {open && isHovered ? (
64
+ <LeftIcon />
65
+ ) : !open && isHovered ? (
66
+ <RightIcon />
67
+ ) : (
68
+ <MenuIcon />
69
+ )}
70
+ </IconButton>
71
+ <Typography variant="subtitle1" noWrap>
72
+ {title ? title : menu[active].name}
73
+ </Typography>
74
+ </Stack>
75
+ <Stack direction={"row"} alignItems={"flex-end"}>
76
+ {actionButtons?.map((element) => element)}
77
+ </Stack>
78
+ </Stack>
79
+ </>
58
80
  )}
59
- <Typography variant="subtitle1" noWrap>
60
- {title ? title : menu[active].name}
61
- </Typography>
62
81
  </Toolbar>
63
82
 
64
83
  <SideNavigation
@@ -1,83 +0,0 @@
1
- import {
2
- Stack,
3
- Switch,
4
- SxProps,
5
- ToggleButton,
6
- ToggleButtonGroup,
7
- } from "@mui/material";
8
- import { ReactNode, useState } from "react";
9
- import { MuiThemeProvider } from "../../../themes/MuiThemeProvider";
10
- import { darkTheme, lightTheme } from "../../../themes/export";
11
- import { Typography } from "../../Typography/Typography";
12
- import { DefaultBackground } from "./DefaultBackground";
13
- import { PaperBackground } from "./PaperBackground";
14
-
15
- export enum ComponentBackgroundTypes {
16
- DEFAULT = "default",
17
- PAPER = "paper",
18
- }
19
-
20
- export type ComponentBackgroundProps = {
21
- children: ReactNode;
22
- sx?: SxProps;
23
- };
24
-
25
- export const BackgroundComponent = ({
26
- children,
27
- backgroundType,
28
- sx,
29
- }: {
30
- children: ReactNode;
31
- backgroundType: ComponentBackgroundTypes;
32
- sx?: SxProps;
33
- }) => {
34
- switch (backgroundType) {
35
- case ComponentBackgroundTypes.DEFAULT:
36
- return <DefaultBackground sx={sx}>{children}</DefaultBackground>;
37
- case ComponentBackgroundTypes.PAPER:
38
- return <PaperBackground sx={sx}>{children}</PaperBackground>;
39
- default:
40
- return <DefaultBackground sx={sx}>{children}</DefaultBackground>;
41
- }
42
- };
43
-
44
- export const ComponentBackground = ({
45
- children,
46
- sx,
47
- }: ComponentBackgroundProps) => {
48
- const [darkMode, setDarkMode] = useState(false);
49
- const [backgroundType, setBackgroundType] =
50
- useState<ComponentBackgroundTypes>(ComponentBackgroundTypes.DEFAULT);
51
-
52
- return (
53
- <MuiThemeProvider theme={darkMode ? darkTheme : lightTheme}>
54
- <BackgroundComponent backgroundType={backgroundType} sx={sx}>
55
- {children}
56
- <Stack gap={2} direction="row" marginTop="50px">
57
- <Switch
58
- onChange={(e) => {
59
- setDarkMode(e.target.checked);
60
- }}
61
- />
62
- <Typography variant="label1">Dark Mode</Typography>
63
- <ToggleButtonGroup
64
- color="primary"
65
- value={backgroundType}
66
- exclusive
67
- onChange={(e, v) => {
68
- setBackgroundType(v);
69
- }}
70
- aria-label="Platform"
71
- >
72
- <ToggleButton value={ComponentBackgroundTypes.DEFAULT}>
73
- DEFAULT
74
- </ToggleButton>
75
- <ToggleButton value={ComponentBackgroundTypes.PAPER}>
76
- PAPER
77
- </ToggleButton>
78
- </ToggleButtonGroup>
79
- </Stack>
80
- </BackgroundComponent>
81
- </MuiThemeProvider>
82
- );
83
- };
@@ -1,12 +0,0 @@
1
- import { Box, styled } from "@mui/material";
2
-
3
- export const DefaultBackground = styled(Box)(({ theme }) => ({
4
- minHeight: "150px",
5
- backgroundColor: theme.palette.background.default,
6
- minWidth: "600px",
7
- display: "flex",
8
- flexDirection: "column",
9
- justifyContent: "center",
10
- alignItems: "center",
11
- padding: "50px",
12
- }));
@@ -1,12 +0,0 @@
1
- import { Box, styled } from "@mui/material";
2
-
3
- export const PaperBackground = styled(Box)(({ theme }) => ({
4
- minHeight: "150px",
5
- backgroundColor: theme.palette.background.paper,
6
- minWidth: "600px",
7
- display: "flex",
8
- flexDirection: "column",
9
- justifyContent: "center",
10
- alignItems: "center",
11
- padding: "50px",
12
- }));
@@ -1,30 +0,0 @@
1
- import React from "react";
2
- import { Meta, StoryObj } from "@storybook/react";
3
- import { SideNavigation, SideNavigationProps } from "./SideNavigation";
4
-
5
- // Define the default export with Meta type including the component type
6
- const meta: Meta<typeof SideNavigation> = {
7
- title: "Layout/SideNavigation",
8
- component: SideNavigation,
9
- tags: ["autodocs"],
10
- argTypes: {
11
- menu: {
12
- control: "object",
13
- description: "Menu items to be displayed in the side navigation.",
14
- },
15
- },
16
- };
17
-
18
- export default meta;
19
- type Story = StoryObj<typeof SideNavigation>;
20
-
21
- // Primary story
22
- export const Primary: Story = {
23
- render: (args: SideNavigationProps) => <SideNavigation {...args} />,
24
- args: {
25
- menu: [
26
- { label: "Item 1", path: "/" },
27
- { label: "Item 2", path: "/item2" },
28
- ],
29
- },
30
- };
@@ -1,95 +0,0 @@
1
- // Import React and other necessary elements
2
- import { Meta } from "@storybook/react";
3
-
4
- // Make sure your childrenField import is correct
5
-
6
- import { Typography, TypographyProps } from "./Typography";
7
-
8
- // Define the default export with Meta type including the component type
9
- export default {
10
- title: "Typography",
11
- component: Typography,
12
- tags: ["autodocs"],
13
- argTypes: {
14
- variant: {
15
- control: "select",
16
- options: ["h1", "h2", "h3", "h4", "fieldLabel"],
17
- description: "The Typography Variant to use",
18
- },
19
- },
20
- } as Meta<typeof Typography>;
21
-
22
- // Define stories directly as objects with render function
23
- export const H6 = {
24
- render: (args: TypographyProps) => (
25
- <Typography {...args}>{args.children}</Typography>
26
- ),
27
- args: {
28
- variant: "h6",
29
- children: "Heading 6",
30
- },
31
- };
32
-
33
- export const Subtitle1 = {
34
- render: (args: TypographyProps) => <Typography {...args} />,
35
- args: {
36
- variant: "subtitle1",
37
- children: "Subtitle 1",
38
- },
39
- };
40
-
41
- export const Subtitle2 = {
42
- render: (args: TypographyProps) => <Typography {...args} />,
43
- args: {
44
- variant: "subtitle2",
45
- children: "Subtitle 2",
46
- },
47
- };
48
-
49
- export const Subtitle3 = {
50
- render: (args: TypographyProps) => <Typography {...args} />,
51
- args: {
52
- variant: "subtitle3",
53
- children: "Subtitle 3",
54
- },
55
- };
56
-
57
- export const Body1 = {
58
- render: (args: TypographyProps) => <Typography {...args} />,
59
- args: {
60
- variant: "body1",
61
- children: "Body 1",
62
- },
63
- };
64
-
65
- export const Body2 = {
66
- render: (args: TypographyProps) => <Typography {...args} />,
67
- args: {
68
- variant: "body2",
69
- children: "Body 2",
70
- },
71
- };
72
-
73
- export const Caption = {
74
- render: (args: TypographyProps) => <Typography {...args} />,
75
- args: {
76
- variant: "caption",
77
- children: "Caption",
78
- },
79
- };
80
-
81
- export const Label1 = {
82
- render: (args: TypographyProps) => <Typography {...args} />,
83
- args: {
84
- variant: "label1",
85
- children: "Label 1",
86
- },
87
- };
88
-
89
- export const Label2 = {
90
- render: (args: TypographyProps) => <Typography {...args} />,
91
- args: {
92
- variant: "label2",
93
- children: "Label 2",
94
- },
95
- };
@@ -1,52 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { fn } from '@storybook/test';
3
- import { Button } from './Button';
4
-
5
- // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
6
- const meta = {
7
- title: 'Example/Button',
8
- component: Button,
9
- parameters: {
10
- // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
11
- layout: 'centered',
12
- },
13
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
14
- tags: ['autodocs'],
15
- // More on argTypes: https://storybook.js.org/docs/api/argtypes
16
- argTypes: {
17
- backgroundColor: { control: 'color' },
18
- },
19
- // Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
20
- args: { onClick: fn() },
21
- } satisfies Meta<typeof Button>;
22
-
23
- export default meta;
24
- type Story = StoryObj<typeof meta>;
25
-
26
- // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
27
- export const Primary: Story = {
28
- args: {
29
- primary: true,
30
- label: 'Button',
31
- },
32
- };
33
-
34
- export const Secondary: Story = {
35
- args: {
36
- label: 'Button',
37
- },
38
- };
39
-
40
- export const Large: Story = {
41
- args: {
42
- size: 'large',
43
- label: 'Button',
44
- },
45
- };
46
-
47
- export const Small: Story = {
48
- args: {
49
- size: 'small',
50
- label: 'Button',
51
- },
52
- };