@feminab/box-ui 0.1.0 → 0.1.3
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.
- package/.storybook/main.ts +40 -2
- package/README.md +59 -26
- package/dist/@interfaces/Badge.d.d.ts.map +1 -1
- package/dist/@interfaces/Button.d.d.ts.map +1 -1
- package/dist/@interfaces/Color.d.d.ts.map +1 -1
- package/dist/@interfaces/IButtonItem.d.d.ts.map +1 -1
- package/dist/@interfaces/ISubNavItem.d.d.ts.map +1 -1
- package/dist/@interfaces/MobileNavProps.d.d.ts.map +1 -1
- package/dist/@interfaces/NavItem.d.d.ts.map +1 -1
- package/dist/@interfaces/Pagination.d.d.ts.map +1 -1
- package/dist/@interfaces/Select.d.d.ts.map +1 -1
- package/dist/@interfaces/SideNavProps.d.d.ts.map +1 -1
- package/dist/@interfaces/TextInput.d.d.ts.map +1 -1
- package/dist/@interfaces/index.d.ts.map +1 -1
- package/dist/Badge.d.ts.map +1 -1
- package/dist/Button.d.ts.map +1 -1
- package/dist/ButtonGroup.d.ts.map +1 -1
- package/dist/ColorBox.d.ts.map +1 -1
- package/dist/Header.d.ts.map +1 -1
- package/dist/Nav/MobileNav.d.ts.map +1 -1
- package/dist/Nav/NavItem.d.ts.map +1 -1
- package/dist/Nav/SideNav.d.ts.map +1 -1
- package/dist/Nav/SubNavItem.d.ts.map +1 -1
- package/dist/Paginate.d.ts.map +1 -1
- package/dist/Select.d.ts.map +1 -1
- package/dist/StoryLayout.d.ts.map +1 -1
- package/dist/TextInput.d.ts.map +1 -1
- package/dist/Typography.d.ts.map +1 -1
- package/dist/box-ui.cjs.development.js +17 -11
- package/dist/box-ui.cjs.development.js.map +1 -1
- package/dist/box-ui.cjs.production.min.js +1 -1
- package/dist/box-ui.cjs.production.min.js.map +1 -1
- package/dist/box-ui.esm.js +17 -11
- package/dist/box-ui.esm.js.map +1 -1
- package/dist/data/colors.d.ts.map +1 -1
- package/dist/data/countries.d.ts.map +1 -1
- package/dist/data/images/index.d.ts.map +1 -1
- package/dist/data/index.d.ts.map +1 -1
- package/dist/data/navItems.d.ts.map +1 -1
- package/dist/data/options.d.ts.map +1 -1
- package/dist/data/prices.d.ts.map +1 -1
- package/dist/hooks/useIconClassName.d.ts.map +1 -1
- package/dist/hooks/useIconProps.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/jest.config.d.ts +9 -0
- package/dist/jest.config.d.ts.map +1 -0
- package/dist/reportWebVitals.d.ts.map +1 -1
- package/dist/setupTests.d.ts.map +1 -1
- package/dist/stories/Badge.stories.d.ts +3 -4
- package/dist/stories/Badge.stories.d.ts.map +1 -1
- package/dist/stories/Button.stories.d.ts +3 -4
- package/dist/stories/Button.stories.d.ts.map +1 -1
- package/dist/stories/ButtonGroup.stories.d.ts +4 -4
- package/dist/stories/ButtonGroup.stories.d.ts.map +1 -1
- package/dist/stories/Colors.stories.d.ts +3 -3
- package/dist/stories/Colors.stories.d.ts.map +1 -1
- package/dist/stories/MobileNav.stories.d.ts +3 -4
- package/dist/stories/MobileNav.stories.d.ts.map +1 -1
- package/dist/stories/Paginate.stories.d.ts +3 -4
- package/dist/stories/Paginate.stories.d.ts.map +1 -1
- package/dist/stories/Select.stories.d.ts +3 -4
- package/dist/stories/Select.stories.d.ts.map +1 -1
- package/dist/stories/SideNav.stories.d.ts +3 -4
- package/dist/stories/SideNav.stories.d.ts.map +1 -1
- package/dist/stories/TextInput.stories.d.ts +3 -4
- package/dist/stories/TextInput.stories.d.ts.map +1 -1
- package/dist/stories/Typography.stories.d.ts +4 -4
- package/dist/stories/Typography.stories.d.ts.map +1 -1
- package/dist/utils/IconWrapper.d.ts +8 -0
- package/dist/utils/IconWrapper.d.ts.map +1 -0
- package/jest.config.js +13 -0
- package/jest.setup.ts +3 -0
- package/netlify.toml +3 -0
- package/package.json +25 -26
- package/src/Nav/MobileNav.tsx +2 -0
- package/src/Nav/SideNav.tsx +1 -0
- package/src/Paginate.tsx +2 -0
- package/src/Select.tsx +1 -1
- package/src/TextInput.tsx +23 -27
- package/src/index.js +1 -1
- package/src/stories/Badge.stories.tsx +6 -8
- package/src/stories/Button.stories.tsx +21 -8
- package/src/stories/ButtonGroup.stories.tsx +48 -48
- package/src/stories/Colors.stories.tsx +2 -4
- package/src/stories/MobileNav.stories.tsx +29 -19
- package/src/stories/Paginate.stories.tsx +36 -35
- package/src/stories/Select.stories.tsx +46 -43
- package/src/stories/SideNav.stories.tsx +18 -19
- package/src/stories/TextInput.stories.tsx +81 -71
- package/src/stories/Typography.stories.tsx +2 -4
- package/src/styles/global.css +1 -181
- package/src/tests/Badge.test.tsx +48 -0
- package/src/tests/Button.test.tsx +69 -0
- package/src/tests/ButtonGroup.test.tsx +51 -0
- package/src/tests/MobileNav.test.tsx +66 -0
- package/src/tests/Paginate.test.tsx +86 -0
- package/src/tests/Select.test.tsx +63 -0
- package/src/tests/SideNav.test.tsx +43 -0
- package/src/tests/TextInput.test.tsx +42 -0
- package/src/tests/Typography.test.tsx +41 -0
- package/src/tests/__snapshots__/Badge.test.tsx.snap +13 -0
- package/src/tests/__snapshots__/Button.test.tsx.snap +106 -0
- package/src/tests/__snapshots__/ButtonGroup.test.tsx.snap +228 -0
- package/src/tests/__snapshots__/Paginate.test.tsx.snap +580 -0
- package/src/tests/__snapshots__/Select.test.tsx.snap +119 -0
- package/src/tests/__snapshots__/TextInput.test.tsx.snap +323 -0
- package/src/utils/IconWrapper.tsx +11 -0
- package/storybook-static/{125.65b26339.iframe.bundle.js → 125.df7cc93e.iframe.bundle.js} +3 -3
- package/storybook-static/125.df7cc93e.iframe.bundle.js.map +1 -0
- package/storybook-static/13.d4c3993e.iframe.bundle.js +2 -0
- package/storybook-static/161.f5193502.iframe.bundle.js +2 -0
- package/storybook-static/167.89fa6ac2.iframe.bundle.js +1 -0
- package/storybook-static/294.eccdc80d.iframe.bundle.js +1 -0
- package/storybook-static/314.c9f9245e.iframe.bundle.js +2 -0
- package/storybook-static/364.1cfcaebe.iframe.bundle.js +1 -0
- package/storybook-static/735.c396ee77.iframe.bundle.js +2 -0
- package/storybook-static/742.52c662a4.iframe.bundle.js +1 -0
- package/storybook-static/{844.aec20bdb.iframe.bundle.js → 844.3bb89aad.iframe.bundle.js} +3 -3
- package/storybook-static/844.3bb89aad.iframe.bundle.js.map +1 -0
- package/storybook-static/936.c827da74.iframe.bundle.js +1 -0
- package/storybook-static/961.c3df469f.iframe.bundle.js +2 -0
- package/storybook-static/iframe.html +3 -3
- package/storybook-static/main.179173d1.iframe.bundle.js +1 -0
- package/storybook-static/project.json +1 -1
- package/storybook-static/{runtime~main.295ddda4.iframe.bundle.js → runtime~main.70344601.iframe.bundle.js} +1 -1
- package/storybook-static/static/css/main.08036cd2.css.map +1 -1
- package/storybook-static/stories-Badge-stories.a924d6d5.iframe.bundle.js +1 -0
- package/storybook-static/stories-Button-stories.a3c88a14.iframe.bundle.js +1 -0
- package/storybook-static/stories-ButtonGroup-stories.2c74e4c4.iframe.bundle.js +1 -0
- package/storybook-static/stories-Colors-stories.424256b4.iframe.bundle.js +2 -0
- package/storybook-static/stories-Configure-mdx.46ebbf59.iframe.bundle.js +1 -0
- package/storybook-static/stories-Header-stories.df09e844.iframe.bundle.js +2 -0
- package/storybook-static/stories-MobileNav-stories.eb9a0ca6.iframe.bundle.js +1 -0
- package/storybook-static/stories-Page-stories.ab66c885.iframe.bundle.js +2 -0
- package/storybook-static/stories-Paginate-stories.086f736a.iframe.bundle.js +1 -0
- package/storybook-static/stories-Select-stories.4c04edb3.iframe.bundle.js +1 -0
- package/storybook-static/stories-SideNav-stories.272a4362.iframe.bundle.js +1 -0
- package/storybook-static/stories-TextInput-stories.cfa81131.iframe.bundle.js +1 -0
- package/storybook-static/stories-Typography-stories.a31da7ce.iframe.bundle.js +2 -0
- package/tailwind.config.js +1 -1
- package/tsconfig.json +6 -3
- package/tsdx.config.js +14 -0
- package/dist/Page.d.ts +0 -3
- package/dist/Page.d.ts.map +0 -1
- package/dist/stories/Header.stories.d.ts +0 -20
- package/dist/stories/Header.stories.d.ts.map +0 -1
- package/dist/stories/Page.stories.d.ts +0 -14
- package/dist/stories/Page.stories.d.ts.map +0 -1
- package/src/Page.tsx +0 -72
- package/src/stories/Configure.mdx +0 -364
- package/src/stories/Header.stories.ts +0 -33
- package/src/stories/Page.stories.ts +0 -32
- package/storybook-static/125.65b26339.iframe.bundle.js.map +0 -1
- package/storybook-static/13.0638081a.iframe.bundle.js +0 -2
- package/storybook-static/161.a19908ac.iframe.bundle.js +0 -2
- package/storybook-static/167.3fa3a909.iframe.bundle.js +0 -1
- package/storybook-static/294.ce38f65c.iframe.bundle.js +0 -1
- package/storybook-static/314.568bd9af.iframe.bundle.js +0 -2
- package/storybook-static/364.0b18ef67.iframe.bundle.js +0 -1
- package/storybook-static/735.1625d9f4.iframe.bundle.js +0 -2
- package/storybook-static/742.597501f6.iframe.bundle.js +0 -1
- package/storybook-static/844.aec20bdb.iframe.bundle.js.map +0 -1
- package/storybook-static/936.fd850a3f.iframe.bundle.js +0 -1
- package/storybook-static/961.0e5457c5.iframe.bundle.js +0 -2
- package/storybook-static/main.069281cf.iframe.bundle.js +0 -1
- package/storybook-static/stories-Badge-stories.484f7206.iframe.bundle.js +0 -1
- package/storybook-static/stories-Button-stories.5e29be85.iframe.bundle.js +0 -1
- package/storybook-static/stories-ButtonGroup-stories.cc89968c.iframe.bundle.js +0 -1
- package/storybook-static/stories-Colors-stories.f892dc75.iframe.bundle.js +0 -2
- package/storybook-static/stories-Configure-mdx.81346d97.iframe.bundle.js +0 -1
- package/storybook-static/stories-Header-stories.cf691094.iframe.bundle.js +0 -2
- package/storybook-static/stories-MobileNav-stories.f04cccdd.iframe.bundle.js +0 -1
- package/storybook-static/stories-Page-stories.0c9aa29d.iframe.bundle.js +0 -2
- package/storybook-static/stories-Paginate-stories.3b161781.iframe.bundle.js +0 -1
- package/storybook-static/stories-Select-stories.7556ae0d.iframe.bundle.js +0 -1
- package/storybook-static/stories-SideNav-stories.093fac6a.iframe.bundle.js +0 -1
- package/storybook-static/stories-TextInput-stories.6d3e15c6.iframe.bundle.js +0 -1
- package/storybook-static/stories-Typography-stories.6640f7ac.iframe.bundle.js +0 -2
- /package/storybook-static/{125.65b26339.iframe.bundle.js.LICENSE.txt → 125.df7cc93e.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{13.0638081a.iframe.bundle.js.LICENSE.txt → 13.d4c3993e.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{161.a19908ac.iframe.bundle.js.LICENSE.txt → 161.f5193502.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{314.568bd9af.iframe.bundle.js.LICENSE.txt → 314.c9f9245e.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{735.1625d9f4.iframe.bundle.js.LICENSE.txt → 735.c396ee77.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{844.aec20bdb.iframe.bundle.js.LICENSE.txt → 844.3bb89aad.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{961.0e5457c5.iframe.bundle.js.LICENSE.txt → 961.c3df469f.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{stories-Colors-stories.f892dc75.iframe.bundle.js.LICENSE.txt → stories-Colors-stories.424256b4.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{stories-Header-stories.cf691094.iframe.bundle.js.LICENSE.txt → stories-Header-stories.df09e844.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{stories-Page-stories.0c9aa29d.iframe.bundle.js.LICENSE.txt → stories-Page-stories.ab66c885.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook-static/{stories-Typography-stories.6640f7ac.iframe.bundle.js.LICENSE.txt → stories-Typography-stories.a31da7ce.iframe.bundle.js.LICENSE.txt} +0 -0
@@ -1,30 +1,27 @@
|
|
1
|
-
|
2
1
|
import React, { useState } from "react";
|
3
2
|
import { Meta, StoryObj } from "@storybook/react";
|
4
|
-
import { MobileNavProps} from "../@interfaces";
|
3
|
+
import { MobileNavProps } from "../@interfaces";
|
5
4
|
import { SideNav } from "../Nav/SideNav";
|
6
5
|
import { StoryLayout } from "../StoryLayout";
|
7
6
|
import { navItemsTop, navItemsBottom } from "../data/navItems";
|
8
7
|
import { MobileNavbar } from "../Nav/MobileNav";
|
9
|
-
import { FiX } from "react-icons/fi";
|
8
|
+
import { FiX } from "react-icons/fi"; // Directly import FiX
|
9
|
+
import type { IconBaseProps } from "react-icons";
|
10
10
|
|
11
|
-
const
|
11
|
+
const CloseIcon = FiX as React.FC<IconBaseProps>;
|
12
|
+
// Wrapper to fix TS JSX issues
|
13
|
+
|
14
|
+
export default {
|
12
15
|
title: "Example/MobileNav",
|
13
16
|
component: MobileNavbar,
|
14
|
-
};
|
15
|
-
|
16
|
-
export default meta;
|
17
|
+
} as Meta;
|
17
18
|
|
18
19
|
interface Props extends MobileNavProps {
|
19
20
|
darkMode: boolean;
|
20
21
|
}
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
darkMode: false,
|
25
|
-
},
|
26
|
-
render: (args) => {
|
27
|
-
const [open, setOpen] = useState<boolean>(false);
|
23
|
+
const MobileNavWithState = (args: Props) => {
|
24
|
+
const [open, setOpen] = useState<boolean>(false);
|
28
25
|
|
29
26
|
const handleToggle = () => {
|
30
27
|
setOpen(!open);
|
@@ -34,16 +31,23 @@ export const Default: StoryObj<Props> = {
|
|
34
31
|
<StoryLayout {...args}>
|
35
32
|
<MobileNavbar open={open} toggleOpen={handleToggle} />
|
36
33
|
|
37
|
-
{open
|
34
|
+
{open && (
|
38
35
|
<div
|
36
|
+
data-testid="backdrop"
|
39
37
|
className="fixed top-0 left-0 z-40 w-screen h-screen bg-gray-500 cursor-pointer bg-opacity-80"
|
40
38
|
onClick={() => setOpen(false)}
|
41
39
|
>
|
42
|
-
|
40
|
+
<CloseIcon
|
41
|
+
data-testid="close-icon"
|
42
|
+
size={40}
|
43
|
+
className="fixed text-white top-5 right-9"
|
44
|
+
role="button"
|
45
|
+
aria-label="Close sidebar"
|
46
|
+
/>
|
43
47
|
</div>
|
44
|
-
)
|
48
|
+
)}
|
45
49
|
|
46
|
-
{open
|
50
|
+
{open && (
|
47
51
|
<SideNav
|
48
52
|
className="relative z-50 h-screen -mt-20"
|
49
53
|
navItemsTop={navItemsTop}
|
@@ -53,8 +57,14 @@ export const Default: StoryObj<Props> = {
|
|
53
57
|
username="Veronica Woods"
|
54
58
|
email="veronica@example.com"
|
55
59
|
/>
|
56
|
-
)
|
60
|
+
)}
|
57
61
|
</StoryLayout>
|
58
|
-
|
62
|
+
);
|
63
|
+
};
|
64
|
+
|
65
|
+
export const Default: StoryObj<Props> = {
|
66
|
+
args: {
|
67
|
+
darkMode: false,
|
59
68
|
},
|
69
|
+
render: (args) => <MobileNavWithState {...args} />,
|
60
70
|
};
|
@@ -4,41 +4,56 @@ import { Meta, StoryObj } from "@storybook/react";
|
|
4
4
|
import { PaginationProps } from "../@interfaces";
|
5
5
|
import {Paginate} from "../Paginate";
|
6
6
|
|
7
|
-
|
7
|
+
export default {
|
8
8
|
title: "Example/Pagination",
|
9
9
|
component: Paginate,
|
10
10
|
parameters: {
|
11
11
|
layout: "centered",
|
12
12
|
},
|
13
13
|
tags: ["autodocs"],
|
14
|
-
};
|
15
|
-
|
16
|
-
export default meta;
|
17
|
-
|
14
|
+
} as Meta;
|
18
15
|
interface Props extends PaginationProps {
|
19
16
|
darkMode: boolean;
|
20
17
|
}
|
21
18
|
|
19
|
+
const DesktopPaginationComponent = (args: Props) => {
|
20
|
+
const [currentPage, setCurrentPage] = useState<number>(0);
|
21
|
+
|
22
|
+
return (
|
23
|
+
<StoryLayout {...args}>
|
24
|
+
<Paginate
|
25
|
+
className=""
|
26
|
+
isMobile={false}
|
27
|
+
totalPages={args.totalPages}
|
28
|
+
page={currentPage}
|
29
|
+
setPage={setCurrentPage}
|
30
|
+
/>
|
31
|
+
</StoryLayout>
|
32
|
+
);
|
33
|
+
};
|
34
|
+
|
22
35
|
export const DesktopPagination: StoryObj<Props> = {
|
23
36
|
args: {
|
24
37
|
darkMode: false,
|
25
38
|
totalPages: 10,
|
26
39
|
},
|
27
|
-
render: (args) => {
|
28
|
-
|
40
|
+
render: (args) => <DesktopPaginationComponent {...args} />,
|
41
|
+
};
|
29
42
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
43
|
+
const MobilePaginationComponent = (args: Props) => {
|
44
|
+
const [currentPage, setCurrentPage] = useState<number>(0);
|
45
|
+
|
46
|
+
return (
|
47
|
+
<StoryLayout {...args}>
|
48
|
+
<Paginate
|
49
|
+
className=""
|
50
|
+
isMobile={true}
|
51
|
+
totalPages={args.totalPages}
|
52
|
+
page={currentPage}
|
53
|
+
setPage={setCurrentPage}
|
54
|
+
/>
|
55
|
+
</StoryLayout>
|
56
|
+
);
|
42
57
|
};
|
43
58
|
|
44
59
|
export const MobilePagination: StoryObj<Props> = {
|
@@ -46,19 +61,5 @@ export const MobilePagination: StoryObj<Props> = {
|
|
46
61
|
darkMode: false,
|
47
62
|
totalPages: 10,
|
48
63
|
},
|
49
|
-
render: (args) => {
|
50
|
-
|
51
|
-
|
52
|
-
return (
|
53
|
-
<StoryLayout {...args}>
|
54
|
-
<Paginate
|
55
|
-
className=""
|
56
|
-
isMobile={true}
|
57
|
-
totalPages={args.totalPages}
|
58
|
-
page={currentPage}
|
59
|
-
setPage={setCurrentPage}
|
60
|
-
/>
|
61
|
-
</StoryLayout>
|
62
|
-
);
|
63
|
-
},
|
64
|
-
};
|
64
|
+
render: (args) => <MobilePaginationComponent {...args} />,
|
65
|
+
};
|
@@ -1,24 +1,21 @@
|
|
1
|
-
|
2
|
-
import React, {useState} from "react";
|
1
|
+
import React, { useState } from "react";
|
3
2
|
import { Meta, StoryObj } from "@storybook/react";
|
4
3
|
import { Select } from "../Select";
|
5
4
|
import { IOption, SelectProps } from "../@interfaces";
|
6
5
|
import { StoryLayout } from "../StoryLayout";
|
7
6
|
import { countries } from "../data/countries";
|
8
7
|
import { prices } from "../data/prices";
|
9
|
-
import {FiDollarSign} from 'react-icons/fi';
|
8
|
+
import { FiDollarSign } from 'react-icons/fi';
|
9
|
+
import { IconWrapper } from "../utils/IconWrapper";
|
10
10
|
|
11
|
-
|
11
|
+
export default {
|
12
12
|
title: "Example/Select",
|
13
13
|
component: Select,
|
14
14
|
parameters: {
|
15
15
|
layout: "centered",
|
16
16
|
},
|
17
17
|
tags: ["autodocs"],
|
18
|
-
}
|
19
|
-
|
20
|
-
export default meta;
|
21
|
-
|
18
|
+
} as Meta;
|
22
19
|
interface Props extends SelectProps {
|
23
20
|
darkMode: false;
|
24
21
|
}
|
@@ -28,24 +25,27 @@ export const Default: StoryObj<Props> = {
|
|
28
25
|
darkMode: false
|
29
26
|
},
|
30
27
|
render: (args) => {
|
31
|
-
const
|
28
|
+
const SelectStory = () => {
|
29
|
+
const [selectedCountry, setSelectedCountry] = useState<IOption>(countries[0]);
|
30
|
+
|
31
|
+
const handleSelectedCountry = (country: string) => {
|
32
|
+
const option = countries.find((obj) => obj.value === country) as IOption;
|
33
|
+
setSelectedCountry(option);
|
34
|
+
}
|
32
35
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
/>
|
47
|
-
</StoryLayout>
|
48
|
-
)
|
36
|
+
return (
|
37
|
+
<StoryLayout {...args} className="flex">
|
38
|
+
<Select
|
39
|
+
options={countries}
|
40
|
+
selectedOption={selectedCountry}
|
41
|
+
setSelectedOption={handleSelectedCountry}
|
42
|
+
placeholder="Select country"
|
43
|
+
width="w-50"
|
44
|
+
/>
|
45
|
+
</StoryLayout>
|
46
|
+
);
|
47
|
+
};
|
48
|
+
return <SelectStory />;
|
49
49
|
}
|
50
50
|
}
|
51
51
|
|
@@ -54,24 +54,27 @@ export const SelectWithIcon: StoryObj<Props> = {
|
|
54
54
|
darkMode: false
|
55
55
|
},
|
56
56
|
render: (args) => {
|
57
|
-
const
|
57
|
+
const SelectWithIconStory = () => {
|
58
|
+
const [selectedPrice, setSelectedPrice] = useState<IOption>(prices[0]);
|
59
|
+
|
60
|
+
const handleSelectedPrice = (price: string) => {
|
61
|
+
const option = prices.find((obj) => obj.value === price) as IOption;
|
62
|
+
setSelectedPrice(option);
|
63
|
+
}
|
58
64
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
/>
|
74
|
-
</StoryLayout>
|
75
|
-
)
|
65
|
+
return (
|
66
|
+
<StoryLayout {...args} className="flex">
|
67
|
+
<Select
|
68
|
+
options={prices}
|
69
|
+
selectedOption={selectedPrice}
|
70
|
+
setSelectedOption={handleSelectedPrice}
|
71
|
+
placeholder="Select a price"
|
72
|
+
LeadingIcon={<IconWrapper Icon={FiDollarSign} />}
|
73
|
+
width="w-50"
|
74
|
+
/>
|
75
|
+
</StoryLayout>
|
76
|
+
);
|
77
|
+
};
|
78
|
+
return <SelectWithIconStory />;
|
76
79
|
}
|
77
80
|
}
|
@@ -5,34 +5,33 @@ import { SideNav } from "../Nav/SideNav";
|
|
5
5
|
import { StoryLayout } from "../StoryLayout";
|
6
6
|
import { navItemsTop, navItemsBottom } from "../data/navItems";
|
7
7
|
|
8
|
-
|
8
|
+
export default {
|
9
9
|
title: "Example/SideNav",
|
10
10
|
component: SideNav,
|
11
|
-
};
|
12
|
-
|
13
|
-
export default meta;
|
11
|
+
} as Meta;
|
14
12
|
|
15
13
|
interface Props extends SideNavProps {
|
16
14
|
darkMode: boolean;
|
17
15
|
}
|
18
16
|
|
17
|
+
const SideNavWithState = (args: Props) => {
|
18
|
+
const [open, setOpen] = useState<boolean>(true);
|
19
|
+
return (
|
20
|
+
<StoryLayout {...args} className="flex flex-col h-screen">
|
21
|
+
<SideNav
|
22
|
+
{...args}
|
23
|
+
navItemsTop={navItemsTop}
|
24
|
+
navItemsBottom={navItemsBottom}
|
25
|
+
open={open}
|
26
|
+
setOpen={setOpen}
|
27
|
+
username="Veronica Woods"
|
28
|
+
email="veronica@example.com"/>
|
29
|
+
</StoryLayout>
|
30
|
+
);
|
31
|
+
}
|
19
32
|
export const Default: StoryObj<Props> = {
|
20
33
|
args: {
|
21
34
|
darkMode: false,
|
22
35
|
},
|
23
|
-
render: (args) => {
|
24
|
-
const [open, setOpen] = useState<boolean>(true);
|
25
|
-
return (
|
26
|
-
<StoryLayout {...args} className="flex flex-col h-screen">
|
27
|
-
<SideNav
|
28
|
-
{...args}
|
29
|
-
navItemsTop={navItemsTop}
|
30
|
-
navItemsBottom={navItemsBottom}
|
31
|
-
open={open}
|
32
|
-
setOpen={setOpen}
|
33
|
-
username="Veronica Woods"
|
34
|
-
email="veronica@example.com"/>
|
35
|
-
</StoryLayout>
|
36
|
-
);
|
37
|
-
},
|
36
|
+
render: (args) => <SideNavWithState {...args} />,
|
38
37
|
};
|
@@ -4,13 +4,12 @@ import { Meta, StoryObj } from "@storybook/react";
|
|
4
4
|
import { TextInput } from "../TextInput";
|
5
5
|
import { StoryLayout } from "../StoryLayout";
|
6
6
|
import { FiMail, FiHelpCircle, FiAlertCircle } from "react-icons/fi";
|
7
|
+
import { IconWrapper } from "../utils/IconWrapper";
|
7
8
|
|
8
|
-
|
9
|
+
export default {
|
9
10
|
title: "Example/TextInput",
|
10
11
|
component: TextInput,
|
11
|
-
};
|
12
|
-
|
13
|
-
export default meta;
|
12
|
+
} as Meta;
|
14
13
|
|
15
14
|
interface Props extends TextInputProps {
|
16
15
|
darkMode: boolean;
|
@@ -19,82 +18,93 @@ interface Props extends TextInputProps {
|
|
19
18
|
export const Default: StoryObj<Props> = {
|
20
19
|
args: {
|
21
20
|
darkMode: false,
|
21
|
+
value: ''
|
22
22
|
},
|
23
|
-
render: (args) => {
|
24
|
-
|
23
|
+
render: (args) => <DefaultTextInputStory {...args} />,
|
24
|
+
};
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
};
|
26
|
+
const DefaultTextInputStory = (args: Props) => {
|
27
|
+
const [text1, setText1] = useState<string>(args.value || "");
|
29
28
|
|
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
|
-
|
29
|
+
const handleChange = (e: ChangeEvent<HTMLInputElement>) => {
|
30
|
+
setText1(e.target.value);
|
31
|
+
};
|
32
|
+
|
33
|
+
return (
|
34
|
+
<StoryLayout {...args}>
|
35
|
+
<TextInput
|
36
|
+
{...args}
|
37
|
+
type="email"
|
38
|
+
value={text1}
|
39
|
+
handleChange={handleChange}
|
40
|
+
label="Email"
|
41
|
+
placeholder="veronica@example.com"
|
42
|
+
helperText="This is a hint text to help the user."
|
43
|
+
LeadingIcon={<IconWrapper Icon={FiMail} />}
|
44
|
+
TrailingIcon={<IconWrapper Icon={FiHelpCircle} />}
|
45
|
+
disabled={args.disabled}
|
46
|
+
/>
|
47
|
+
<div className="mb-4" />
|
48
|
+
<TextInput
|
49
|
+
{...args}
|
50
|
+
type="email"
|
51
|
+
value={text1}
|
52
|
+
handleChange={handleChange}
|
53
|
+
label="Email"
|
54
|
+
placeholder="veronica@example.com"
|
55
|
+
helperText="This is a hint text to help the user."
|
56
|
+
error="This is an error message."
|
57
|
+
LeadingIcon={<IconWrapper Icon={FiMail} />}
|
58
|
+
TrailingIcon={<IconWrapper Icon={FiHelpCircle} />}
|
59
|
+
disabled={args.disabled}
|
60
|
+
/>
|
61
|
+
</StoryLayout>
|
62
|
+
);
|
59
63
|
};
|
60
64
|
|
61
65
|
export const LeadingTextInput: StoryObj<Props> = {
|
62
66
|
args: {
|
63
67
|
darkMode: false,
|
68
|
+
value: ''
|
64
69
|
},
|
65
|
-
render: (args) => {
|
66
|
-
|
70
|
+
render: (args) => <LeadingTextInputStory {...args} />,
|
71
|
+
};
|
67
72
|
|
68
|
-
|
69
|
-
|
70
|
-
};
|
73
|
+
const LeadingTextInputStory = (args: Props) => {
|
74
|
+
const [text1, setText1] = useState<string>(args.value || "");
|
71
75
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
76
|
+
const handleChange = (e: ChangeEvent<HTMLInputElement>) => {
|
77
|
+
setText1(e.target.value);
|
78
|
+
};
|
79
|
+
|
80
|
+
return (
|
81
|
+
<StoryLayout {...args}>
|
82
|
+
<TextInput
|
83
|
+
{...args}
|
84
|
+
type="text"
|
85
|
+
value={text1}
|
86
|
+
handleChange={handleChange}
|
87
|
+
label="Website"
|
88
|
+
placeholder="example.com"
|
89
|
+
leadingText="https://"
|
90
|
+
helperText="This is a hint text to help the user."
|
91
|
+
TrailingIcon={<IconWrapper Icon={FiHelpCircle} />}
|
92
|
+
disabled={args.disabled}
|
93
|
+
/>
|
94
|
+
<div className="mb-4" />
|
95
|
+
<TextInput
|
96
|
+
{...args}
|
97
|
+
type="text"
|
98
|
+
value={text1}
|
99
|
+
handleChange={handleChange}
|
100
|
+
label="Website"
|
101
|
+
placeholder="example.com"
|
102
|
+
leadingText="https://"
|
103
|
+
error="This is an error message."
|
104
|
+
TrailingIcon={<IconWrapper Icon={FiAlertCircle} />}
|
105
|
+
disabled={args.disabled}
|
106
|
+
/>
|
107
|
+
</StoryLayout>
|
108
|
+
);
|
100
109
|
};
|
110
|
+
|
@@ -3,15 +3,13 @@ import { Meta, StoryObj } from "@storybook/react";
|
|
3
3
|
import { Typography, TypographyProps } from "../Typography";
|
4
4
|
import { StoryLayout } from "../StoryLayout";
|
5
5
|
|
6
|
-
|
6
|
+
export default {
|
7
7
|
title: "Example/Typography",
|
8
8
|
component: Typography,
|
9
9
|
parameters: {
|
10
10
|
layout: 'centered',
|
11
11
|
},
|
12
|
-
};
|
13
|
-
|
14
|
-
export default meta;
|
12
|
+
} as Meta;
|
15
13
|
|
16
14
|
interface Props extends TypographyProps {
|
17
15
|
darkMode: boolean;
|