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,63 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import ComponentWrapper from '@components/ComponentWrapper';
|
|
4
|
+
import Container from '@components/Container';
|
|
5
|
+
import { type Props as iconProps } from '@components/Icon';
|
|
6
|
+
import InformationIcon from '@components/InformationIcon';
|
|
7
|
+
import { type Colours } from '@utils/controls';
|
|
8
|
+
import classNames from 'classnames';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
export interface Props {
|
|
13
|
+
id?: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
title?: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
bgColour?: Colours;
|
|
18
|
+
icons?: iconProps[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const InformationIconBlock = ({
|
|
22
|
+
id,
|
|
23
|
+
className,
|
|
24
|
+
title,
|
|
25
|
+
description,
|
|
26
|
+
bgColour,
|
|
27
|
+
icons,
|
|
28
|
+
}: Props): JSX.Element => {
|
|
29
|
+
const classList = classNames(className, 'theme-local');
|
|
30
|
+
return (
|
|
31
|
+
<ComponentWrapper
|
|
32
|
+
id={id}
|
|
33
|
+
className={classList}
|
|
34
|
+
title={title}
|
|
35
|
+
description={description}
|
|
36
|
+
bgColour={bgColour}
|
|
37
|
+
>
|
|
38
|
+
<Container className={style.iconWrapper} withPadding={false}>
|
|
39
|
+
{icons?.map((icon: any, i: number) => {
|
|
40
|
+
return (
|
|
41
|
+
<InformationIcon
|
|
42
|
+
key={i}
|
|
43
|
+
iconProps={{
|
|
44
|
+
size: 2,
|
|
45
|
+
type: icon.type,
|
|
46
|
+
colour: 'primary',
|
|
47
|
+
bgColour: 'white',
|
|
48
|
+
hoverColour: 'primary',
|
|
49
|
+
hoverBgColour: 'white',
|
|
50
|
+
}}
|
|
51
|
+
id={icon.name.replace(/\s+/g, '')}
|
|
52
|
+
title={icon.name}
|
|
53
|
+
subtitle={icon.value}
|
|
54
|
+
withAnimation
|
|
55
|
+
/>
|
|
56
|
+
);
|
|
57
|
+
})}
|
|
58
|
+
</Container>
|
|
59
|
+
</ComponentWrapper>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export default InformationIconBlock;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { idAndClassName } from '@utils/controls';
|
|
3
|
+
|
|
4
|
+
import Input from '.';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/Input',
|
|
8
|
+
component: Input,
|
|
9
|
+
parameters: {},
|
|
10
|
+
argTypes: {
|
|
11
|
+
...idAndClassName,
|
|
12
|
+
|
|
13
|
+
label: {
|
|
14
|
+
description: '',
|
|
15
|
+
control: 'text',
|
|
16
|
+
table: {
|
|
17
|
+
category: '',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
placeholder: {
|
|
21
|
+
description: '',
|
|
22
|
+
control: 'text',
|
|
23
|
+
table: {
|
|
24
|
+
category: '',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
bold: {
|
|
28
|
+
description: '',
|
|
29
|
+
control: 'boolean',
|
|
30
|
+
table: {
|
|
31
|
+
category: '',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
required: {
|
|
35
|
+
description: '',
|
|
36
|
+
control: 'boolean',
|
|
37
|
+
table: {
|
|
38
|
+
category: '',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
withValidation: {
|
|
42
|
+
description: '',
|
|
43
|
+
control: 'boolean',
|
|
44
|
+
table: {
|
|
45
|
+
category: '',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
errors: {
|
|
49
|
+
description: 'An array of errors to display',
|
|
50
|
+
control: 'array',
|
|
51
|
+
table: {
|
|
52
|
+
category: '',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
value: {
|
|
56
|
+
description: 'The default value of the input',
|
|
57
|
+
control: 'text',
|
|
58
|
+
table: {
|
|
59
|
+
category: '',
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
bgColour: {
|
|
63
|
+
type: { name: 'string', required: false },
|
|
64
|
+
options: ['primary', 'secondary', 'white', 'black', 'gold'],
|
|
65
|
+
description: 'The background colour of the component',
|
|
66
|
+
table: {
|
|
67
|
+
type: { summary: 'string' },
|
|
68
|
+
},
|
|
69
|
+
defaultValue: 'primary',
|
|
70
|
+
control: 'select',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
args: {
|
|
74
|
+
label: 'This is a label',
|
|
75
|
+
placeholder: 'This is a placeholder',
|
|
76
|
+
errors: [],
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export default meta;
|
|
81
|
+
|
|
82
|
+
type Story = StoryObj<typeof meta>;
|
|
83
|
+
|
|
84
|
+
export const Default: Story = {};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
|
|
3
|
+
import { type Colours } from '@utils/controls';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export interface Props {
|
|
9
|
+
id?: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
autoComplete?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
formId?: string;
|
|
14
|
+
height?: string;
|
|
15
|
+
maxLength?: number;
|
|
16
|
+
minLength?: number;
|
|
17
|
+
pattern?: string;
|
|
18
|
+
required?: boolean;
|
|
19
|
+
readOnly?: boolean;
|
|
20
|
+
label?: string;
|
|
21
|
+
type?: string;
|
|
22
|
+
name?: string;
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
withValidation?: boolean;
|
|
25
|
+
onChange?: (e: any) => void;
|
|
26
|
+
onBlur?: () => void;
|
|
27
|
+
onFocus?: () => void;
|
|
28
|
+
onClick?: () => void;
|
|
29
|
+
errors?: string[];
|
|
30
|
+
errorState?: boolean;
|
|
31
|
+
value?: string;
|
|
32
|
+
bgColour?: Colours;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const Input = ({
|
|
36
|
+
id,
|
|
37
|
+
className,
|
|
38
|
+
autoComplete,
|
|
39
|
+
disabled,
|
|
40
|
+
formId,
|
|
41
|
+
height,
|
|
42
|
+
maxLength,
|
|
43
|
+
minLength,
|
|
44
|
+
pattern,
|
|
45
|
+
required = false,
|
|
46
|
+
readOnly,
|
|
47
|
+
label,
|
|
48
|
+
type,
|
|
49
|
+
name,
|
|
50
|
+
placeholder,
|
|
51
|
+
onChange,
|
|
52
|
+
onBlur,
|
|
53
|
+
onFocus,
|
|
54
|
+
onClick,
|
|
55
|
+
withValidation,
|
|
56
|
+
errors,
|
|
57
|
+
errorState = false,
|
|
58
|
+
value,
|
|
59
|
+
}: Props): JSX.Element => {
|
|
60
|
+
const newId = id !== undefined ? `-${id}` : '';
|
|
61
|
+
|
|
62
|
+
const valueClassList = classNames(
|
|
63
|
+
{
|
|
64
|
+
[style.errorState]: errors != null || errorState,
|
|
65
|
+
},
|
|
66
|
+
style.value,
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const labelClassList = classNames(
|
|
70
|
+
{
|
|
71
|
+
[style.labelError]: errors != null || errorState,
|
|
72
|
+
},
|
|
73
|
+
style.label,
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const headerClassList = classNames(style.classList, className, 'theme-local');
|
|
77
|
+
|
|
78
|
+
const btnRef = useRef<any>(null);
|
|
79
|
+
|
|
80
|
+
const handleClick = (): void => {
|
|
81
|
+
btnRef.current?.focus();
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<>
|
|
86
|
+
<div id={id} className={headerClassList} onClick={handleClick}>
|
|
87
|
+
<div className={style.labelWrapper}>
|
|
88
|
+
<p className={labelClassList}>{label}</p>
|
|
89
|
+
{required && <p className={style.required}> *</p>}
|
|
90
|
+
</div>
|
|
91
|
+
<input
|
|
92
|
+
ref={btnRef}
|
|
93
|
+
id={`input${newId}`}
|
|
94
|
+
className={valueClassList}
|
|
95
|
+
autoComplete={autoComplete}
|
|
96
|
+
disabled={disabled}
|
|
97
|
+
form={formId}
|
|
98
|
+
height={height}
|
|
99
|
+
maxLength={maxLength}
|
|
100
|
+
minLength={minLength}
|
|
101
|
+
pattern={pattern}
|
|
102
|
+
required={required}
|
|
103
|
+
readOnly={readOnly}
|
|
104
|
+
type={type}
|
|
105
|
+
name={name}
|
|
106
|
+
value={value}
|
|
107
|
+
placeholder={placeholder}
|
|
108
|
+
onChange={(e) => {
|
|
109
|
+
onChange?.(e);
|
|
110
|
+
}}
|
|
111
|
+
onBlur={onBlur}
|
|
112
|
+
onFocus={onFocus}
|
|
113
|
+
onClick={onClick}
|
|
114
|
+
/>
|
|
115
|
+
</div>
|
|
116
|
+
{withValidation && (
|
|
117
|
+
<div id={`errors${newId}`} className={classNames(style.errors)}>
|
|
118
|
+
{errors?.map((error, i) => {
|
|
119
|
+
return (
|
|
120
|
+
<p key={`error-msg-${i + 0}`} className={style.errorText}>
|
|
121
|
+
{error}
|
|
122
|
+
</p>
|
|
123
|
+
);
|
|
124
|
+
})}
|
|
125
|
+
</div>
|
|
126
|
+
)}
|
|
127
|
+
</>
|
|
128
|
+
);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export default Input;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
.classList {
|
|
2
|
+
@apply mt-4 w-full bg-white;
|
|
3
|
+
@apply cursor-pointer;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/* .classList:active p {
|
|
7
|
+
@apply hidden;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.classList:active .value {
|
|
11
|
+
@apply pt-3 pb-4;
|
|
12
|
+
} */
|
|
13
|
+
|
|
14
|
+
.fullWidth {
|
|
15
|
+
@apply w-full;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.notFullWidth {
|
|
19
|
+
@apply sm:w-72;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.labelWrapper {
|
|
23
|
+
@apply absolute -mt-3 ml-3 px-1;
|
|
24
|
+
@apply flex rounded-2xl bg-white text-sm font-regular;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.required {
|
|
28
|
+
@apply font-semiBold text-error;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.value {
|
|
32
|
+
@apply w-full rounded-md bg-white py-2 pl-4 text-ink;
|
|
33
|
+
@apply cursor-pointer;
|
|
34
|
+
@apply border border-black;
|
|
35
|
+
@apply text-md;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* .value:focus {
|
|
39
|
+
@apply pt-3 pb-4;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.value:focus ~ label {
|
|
43
|
+
@apply text-xl;
|
|
44
|
+
} */
|
|
45
|
+
|
|
46
|
+
.errors {
|
|
47
|
+
@apply text-sm font-regular text-error;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.errorState {
|
|
51
|
+
@apply border-2 border-error;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.labelError {
|
|
55
|
+
@apply text-error;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.errorText {
|
|
59
|
+
@apply mt-1 border-l-4 border-error pl-3;
|
|
60
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { idAndClassName } from '@utils/controls';
|
|
3
|
+
|
|
4
|
+
import Jumbotron from '.';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/Jumbotron',
|
|
8
|
+
component: Jumbotron,
|
|
9
|
+
parameters: {},
|
|
10
|
+
argTypes: {
|
|
11
|
+
...idAndClassName,
|
|
12
|
+
},
|
|
13
|
+
args: {
|
|
14
|
+
image: 'https://picsum.photos/1000/1000',
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
export default meta;
|
|
18
|
+
|
|
19
|
+
type Story = StoryObj<typeof meta>;
|
|
20
|
+
|
|
21
|
+
export const Default: Story = {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export interface Props {
|
|
8
|
+
id?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
image?: string;
|
|
11
|
+
altText?: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const Jumbotron = ({
|
|
16
|
+
id,
|
|
17
|
+
className,
|
|
18
|
+
image,
|
|
19
|
+
altText,
|
|
20
|
+
title,
|
|
21
|
+
}: Props): JSX.Element => {
|
|
22
|
+
const classList = classNames(style.classes, className, 'theme-local');
|
|
23
|
+
const imageClassList = classNames(style.imageClasses);
|
|
24
|
+
return (
|
|
25
|
+
<div id={id} className={classList}>
|
|
26
|
+
<img className={imageClassList} src={image} alt={altText} title={title} />
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default Jumbotron;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { action } from '@storybook/addon-actions';
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { idAndClassName } from '@utils/controls';
|
|
4
|
+
|
|
5
|
+
import MenuButton from '.';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Components/Menu Button',
|
|
9
|
+
component: MenuButton,
|
|
10
|
+
argTypes: {
|
|
11
|
+
...idAndClassName,
|
|
12
|
+
backgroundColour: {
|
|
13
|
+
type: { name: 'string', required: false },
|
|
14
|
+
options: ['primary', 'secondary', 'white', 'black', 'gold'],
|
|
15
|
+
description: 'The background colour of the component',
|
|
16
|
+
table: {
|
|
17
|
+
type: { summary: 'string' },
|
|
18
|
+
},
|
|
19
|
+
defaultValue: 'primary',
|
|
20
|
+
control: 'select',
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
menuItems: {
|
|
24
|
+
description: 'The items to show in the menu',
|
|
25
|
+
control: 'array',
|
|
26
|
+
table: {
|
|
27
|
+
type: { summary: 'array' },
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
args: {
|
|
32
|
+
backgroundColour: 'white',
|
|
33
|
+
onClick: action('clicked'),
|
|
34
|
+
menuItems: [
|
|
35
|
+
{ name: 'Menu Item 1', href: '#' },
|
|
36
|
+
{ name: 'Menu Item 2', href: '#' },
|
|
37
|
+
{ name: 'Menu Item 3', href: '#' },
|
|
38
|
+
{ name: 'Menu Item 4', href: '#' },
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
export default meta;
|
|
43
|
+
|
|
44
|
+
type Story = StoryObj<typeof meta>;
|
|
45
|
+
|
|
46
|
+
export const Default: Story = {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import DropdownMenu from '@components/DropdownMenu';
|
|
4
|
+
import Image from '@components/Image';
|
|
5
|
+
import { type Colours } from '@utils/controls';
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export interface Props {
|
|
11
|
+
id?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
backgroundColour?: Colours;
|
|
14
|
+
|
|
15
|
+
menuItems: Array<{ name: string; href: string }>;
|
|
16
|
+
onClick?: React.MouseEventHandler;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const MenuButton = ({
|
|
20
|
+
id,
|
|
21
|
+
className,
|
|
22
|
+
backgroundColour = 'white',
|
|
23
|
+
|
|
24
|
+
menuItems,
|
|
25
|
+
onClick,
|
|
26
|
+
}: Props): JSX.Element => {
|
|
27
|
+
const [showMenu, setShowMenu] = useState(false);
|
|
28
|
+
const classList = classNames(
|
|
29
|
+
className,
|
|
30
|
+
style.classList,
|
|
31
|
+
style[backgroundColour],
|
|
32
|
+
'theme-local',
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
if (!menuItems) return <></>;
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<div>
|
|
39
|
+
<div
|
|
40
|
+
id={id}
|
|
41
|
+
className={classList}
|
|
42
|
+
onClick={() => {
|
|
43
|
+
setShowMenu(!showMenu);
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
<div className={style.menuClasses} onClick={(e) => onClick?.(e)}>
|
|
47
|
+
<svg
|
|
48
|
+
className={style.svg}
|
|
49
|
+
width="18"
|
|
50
|
+
height="24"
|
|
51
|
+
viewBox="0 0 24 15"
|
|
52
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
53
|
+
>
|
|
54
|
+
<path
|
|
55
|
+
className={style.lineOneClassList}
|
|
56
|
+
d="M0 1.5C0 0.947715 0.447715 0.5 1 0.5H21C21.5523 0.5 22 0.947715 22 1.5C22 2.05228 21.5523 2.5 21 2.5H1C0.447716 2.5 0 2.05228 0 1.5Z"
|
|
57
|
+
/>
|
|
58
|
+
<path
|
|
59
|
+
className={style.lineTwoClassList}
|
|
60
|
+
d="M0 7.5C0 6.94772 0.447715 6.5 1 6.5H21C21.5523 6.5 22 6.94772 22 7.5C22 8.05228 21.5523 8.5 21 8.5H1C0.447716 8.5 0 8.05228 0 7.5Z"
|
|
61
|
+
/>
|
|
62
|
+
<path
|
|
63
|
+
className={style.lineThreeClassList}
|
|
64
|
+
d="M0 13.5C0 12.9477 0.447715 12.5 1 12.5H21C21.5523 12.5 22 12.9477 22 13.5C22 14.0523 21.5523 14.5 21 14.5H1C0.447716 14.5 0 14.0523 0 13.5Z"
|
|
65
|
+
/>
|
|
66
|
+
</svg>
|
|
67
|
+
</div>
|
|
68
|
+
<Image
|
|
69
|
+
src="https://picsum.photos/300/300"
|
|
70
|
+
className={style.imageClasses}
|
|
71
|
+
/>
|
|
72
|
+
</div>
|
|
73
|
+
{showMenu && (
|
|
74
|
+
<div>
|
|
75
|
+
<DropdownMenu menuItems={menuItems} />
|
|
76
|
+
</div>
|
|
77
|
+
)}
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export default MenuButton;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
.classList {
|
|
2
|
+
width: 80px;
|
|
3
|
+
height: 45px;
|
|
4
|
+
@apply overflow-hidden rounded-full border-2 border-lightest-grey;
|
|
5
|
+
@apply my-auto flex cursor-pointer justify-between pl-2 text-center;
|
|
6
|
+
@apply hover:shadow-md;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.menuClasses {
|
|
10
|
+
@apply mx-auto my-auto;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.imageClasses {
|
|
14
|
+
width: 34px;
|
|
15
|
+
height: 34px;
|
|
16
|
+
@apply mx-auto my-auto rounded-full object-contain;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.primary {
|
|
20
|
+
@apply bg-primary text-white;
|
|
21
|
+
}
|
|
22
|
+
.secondary {
|
|
23
|
+
@apply bg-secondary text-white;
|
|
24
|
+
}
|
|
25
|
+
.white {
|
|
26
|
+
@apply bg-white text-black;
|
|
27
|
+
}
|
|
28
|
+
.grey {
|
|
29
|
+
@apply bg-lightest-grey text-black;
|
|
30
|
+
}
|
|
31
|
+
.black {
|
|
32
|
+
@apply bg-black text-white;
|
|
33
|
+
}
|
|
34
|
+
.success {
|
|
35
|
+
@apply bg-success text-white;
|
|
36
|
+
}
|
|
37
|
+
.error {
|
|
38
|
+
@apply bg-error text-white;
|
|
39
|
+
}
|
|
40
|
+
.facebook {
|
|
41
|
+
@apply bg-facebook text-white;
|
|
42
|
+
}
|
|
43
|
+
.gold {
|
|
44
|
+
@apply bg-gold text-white;
|
|
45
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { type Meta } from '@storybook/react';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
|
|
6
|
+
import Modal from '.';
|
|
7
|
+
|
|
8
|
+
const meta = {
|
|
9
|
+
title: 'Trepur Components/molecules/Modal',
|
|
10
|
+
component: Modal,
|
|
11
|
+
parameters: {
|
|
12
|
+
docs: {
|
|
13
|
+
description: {
|
|
14
|
+
component: 'A Modal component',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
argTypes: {
|
|
19
|
+
id: {
|
|
20
|
+
type: { name: 'string', required: false },
|
|
21
|
+
description: 'HTML id attribute',
|
|
22
|
+
table: { type: { summary: 'string' } },
|
|
23
|
+
},
|
|
24
|
+
className: {
|
|
25
|
+
type: { name: 'string', required: false },
|
|
26
|
+
description: 'Additional classes to be appended to the component',
|
|
27
|
+
table: { type: { summary: 'string' } },
|
|
28
|
+
},
|
|
29
|
+
children: {
|
|
30
|
+
type: { name: 'other', value: 'string | React.ReactNode' },
|
|
31
|
+
description: 'The elements to show in the component',
|
|
32
|
+
table: {
|
|
33
|
+
type: {
|
|
34
|
+
summary: 'Array',
|
|
35
|
+
},
|
|
36
|
+
defaultValue: { summary: 'undefined' },
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
onOverlayClick: {
|
|
40
|
+
type: { name: 'function', required: false },
|
|
41
|
+
description: 'Specifies the action to take when the overlay is clicked',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
args: {
|
|
45
|
+
visible: true,
|
|
46
|
+
children: (
|
|
47
|
+
<div
|
|
48
|
+
style={{ maxWidth: '609px' }}
|
|
49
|
+
className={classNames('theme-local rounded-2xl bg-white p-4')}
|
|
50
|
+
>
|
|
51
|
+
<p className="py-4">
|
|
52
|
+
This is a child of the modal component, add any child to this
|
|
53
|
+
component to show in this location.
|
|
54
|
+
</p>
|
|
55
|
+
<p className="py-4">
|
|
56
|
+
Clicking outside of this child, will close the modal
|
|
57
|
+
</p>
|
|
58
|
+
<p className="py-4">
|
|
59
|
+
To bring me back up, just toggle the 'visible' control in
|
|
60
|
+
storybook's controls
|
|
61
|
+
</p>
|
|
62
|
+
</div>
|
|
63
|
+
),
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const Template = (args): React.ReactElement => {
|
|
68
|
+
const [visible, setVisible] = useState<boolean>(false);
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<div style={{ height: '350vh' }}>
|
|
72
|
+
<Modal
|
|
73
|
+
visible={visible}
|
|
74
|
+
mobileGutter
|
|
75
|
+
onOverlayClick={() => {
|
|
76
|
+
setVisible(false);
|
|
77
|
+
}}
|
|
78
|
+
{...args}
|
|
79
|
+
/>
|
|
80
|
+
</div>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export const _Modal = Template.bind({});
|
|
85
|
+
|
|
86
|
+
export default meta;
|