trepur_components 2.3.3 → 2.3.5
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/.eslintrc.cjs +43 -0
- package/.husky/pre-commit +4 -0
- package/.prettierrc.json +22 -0
- package/archive/Breadcrumbs/Breadcrumbs.stories.tsx +46 -0
- package/archive/Breadcrumbs/index.tsx +42 -0
- package/archive/BreadcrumbsBordered/BreadcrumbsBordered.stories.tsx +52 -0
- package/archive/BreadcrumbsBordered/index.tsx +44 -0
- package/archive/BreadcrumbsItem/BreadcrumbsItem.stories.tsx +40 -0
- package/archive/BreadcrumbsItem/index.tsx +149 -0
- package/archive/Button/Button.stories.tsx +150 -0
- package/archive/Button/index.tsx +111 -0
- package/archive/Button/style.module.css +76 -0
- package/archive/Calendar/Calendar.stories.tsx +82 -0
- package/archive/Calendar/index.tsx +76 -0
- package/archive/Calendar/style.css +233 -0
- package/archive/Card/Card.stories.tsx +75 -0
- package/archive/Card/index.tsx +102 -0
- package/archive/Card/style.module.css +75 -0
- package/archive/CardWithTopImage/CardWithTopImage.stories.tsx +50 -0
- package/archive/CardWithTopImage/index.tsx +39 -0
- package/archive/CardWithTopImage/style.module.css +11 -0
- package/archive/Carousel/Carousel.stories.tsx +451 -0
- package/archive/Carousel/index.tsx +388 -0
- package/archive/Carousel/style.module.css +99 -0
- package/archive/CarouselThumbnail/CarouselThumbnail.stories.tsx +350 -0
- package/archive/CarouselThumbnail/index.tsx +302 -0
- package/archive/CarouselThumbnail/style.module.css +67 -0
- package/archive/Checkbox/Checkbox.mdx +33 -0
- package/archive/Checkbox/Checkbox.stories.tsx +34 -0
- package/archive/Checkbox/index.tsx +51 -0
- package/archive/Checkbox/style.module.css +15 -0
- package/archive/Collapsible/Collapsible.stories.tsx +67 -0
- package/archive/Collapsible/index.tsx +116 -0
- package/archive/Collapsible/style.module.css +47 -0
- package/archive/Column/Column.stories.tsx +89 -0
- package/archive/Column/index.tsx +119 -0
- package/archive/Column/style.module.css +151 -0
- package/archive/ComponentWrapper/ComponentWrapper.stories.tsx +40 -0
- package/archive/ComponentWrapper/index.tsx +55 -0
- package/archive/ComponentWrapper/style.module.css +40 -0
- package/archive/Container/Container.stories.tsx +40 -0
- package/archive/Container/index.tsx +24 -0
- package/archive/Container/style.module.css +4 -0
- package/archive/Counter/Counter.stories.tsx +19 -0
- package/archive/Counter/index.tsx +66 -0
- package/archive/Counter/style.module.css +19 -0
- package/archive/DetailUpdater/DetailUpdater.stories.tsx +96 -0
- package/archive/DetailUpdater/index.tsx +112 -0
- package/archive/DetailUpdater/style.module.css +31 -0
- package/archive/Dialog/Dialog.stories.tsx +131 -0
- package/archive/Dialog/index.tsx +91 -0
- package/archive/Dialog/style.module.css +44 -0
- package/archive/DropdownMenu/DropdownMenu.stories.tsx +59 -0
- package/archive/DropdownMenu/index.tsx +51 -0
- package/archive/DropdownMenu/style.module.css +38 -0
- package/archive/DynamicTextSection/DynamicTextSection.stories.tsx +74 -0
- package/archive/DynamicTextSection/index.tsx +36 -0
- package/archive/DynamicTextSection/style.module.css +0 -0
- package/archive/FileUploader/FilePreview.tsx +48 -0
- package/archive/FileUploader/FileUploader.stories.tsx +28 -0
- package/archive/FileUploader/index.tsx +135 -0
- package/archive/FileUploader/style.module.css +54 -0
- package/archive/FilterItem/FilterItem.stories.tsx +33 -0
- package/archive/FilterItem/index.tsx +101 -0
- package/archive/FilterItem/style.module.css +27 -0
- package/archive/Footer/Footer.stories.tsx +59 -0
- package/archive/Footer/index.tsx +50 -0
- package/archive/Footer/style.module.css +19 -0
- package/archive/FooterNav/FooterNav.stories.tsx +125 -0
- package/archive/FooterNav/index.tsx +57 -0
- package/archive/FooterNav/style.module.css +32 -0
- package/archive/FooterNavItem/FooterNavItem.stories.tsx +53 -0
- package/archive/FooterNavItem/index.tsx +80 -0
- package/archive/FooterNavItem/style.module.css +139 -0
- package/archive/Form/Form.stories.tsx +86 -0
- package/archive/Form/index.tsx +61 -0
- package/archive/Form/style.module.css +0 -0
- package/archive/FyreCard/FyreCard.stories.tsx +31 -0
- package/archive/FyreCard/index.tsx +52 -0
- package/archive/FyreCard/style.module.css +19 -0
- package/archive/Greeting/Greeting.stories.tsx +41 -0
- package/archive/Greeting/index.tsx +32 -0
- package/archive/HamburgerIcon/HamburgerIcon.stories.tsx +32 -0
- package/archive/HamburgerIcon/index.tsx +103 -0
- package/archive/HamburgerIcon/style.module.css +85 -0
- package/archive/HorizontalLine/HorizontalLine.stories.tsx +54 -0
- package/archive/HorizontalLine/index.tsx +40 -0
- package/archive/HorizontalLine/style.module.css +55 -0
- package/archive/Icon/Icon.stories.tsx +164 -0
- package/archive/Icon/index.tsx +115 -0
- package/archive/Icon/style.module.css +253 -0
- package/archive/IconCard/IconCard.stories.tsx +46 -0
- package/archive/IconCard/index.tsx +57 -0
- package/archive/IconCard/style.module.css +18 -0
- package/archive/Image/Image.stories.tsx +87 -0
- package/archive/Image/index.tsx +132 -0
- package/archive/Image/style.module.css +109 -0
- package/archive/ImageInfo/ImageInfo.stories.tsx +39 -0
- package/archive/ImageInfo/index.tsx +95 -0
- package/archive/ImageInfo/style.module.css +47 -0
- package/archive/ImageLink/ImageLink.stories.tsx +37 -0
- package/archive/ImageLink/index.tsx +49 -0
- package/archive/ImageLink/style.module.css +23 -0
- package/archive/ImageLinkList/ImageLinkList.stories.tsx +34 -0
- package/archive/ImageLinkList/index.tsx +33 -0
- package/archive/ImageLinkList/style.module.css +3 -0
- package/archive/InformationIcon/InformationIcon.stories.tsx +83 -0
- package/archive/InformationIcon/index.tsx +128 -0
- package/archive/InformationIcon/style.module.css +71 -0
- package/archive/InformationIconBlock/InformationIconBlock.stories.tsx +32 -0
- package/archive/InformationIconBlock/index.tsx +63 -0
- package/archive/InformationIconBlock/style.module.css +7 -0
- package/archive/Input/Input.stories.tsx +84 -0
- package/archive/Input/index.tsx +131 -0
- package/archive/Input/style.module.css +60 -0
- package/archive/Jumbotron/Jumbotron.stories.tsx +21 -0
- package/archive/Jumbotron/index.tsx +31 -0
- package/archive/Jumbotron/style.module.css +8 -0
- package/archive/MenuButton/MenuButton.stories.tsx +46 -0
- package/archive/MenuButton/index.tsx +82 -0
- package/archive/MenuButton/style.module.css +45 -0
- package/archive/Modal/Modal.stories.tsx +86 -0
- package/archive/Modal/index.tsx +74 -0
- package/archive/Modal/style.module.css +35 -0
- package/archive/NavItem/NavItem.stories.tsx +90 -0
- package/archive/NavItem/index.tsx +65 -0
- package/archive/NavItem/style.module.css +71 -0
- package/archive/NavOld/NavOld.stories.tsx +193 -0
- package/archive/NavOld/StickyNav.tsx +191 -0
- package/archive/NavOld/index.tsx +273 -0
- package/archive/NavOld/style.module.css +156 -0
- package/archive/NavTwo/Dropdown.tsx +35 -0
- package/archive/NavTwo/Nav.stories.tsx +38 -0
- package/archive/NavTwo/Sidebar.tsx +34 -0
- package/archive/NavTwo/StickyNav.tsx +34 -0
- package/archive/NavTwo/index.tsx +45 -0
- package/archive/NavTwo/style.module.css +35 -0
- package/archive/NewsCard/NewsCard.stories.tsx +72 -0
- package/archive/NewsCard/index.tsx +57 -0
- package/archive/NewsCard/style.module.css +15 -0
- package/archive/Pill/Pill.stories.tsx +44 -0
- package/archive/Pill/index.tsx +64 -0
- package/archive/Pill/style.module.css +32 -0
- package/archive/ProductCard/ProductCard.stories.tsx +61 -0
- package/archive/ProductCard/index.tsx +111 -0
- package/archive/ProductCard/style.module.css +53 -0
- package/archive/ProductCardV2/ProductCardV2.stories.tsx +50 -0
- package/archive/ProductCardV2/index.tsx +119 -0
- package/archive/ProductCardV2/style.module.css +59 -0
- package/archive/Proficiencies/Proficiencies.stories.tsx +50 -0
- package/archive/Proficiencies/index.tsx +63 -0
- package/archive/Proficiencies/style.module.css +31 -0
- package/archive/Profile/Profile.stories.tsx +49 -0
- package/archive/Profile/index.tsx +103 -0
- package/archive/Profile/style.module.css +47 -0
- package/archive/Row/Row.stories.tsx +53 -0
- package/archive/Row/index.tsx +23 -0
- package/archive/Row/style.module.css +3 -0
- package/archive/Search/Search.stories.tsx +63 -0
- package/archive/Search/index.tsx +68 -0
- package/archive/Search/style.module.css +23 -0
- package/archive/Select/Select.stories.tsx +56 -0
- package/archive/Select/index.tsx +106 -0
- package/archive/Select/style.module.css +52 -0
- package/archive/Showcase/Showcase.stories.tsx +30 -0
- package/archive/Showcase/index.tsx +75 -0
- package/archive/Showcase/style.module.css +47 -0
- package/archive/SideNav/SideNav.stories.tsx +50 -0
- package/archive/SideNav/index.tsx +46 -0
- package/archive/SideNav/style.module.css +43 -0
- package/archive/SocialBlock/SocialBlock.stories.tsx +58 -0
- package/archive/SocialBlock/index.tsx +63 -0
- package/archive/SocialButton/SocialButton.stories.tsx +88 -0
- package/archive/SocialButton/index.tsx +71 -0
- package/archive/SocialButton/style.module.css +77 -0
- package/archive/StarRating/StarRating.stories.tsx +23 -0
- package/archive/StarRating/index.tsx +71 -0
- package/archive/Testimonial/Testimonial.stories.tsx +110 -0
- package/archive/Testimonial/index.tsx +61 -0
- package/archive/Testimonial/style.module.css +27 -0
- package/archive/TextAndTitle/TextAndTitle.stories.tsx +70 -0
- package/archive/TextAndTitle/index.tsx +123 -0
- package/archive/TextAndTitle/style.module.css +75 -0
- package/archive/TextArea/TextArea.stories.tsx +55 -0
- package/archive/TextArea/index.tsx +125 -0
- package/archive/TextArea/style.module.css +60 -0
- package/archive/Timeline/Timeline.stories.tsx +92 -0
- package/archive/Timeline/index.tsx +254 -0
- package/archive/Timeline/style.module.css +134 -0
- package/archive/TimelineV2/TimelineV2.stories.tsx +95 -0
- package/archive/TimelineV2/index.tsx +70 -0
- package/archive/TimelineV2/style.module.css +28 -0
- package/archive/Tubestops/Tubestops.stories.tsx +42 -0
- package/archive/Tubestops/index.tsx +58 -0
- package/archive/Tubestops/style.module.css +54 -0
- package/archive/UserIcon/UserIcon.stories.tsx +52 -0
- package/archive/UserIcon/index.tsx +46 -0
- package/archive/UserIcon/style.module.css +19 -0
- package/archive/Video/Video.stories.tsx +23 -0
- package/archive/Video/index.tsx +47 -0
- package/archive/fonts/Sora/OFL.txt +93 -0
- package/archive/fonts/Sora/README.txt +70 -0
- package/archive/fonts/Sora/Sora-VariableFont_wght.ttf +0 -0
- package/archive/fonts/Sora/static/Sora-Bold.ttf +0 -0
- package/archive/fonts/Sora/static/Sora-ExtraBold.ttf +0 -0
- package/archive/fonts/Sora/static/Sora-ExtraLight.ttf +0 -0
- package/archive/fonts/Sora/static/Sora-Light.ttf +0 -0
- package/archive/fonts/Sora/static/Sora-Medium.ttf +0 -0
- package/archive/fonts/Sora/static/Sora-Regular.ttf +0 -0
- package/archive/fonts/Sora/static/Sora-SemiBold.ttf +0 -0
- package/archive/fonts/Sora/static/Sora-Thin.ttf +0 -0
- package/archive/theme.ts +39 -0
- package/archive/typography/Fonts/Fonts.stories.tsx +14 -0
- package/archive/typography/Fonts/Fonts.tsx +181 -0
- package/lib/components/Accordion/index.js +10 -10
- package/lib/components/AlertBar/index.js +10 -10
- package/lib/components/index.d.ts +4 -0
- package/lib/index.js +1 -7
- package/lib/styles/base.css +1 -0
- package/package.json +6 -8
- package/postcss.config.js +8 -0
- package/src/components/Accordion/Accordion.stories.tsx +116 -0
- package/src/components/Accordion/index.tsx +30 -0
- package/src/components/AlertBar/AlertBar.stories.tsx +95 -0
- package/src/components/AlertBar/index.tsx +115 -0
- package/src/components/Avatar/Avatar.stories.tsx +19 -0
- package/src/components/Avatar/index.tsx +495 -0
- package/src/components/index.ts +119 -0
- package/src/documentation/Colours.mdx +192 -0
- package/src/documentation/Introduction.mdx +9 -0
- package/src/index.ts +1 -0
- package/src/styles/base.css +117 -0
- package/src/utils/controls.ts +44 -0
- package/src/utils/matchMedia.ts +9 -0
- package/src/utils/screens.ts +7 -0
- package/svg.d.ts +4 -0
- package/tailwind.config.ts +81 -0
- package/tsconfig.json +43 -0
- package/tsconfig.node.json +12 -0
- package/vite.config.mjs +64 -0
- package/lib/archive/Breadcrumbs/index.js +0 -12
- package/lib/archive/BreadcrumbsBordered/index.js +0 -25
- package/lib/archive/BreadcrumbsItem/index.js +0 -117
- package/lib/src/components/index.d.ts +0 -7
- /package/lib/{src/components → components}/Accordion/Accordion.stories.d.ts +0 -0
- /package/lib/{src/components → components}/Accordion/index.d.ts +0 -0
- /package/lib/{src/components → components}/AlertBar/AlertBar.stories.d.ts +0 -0
- /package/lib/{src/components → components}/AlertBar/index.d.ts +0 -0
- /package/lib/{src/components → components}/Avatar/Avatar.stories.d.ts +0 -0
- /package/lib/{src/components → components}/Avatar/index.d.ts +0 -0
- /package/lib/{src/index.d.ts → index.d.ts} +0 -0
- /package/lib/{src/utils → utils}/controls.d.ts +0 -0
- /package/lib/{src/utils → utils}/matchMedia.d.ts +0 -0
- /package/lib/{src/utils → utils}/screens.d.ts +0 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import Image from '@components/Image';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
|
|
6
|
+
import FilePreview from './FilePreview';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
id?: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
ctaText: string;
|
|
13
|
+
text?: string;
|
|
14
|
+
|
|
15
|
+
imageUrl?: string;
|
|
16
|
+
onDrop?: ([]) => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const FileUploader: React.FC<Props> = ({
|
|
20
|
+
id,
|
|
21
|
+
className,
|
|
22
|
+
ctaText,
|
|
23
|
+
text,
|
|
24
|
+
|
|
25
|
+
imageUrl,
|
|
26
|
+
onDrop,
|
|
27
|
+
}) => {
|
|
28
|
+
const [inDropZone, setInDropZone] = useState(false);
|
|
29
|
+
const [fileList, setFileList] = useState<any>([]);
|
|
30
|
+
|
|
31
|
+
const classList = classNames(
|
|
32
|
+
{
|
|
33
|
+
[style.inDropZone]: inDropZone,
|
|
34
|
+
},
|
|
35
|
+
className,
|
|
36
|
+
style.dropzone,
|
|
37
|
+
'theme-local',
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
const handleDragEnter = (e: any): void => {
|
|
41
|
+
e.preventDefault();
|
|
42
|
+
e.stopPropagation();
|
|
43
|
+
setInDropZone(true);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const handleDragLeave = (e: any): void => {
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
e.stopPropagation();
|
|
49
|
+
setInDropZone(false);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const handleDragOver = (e: any): void => {
|
|
53
|
+
e.preventDefault();
|
|
54
|
+
e.stopPropagation();
|
|
55
|
+
setInDropZone(true);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const handleDrop = (e: any): void => {
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
e.stopPropagation();
|
|
61
|
+
|
|
62
|
+
let files = [...e.dataTransfer.files];
|
|
63
|
+
|
|
64
|
+
if (files?.length > 0) {
|
|
65
|
+
const existingFiles = fileList?.fileList?.map((f: any) => f.name);
|
|
66
|
+
files = files.filter((f) => !existingFiles?.includes(f.name));
|
|
67
|
+
|
|
68
|
+
setFileList(files);
|
|
69
|
+
setInDropZone(false);
|
|
70
|
+
}
|
|
71
|
+
onDrop?.(files);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const handleFileSelect = (e: any): void => {
|
|
75
|
+
let files = [...e.target.files];
|
|
76
|
+
|
|
77
|
+
if (files?.length > 0) {
|
|
78
|
+
const existingFiles = fileList?.fileList?.map((f: any) => f.name);
|
|
79
|
+
files = files.filter((f) => !existingFiles?.includes(f.name));
|
|
80
|
+
setFileList(files);
|
|
81
|
+
onDrop?.(files);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const handleDismiss = (fileName: string): void => {
|
|
86
|
+
setFileList(fileList.filter((file: any) => file.name !== fileName));
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<div
|
|
91
|
+
id={id}
|
|
92
|
+
className={classList}
|
|
93
|
+
onDragEnter={(e) => {
|
|
94
|
+
handleDragEnter(e);
|
|
95
|
+
}}
|
|
96
|
+
onDragOver={(e) => {
|
|
97
|
+
handleDragOver(e);
|
|
98
|
+
}}
|
|
99
|
+
onDragLeave={(e) => {
|
|
100
|
+
handleDragLeave(e);
|
|
101
|
+
}}
|
|
102
|
+
onDrop={(e) => {
|
|
103
|
+
handleDrop(e);
|
|
104
|
+
}}
|
|
105
|
+
>
|
|
106
|
+
{imageUrl && (
|
|
107
|
+
<Image src={imageUrl} altText="upload" height={5} width={5} />
|
|
108
|
+
)}
|
|
109
|
+
|
|
110
|
+
<input
|
|
111
|
+
id="fileSelect"
|
|
112
|
+
type="file"
|
|
113
|
+
multiple
|
|
114
|
+
className={style.files}
|
|
115
|
+
onChange={(e) => {
|
|
116
|
+
handleFileSelect(e);
|
|
117
|
+
}}
|
|
118
|
+
/>
|
|
119
|
+
|
|
120
|
+
<label className={style.label} htmlFor="fileSelect">
|
|
121
|
+
{ctaText}
|
|
122
|
+
</label>
|
|
123
|
+
|
|
124
|
+
<h3 className={style.uploadMessage}>{text}</h3>
|
|
125
|
+
<FilePreview
|
|
126
|
+
fileData={fileList}
|
|
127
|
+
onDismiss={(e) => {
|
|
128
|
+
handleDismiss(e);
|
|
129
|
+
}}
|
|
130
|
+
/>
|
|
131
|
+
</div>
|
|
132
|
+
);
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export default FileUploader;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
.dropzone {
|
|
2
|
+
@apply flex flex-col items-center justify-center;
|
|
3
|
+
@apply rounded-2xl border-4 border-dashed border-light-grey py-8;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.active {
|
|
7
|
+
@apply border-4 border-dashed;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.uploadMessage h3 {
|
|
11
|
+
@apply mt-8;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.files {
|
|
15
|
+
@apply absolute h-px w-px overflow-hidden border-none p-0;
|
|
16
|
+
@apply whitespace-nowrap;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.files + label {
|
|
20
|
+
@apply mb-2 mt-4 inline-block cursor-pointer text-center;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.label {
|
|
24
|
+
@apply rounded-2xl border-2 border-primary bg-primary px-4 py-1 text-white;
|
|
25
|
+
@apply hover:bg-white hover:text-primary;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.uploadBtn {
|
|
29
|
+
@apply m-2 w-auto cursor-pointer rounded-2xl text-center;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.fileList {
|
|
33
|
+
@apply flex w-full flex-wrap px-8 pt-4;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.file {
|
|
37
|
+
@apply mx-2 rounded-2xl border bg-secondary text-white;
|
|
38
|
+
@apply cursor-pointer hover:bg-primary;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.nameWrapper {
|
|
42
|
+
@apply flex w-full justify-between px-4 py-1;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.name {
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.dismiss {
|
|
49
|
+
@apply ml-2 cursor-pointer;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.inDropZone {
|
|
53
|
+
@apply bg-lightest-grey;
|
|
54
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { action } from '@storybook/addon-actions';
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { idAndClassName } from '@utils/controls';
|
|
4
|
+
|
|
5
|
+
import FilterItem from '.';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Components/FilterItem',
|
|
9
|
+
component: FilterItem,
|
|
10
|
+
parameters: {},
|
|
11
|
+
argTypes: {
|
|
12
|
+
...idAndClassName,
|
|
13
|
+
|
|
14
|
+
title: {
|
|
15
|
+
description: '',
|
|
16
|
+
control: 'text',
|
|
17
|
+
table: {
|
|
18
|
+
category: '',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
args: {
|
|
23
|
+
title: 'This is a title',
|
|
24
|
+
filters: ['filter 1', 'filter 2', 'filter 3', 'filter 4', 'filter 5'],
|
|
25
|
+
onClick: action('clicked'),
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default meta;
|
|
30
|
+
|
|
31
|
+
type Story = StoryObj<typeof meta>;
|
|
32
|
+
|
|
33
|
+
export const Default: Story = {};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
import Checkbox from '@components/Checkbox';
|
|
4
|
+
import Icon from '@components/Icon';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export interface Props {
|
|
10
|
+
id?: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
filters?: string[];
|
|
14
|
+
onClick?: () => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const FilterItem = ({
|
|
18
|
+
id,
|
|
19
|
+
className,
|
|
20
|
+
title,
|
|
21
|
+
filters,
|
|
22
|
+
onClick,
|
|
23
|
+
}: Props): JSX.Element => {
|
|
24
|
+
const [expanded, setExpanded] = useState(false);
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
const coll = document.getElementsByClassName('FilterItem');
|
|
28
|
+
let i: number;
|
|
29
|
+
|
|
30
|
+
for (i = 0; i < coll.length; i++) {
|
|
31
|
+
coll[i].addEventListener('click', function (this: any, err: any) {
|
|
32
|
+
const content = this.nextElementSibling;
|
|
33
|
+
|
|
34
|
+
const scrollHeight: string = content.scrollHeight.toString();
|
|
35
|
+
if (content.style.maxHeight === '0px') {
|
|
36
|
+
content.style.maxHeight = `${scrollHeight}px`;
|
|
37
|
+
} else {
|
|
38
|
+
content.style.maxHeight = '0px';
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const classList = classNames(
|
|
45
|
+
className,
|
|
46
|
+
style.classList,
|
|
47
|
+
'transition-opactiy theme-local',
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const contentWrapperClassList = classNames(
|
|
51
|
+
{
|
|
52
|
+
[style.expanded]: expanded,
|
|
53
|
+
[style.collapsed]: !expanded,
|
|
54
|
+
},
|
|
55
|
+
style.contentWrapperClassList,
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const expandItem = (e: any): void => {
|
|
59
|
+
const content = e.currentTarget.nextElementSibling;
|
|
60
|
+
const scrollHeight: string = content.scrollHeight.toString();
|
|
61
|
+
if (!expanded) {
|
|
62
|
+
content.style.maxHeight = `${scrollHeight}px`;
|
|
63
|
+
} else {
|
|
64
|
+
content.style.maxHeight = '0px';
|
|
65
|
+
}
|
|
66
|
+
setExpanded(!expanded);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<div id={id} className={classList}>
|
|
71
|
+
<div
|
|
72
|
+
onClick={(e) => {
|
|
73
|
+
expandItem(e);
|
|
74
|
+
}}
|
|
75
|
+
className={style.headingClassList}
|
|
76
|
+
>
|
|
77
|
+
<h4>{title}</h4>
|
|
78
|
+
<Icon
|
|
79
|
+
type={expanded ? 'chevron-up' : 'chevron-down'}
|
|
80
|
+
colour="black"
|
|
81
|
+
bgColour="white"
|
|
82
|
+
hoverColour="black"
|
|
83
|
+
hoverBgColour="white"
|
|
84
|
+
/>
|
|
85
|
+
</div>
|
|
86
|
+
<div className={contentWrapperClassList}>
|
|
87
|
+
<ul>
|
|
88
|
+
{filters?.map((filter, i) => {
|
|
89
|
+
return (
|
|
90
|
+
<li className={style.li} key={`filter_${i}`}>
|
|
91
|
+
<Checkbox label={filter} onClick={onClick} />
|
|
92
|
+
</li>
|
|
93
|
+
);
|
|
94
|
+
})}
|
|
95
|
+
</ul>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export default FilterItem;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
.classList {
|
|
2
|
+
@apply duration-300;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.headingClassList {
|
|
6
|
+
@apply flex w-full justify-between border-b px-6 py-3;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.contentWrapperClassList {
|
|
10
|
+
@apply w-auto overflow-hidden px-4;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.childrenClassList {
|
|
14
|
+
@apply w-full pr-8 text-right;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.expanded {
|
|
18
|
+
@apply my-2 max-h-max;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.collapsed {
|
|
22
|
+
@apply max-h-0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.li {
|
|
26
|
+
@apply py-1;
|
|
27
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { action } from '@storybook/addon-actions';
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { idAndClassName } from '@utils/controls';
|
|
4
|
+
|
|
5
|
+
import Footer from '.';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Components/Footer',
|
|
9
|
+
component: Footer,
|
|
10
|
+
parameters: {},
|
|
11
|
+
argTypes: {
|
|
12
|
+
...idAndClassName,
|
|
13
|
+
text: {
|
|
14
|
+
type: { name: 'string', required: false },
|
|
15
|
+
description: 'The text to show on the component',
|
|
16
|
+
table: {
|
|
17
|
+
type: { summary: 'default' },
|
|
18
|
+
},
|
|
19
|
+
defaultValue: { summary: 'undefined' },
|
|
20
|
+
},
|
|
21
|
+
buttonProps: {
|
|
22
|
+
type: { name: 'other', value: 'object' },
|
|
23
|
+
description:
|
|
24
|
+
'The props to pass to the button to display on the component',
|
|
25
|
+
table: {
|
|
26
|
+
type: {
|
|
27
|
+
summary: 'object',
|
|
28
|
+
},
|
|
29
|
+
defaultValue: { summary: 'undefined' },
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
variant: {
|
|
33
|
+
type: { name: 'string', required: false },
|
|
34
|
+
options: ['dark', 'light'],
|
|
35
|
+
description: 'The variant of button to render',
|
|
36
|
+
table: {
|
|
37
|
+
type: { summary: 'light' },
|
|
38
|
+
defaultValue: { summary: 'light' },
|
|
39
|
+
},
|
|
40
|
+
defaultValue: 'light',
|
|
41
|
+
control: { type: 'radio' },
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
args: {
|
|
45
|
+
text: 'Copyright All rights reserved',
|
|
46
|
+
variant: 'dark',
|
|
47
|
+
buttonProps: {
|
|
48
|
+
children: 'Admin Panel',
|
|
49
|
+
onClick: action('button clicked'),
|
|
50
|
+
href: '/',
|
|
51
|
+
target: '_blank',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
export default meta;
|
|
56
|
+
|
|
57
|
+
type Story = StoryObj<typeof meta>;
|
|
58
|
+
|
|
59
|
+
export const Default: Story = {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import Button, { type Props as buttonProps } from '@components/Button';
|
|
4
|
+
import Container from '@components/Container';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export interface Props {
|
|
10
|
+
id?: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
buttonProps?: buttonProps;
|
|
13
|
+
text?: string;
|
|
14
|
+
variant?: 'light' | 'dark';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const Footer = ({
|
|
18
|
+
id,
|
|
19
|
+
className,
|
|
20
|
+
text,
|
|
21
|
+
buttonProps,
|
|
22
|
+
variant,
|
|
23
|
+
}: Props): JSX.Element => {
|
|
24
|
+
const colours = variant === 'dark' ? [style.dark] : [style.light];
|
|
25
|
+
const classList = classNames(className, colours, 'theme-local');
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<div id={id} className={classList}>
|
|
29
|
+
<Container withPadding className={style.classList}>
|
|
30
|
+
<p className={style.textClassList}>{text}</p>
|
|
31
|
+
<div className={style.buttonClassList}>
|
|
32
|
+
{buttonProps?.children !== undefined &&
|
|
33
|
+
(buttonProps?.href !== undefined ||
|
|
34
|
+
buttonProps?.onClick !== undefined) && (
|
|
35
|
+
<Button
|
|
36
|
+
variant={variant === 'dark' ? 'primary' : 'secondary'}
|
|
37
|
+
rounded
|
|
38
|
+
href={buttonProps?.href}
|
|
39
|
+
onClick={buttonProps?.onClick}
|
|
40
|
+
>
|
|
41
|
+
{buttonProps?.children}
|
|
42
|
+
</Button>
|
|
43
|
+
)}
|
|
44
|
+
</div>
|
|
45
|
+
</Container>
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default Footer;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.classList {
|
|
2
|
+
@apply block h-auto flex-wrap items-center justify-between md:flex;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.textClassList {
|
|
6
|
+
@apply pb-4 pt-8 text-center md:my-8 md:pb-0 md:pt-0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.buttonClassList {
|
|
10
|
+
@apply pb-8 pt-4 text-center md:pb-0 md:pt-0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.dark {
|
|
14
|
+
@apply bg-primary text-white;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.light {
|
|
18
|
+
@apply bg-white text-primary;
|
|
19
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { action } from '@storybook/addon-actions';
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { idAndClassName } from '@utils/controls';
|
|
4
|
+
|
|
5
|
+
import FooterNav from '.';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Components/Footer Nav',
|
|
9
|
+
component: FooterNav,
|
|
10
|
+
argTypes: {
|
|
11
|
+
...idAndClassName,
|
|
12
|
+
title: {
|
|
13
|
+
type: { name: 'string', required: true },
|
|
14
|
+
description: 'The title to display on the component',
|
|
15
|
+
table: {
|
|
16
|
+
type: { summary: 'string' },
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
subtitle: {
|
|
20
|
+
type: { name: 'string', value: 'string | number' },
|
|
21
|
+
description: 'The subtitle to display on the component',
|
|
22
|
+
table: {
|
|
23
|
+
type: {
|
|
24
|
+
summary: 'string',
|
|
25
|
+
},
|
|
26
|
+
defaultValue: { summary: 'undefined' },
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
withAnimation: {
|
|
30
|
+
type: { name: 'boolean', required: false },
|
|
31
|
+
description: 'Enabled the counter animation on the component',
|
|
32
|
+
table: {
|
|
33
|
+
type: { summary: 'boolean' },
|
|
34
|
+
},
|
|
35
|
+
defaultValue: 'false',
|
|
36
|
+
},
|
|
37
|
+
withHoverEffect: {
|
|
38
|
+
type: { name: 'boolean', required: false },
|
|
39
|
+
description: 'Enabled the hover effect on the component',
|
|
40
|
+
table: {
|
|
41
|
+
type: { summary: 'boolean' },
|
|
42
|
+
},
|
|
43
|
+
defaultValue: 'true',
|
|
44
|
+
},
|
|
45
|
+
iconProps: {
|
|
46
|
+
type: { name: 'iconProps', required: false },
|
|
47
|
+
description: 'The props to pass to the icon to display on the component',
|
|
48
|
+
table: {
|
|
49
|
+
type: { summary: 'iconProps' },
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
large: {
|
|
54
|
+
description: 'Defines the top and bottom padding size',
|
|
55
|
+
control: 'boolean',
|
|
56
|
+
table: {
|
|
57
|
+
type: { summary: 'boolean' },
|
|
58
|
+
defaultValue: { summary: 'true' },
|
|
59
|
+
},
|
|
60
|
+
defaultValue: 'true',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
args: {
|
|
64
|
+
backgroundColour: 'white',
|
|
65
|
+
colour: 'grey',
|
|
66
|
+
hoverColour: 'primary',
|
|
67
|
+
footerItems: [
|
|
68
|
+
{
|
|
69
|
+
title: 'wishlists',
|
|
70
|
+
href: '#',
|
|
71
|
+
iconProps: {
|
|
72
|
+
type: 'heart',
|
|
73
|
+
size: 2,
|
|
74
|
+
hollow: true,
|
|
75
|
+
},
|
|
76
|
+
onClick: action('clicked wishlist'),
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
title: 'Profile',
|
|
80
|
+
href: '#',
|
|
81
|
+
iconProps: {
|
|
82
|
+
type: 'star',
|
|
83
|
+
size: 2,
|
|
84
|
+
hollow: true,
|
|
85
|
+
},
|
|
86
|
+
onClick: action('clicked profile'),
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
title: 'sun',
|
|
90
|
+
href: '#',
|
|
91
|
+
iconProps: {
|
|
92
|
+
type: 'sun',
|
|
93
|
+
size: 2,
|
|
94
|
+
hollow: true,
|
|
95
|
+
},
|
|
96
|
+
onClick: action('clicked sun'),
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
title: 'moon',
|
|
100
|
+
href: '#',
|
|
101
|
+
iconProps: {
|
|
102
|
+
type: 'moon',
|
|
103
|
+
size: 2,
|
|
104
|
+
hollow: true,
|
|
105
|
+
},
|
|
106
|
+
onClick: action('clicked moon'),
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
title: 'snowflake',
|
|
110
|
+
href: '#',
|
|
111
|
+
iconProps: {
|
|
112
|
+
type: 'snowflake',
|
|
113
|
+
size: 2,
|
|
114
|
+
hollow: true,
|
|
115
|
+
},
|
|
116
|
+
onClick: action('clicked snowflake'),
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
export default meta;
|
|
122
|
+
|
|
123
|
+
type Story = StoryObj<typeof meta>;
|
|
124
|
+
|
|
125
|
+
export const Default: Story = {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import FooterNavItem, {
|
|
4
|
+
type Props as FooterNavItemProps,
|
|
5
|
+
} from '@components/FooterNavItem';
|
|
6
|
+
import { type Colours } from '@utils/controls';
|
|
7
|
+
import classNames from 'classnames';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
export interface Props {
|
|
12
|
+
id: string;
|
|
13
|
+
className?: string;
|
|
14
|
+
backgroundColour?: Colours;
|
|
15
|
+
colour?: Colours;
|
|
16
|
+
hoverColour?: Colours;
|
|
17
|
+
hoverBgColour?: Colours;
|
|
18
|
+
|
|
19
|
+
footerItems: FooterNavItemProps[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const FooterNav = ({
|
|
23
|
+
id,
|
|
24
|
+
className,
|
|
25
|
+
backgroundColour = 'white',
|
|
26
|
+
colour = 'black',
|
|
27
|
+
hoverColour = 'black',
|
|
28
|
+
hoverBgColour = 'black',
|
|
29
|
+
footerItems,
|
|
30
|
+
}: Props): JSX.Element => {
|
|
31
|
+
const classList = classNames(
|
|
32
|
+
className,
|
|
33
|
+
style.classList,
|
|
34
|
+
style[backgroundColour],
|
|
35
|
+
'theme-local',
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div id={id} className={classList}>
|
|
40
|
+
{footerItems?.map((footerItem: any, i) => {
|
|
41
|
+
footerItem.iconProps.colour = colour;
|
|
42
|
+
footerItem.iconProps.hoverColour = hoverColour;
|
|
43
|
+
footerItem.iconProps.hoverBgColour = hoverBgColour;
|
|
44
|
+
footerItem.iconProps.size = 2;
|
|
45
|
+
return (
|
|
46
|
+
<FooterNavItem
|
|
47
|
+
key={i}
|
|
48
|
+
{...footerItem}
|
|
49
|
+
backgroundColour={backgroundColour}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
})}
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export default FooterNav;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.classList {
|
|
2
|
+
@apply fixed bottom-0 flex w-full justify-between px-4;
|
|
3
|
+
@apply border-t border-lightest-grey;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.primary {
|
|
7
|
+
@apply bg-primary text-white;
|
|
8
|
+
}
|
|
9
|
+
.secondary {
|
|
10
|
+
@apply bg-secondary text-white;
|
|
11
|
+
}
|
|
12
|
+
.white {
|
|
13
|
+
@apply bg-white text-black;
|
|
14
|
+
}
|
|
15
|
+
.grey {
|
|
16
|
+
@apply bg-lightest-grey text-black;
|
|
17
|
+
}
|
|
18
|
+
.black {
|
|
19
|
+
@apply bg-black text-white;
|
|
20
|
+
}
|
|
21
|
+
.success {
|
|
22
|
+
@apply bg-success text-white;
|
|
23
|
+
}
|
|
24
|
+
.error {
|
|
25
|
+
@apply bg-error text-white;
|
|
26
|
+
}
|
|
27
|
+
.facebook {
|
|
28
|
+
@apply bg-facebook text-white;
|
|
29
|
+
}
|
|
30
|
+
.gold {
|
|
31
|
+
@apply bg-gold text-white;
|
|
32
|
+
}
|