trepur_components 2.3.7 → 2.3.9
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 +33 -4
- package/.prettierignore +10 -0
- package/README.md +1 -1
- package/package.json +9 -5
- package/src/components/Accordion/Accordion.stories.tsx +21 -98
- package/src/components/Accordion/const.tsx +34 -0
- package/src/components/Accordion/index.tsx +19 -25
- package/src/components/AlertBar/AlertBar.stories.tsx +78 -84
- package/src/components/AlertBar/index.tsx +69 -100
- package/src/components/Avatar/Avatar.stories.tsx +2 -7
- package/src/components/Avatar/index.tsx +4 -7
- package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +29 -0
- package/src/components/Breadcrumbs/index.tsx +89 -0
- package/src/components/Button/Button.stories.tsx +24 -0
- package/src/components/Button/index.tsx +59 -0
- package/src/components/Calendar/Calendar.stories.tsx +21 -0
- package/src/components/Calendar/index.tsx +92 -0
- package/src/components/Card/Card.stories.tsx +14 -0
- package/src/components/Card/index.tsx +39 -0
- package/src/components/Carousel/Carousel.stories.tsx +44 -0
- package/src/components/Carousel/index.tsx +301 -0
- package/src/components/Carousel/utils.ts +53 -0
- package/src/components/CarouselThumbnail/CarouselThumbnail.stories.tsx +29 -0
- package/src/components/CarouselThumbnail/const.ts +17 -0
- package/src/components/CarouselThumbnail/index.tsx +169 -0
- package/src/components/CarouselThumbnail/utils.ts +87 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +27 -0
- package/src/components/Checkbox/index.tsx +44 -0
- package/src/components/Collapsible/Collapsible.stories.tsx +67 -0
- package/src/components/Collapsible/index.tsx +169 -0
- package/src/components/Counter/Counter.stories.tsx +20 -0
- package/src/components/Counter/index.tsx +98 -0
- package/src/components/DetailUpdater/DetailUpdater.stories.tsx +37 -0
- package/{archive → src/components}/DetailUpdater/index.tsx +20 -25
- package/src/components/Dialog/Dialog.stories.tsx +65 -0
- package/src/components/Dialog/index.tsx +29 -0
- package/src/components/Dropdown/Dropdown.stories.tsx +22 -0
- package/src/components/Dropdown/index.tsx +117 -0
- package/src/components/Dropdown/utils.ts +15 -0
- package/{archive → src/components}/FileUploader/FilePreview.tsx +11 -14
- package/src/components/FileUploader/FileUploader.stories.tsx +28 -0
- package/src/components/FileUploader/index.tsx +177 -0
- package/src/components/Footer/Footer.stories.tsx +47 -0
- package/src/components/Footer/index.tsx +96 -0
- package/src/components/FooterNav/FooterNav.stories.tsx +32 -0
- package/src/components/FooterNav/index.tsx +75 -0
- package/{archive → src/components}/Form/Form.stories.tsx +2 -2
- package/src/components/Form/index.tsx +41 -0
- package/src/components/Gallery/Gallery.stories.tsx +39 -0
- package/src/components/Gallery/index.tsx +31 -0
- package/src/components/Greeting/Greeting.stories.tsx +16 -0
- package/src/components/Greeting/index.tsx +49 -0
- package/src/components/HamburgerIcon/HamburgerIcon.stories.tsx +14 -0
- package/src/components/HamburgerIcon/index.tsx +75 -0
- package/src/components/Icon/Icon.stories.tsx +41 -0
- package/src/components/Icon/index.tsx +33 -0
- package/src/components/Image/Image.stories.tsx +17 -0
- package/src/components/Image/index.tsx +25 -0
- package/src/components/ImageCard/ImageCard.stories.tsx +29 -0
- package/src/components/ImageCard/index.tsx +75 -0
- package/src/components/Input/Input.stories.tsx +25 -0
- package/src/components/Input/index.tsx +139 -0
- package/{archive → src/components}/MenuButton/MenuButton.stories.tsx +2 -2
- package/src/components/MenuButton/index.tsx +66 -0
- package/{archive → src/components}/Modal/Modal.stories.tsx +4 -8
- package/{archive → src/components}/Modal/index.tsx +9 -12
- package/src/components/Nav/Nav.stories.tsx +80 -0
- package/src/components/Nav/index.tsx +171 -0
- package/src/components/NavItem/NavItem.stories.tsx +17 -0
- package/src/components/NavItem/index.tsx +39 -0
- package/src/components/Pill/Pill.stories.tsx +51 -0
- package/src/components/Pill/index.tsx +69 -0
- package/{archive → src/components}/Search/Search.stories.tsx +2 -2
- package/{archive → src/components}/Search/index.tsx +12 -16
- package/{archive → src/components}/Select/Select.stories.tsx +2 -3
- package/{archive → src/components}/Select/index.tsx +21 -30
- package/{archive → src/components}/Showcase/Showcase.stories.tsx +4 -3
- package/src/components/Showcase/index.tsx +62 -0
- package/{archive → src/components}/SideNav/SideNav.stories.tsx +2 -2
- package/{archive → src/components}/SideNav/index.tsx +8 -15
- package/{archive → src/components}/SocialButton/SocialButton.stories.tsx +2 -2
- package/{archive → src/components}/SocialButton/index.tsx +14 -22
- package/src/components/SplitCard/SplitCard.stories.tsx +34 -0
- package/src/components/SplitCard/index.tsx +132 -0
- package/src/components/Stars/Star.stories.tsx +18 -0
- package/src/components/Stars/index.tsx +38 -0
- package/src/components/Testimonial/Testimonial.stories.tsx +37 -0
- package/src/components/Testimonial/index.tsx +123 -0
- package/src/components/TextArea/TextArea.stories.tsx +24 -0
- package/src/components/TextArea/index.tsx +133 -0
- package/src/components/Timeline/Timeline.stories.tsx +45 -0
- package/src/components/Timeline/index.tsx +65 -0
- package/src/components/Tubestops/Tubestops.stories.tsx +22 -0
- package/src/components/Tubestops/index.tsx +132 -0
- package/src/components/Video/Video.stories.tsx +58 -0
- package/src/components/Video/assets/example.mp4 +0 -0
- package/src/components/Video/assets/example.ogv +0 -0
- package/src/components/Video/assets/example.webm +0 -0
- package/src/components/Video/index.tsx +92 -0
- package/src/components/index.ts +66 -112
- package/src/custom.d.ts +14 -0
- package/src/documentation/Colours.mdx +34 -34
- package/src/documentation/Introduction.mdx +9 -5
- package/src/documentation/assets/index.ts +3 -0
- package/src/documentation/assets/trepurComponentsLogo.svg +32 -0
- package/src/documentation/typography/Fonts/Fonts.stories.tsx +14 -0
- package/src/documentation/typography/Fonts/Fonts.tsx +73 -0
- package/src/styles/global.css +1 -1
- package/src/styles/themes/local.css +91 -39
- package/src/styles/themes/test.css +28 -0
- package/src/utils/screens.ts +1 -1
- package/tailwind/colors.ts +53 -385
- package/tailwind/preset.ts +4 -0
- package/tailwind.config.ts +12 -80
- package/tsconfig.json +8 -2
- package/archive/Breadcrumbs/Breadcrumbs.stories.tsx +0 -46
- package/archive/Breadcrumbs/index.tsx +0 -42
- package/archive/BreadcrumbsBordered/BreadcrumbsBordered.stories.tsx +0 -52
- package/archive/BreadcrumbsBordered/index.tsx +0 -44
- package/archive/BreadcrumbsItem/BreadcrumbsItem.stories.tsx +0 -40
- package/archive/BreadcrumbsItem/index.tsx +0 -149
- package/archive/Button/Button.stories.tsx +0 -150
- package/archive/Button/index.tsx +0 -111
- package/archive/Button/style.module.css +0 -76
- package/archive/Calendar/Calendar.stories.tsx +0 -82
- package/archive/Calendar/index.tsx +0 -76
- package/archive/Card/Card.stories.tsx +0 -75
- package/archive/Card/index.tsx +0 -102
- package/archive/Card/style.module.css +0 -75
- package/archive/CardWithTopImage/CardWithTopImage.stories.tsx +0 -50
- package/archive/CardWithTopImage/index.tsx +0 -39
- package/archive/CardWithTopImage/style.module.css +0 -11
- package/archive/Carousel/Carousel.stories.tsx +0 -451
- package/archive/Carousel/index.tsx +0 -388
- package/archive/Carousel/style.module.css +0 -99
- package/archive/CarouselThumbnail/CarouselThumbnail.stories.tsx +0 -350
- package/archive/CarouselThumbnail/index.tsx +0 -302
- package/archive/CarouselThumbnail/style.module.css +0 -67
- package/archive/Checkbox/Checkbox.stories.tsx +0 -34
- package/archive/Checkbox/index.tsx +0 -51
- package/archive/Checkbox/style.module.css +0 -15
- package/archive/Collapsible/Collapsible.stories.tsx +0 -67
- package/archive/Collapsible/index.tsx +0 -116
- package/archive/Collapsible/style.module.css +0 -47
- package/archive/Column/Column.stories.tsx +0 -89
- package/archive/Column/index.tsx +0 -119
- package/archive/Column/style.module.css +0 -151
- package/archive/ComponentWrapper/ComponentWrapper.stories.tsx +0 -40
- package/archive/ComponentWrapper/index.tsx +0 -55
- package/archive/ComponentWrapper/style.module.css +0 -40
- package/archive/Container/Container.stories.tsx +0 -40
- package/archive/Container/index.tsx +0 -24
- package/archive/Container/style.module.css +0 -4
- package/archive/Counter/Counter.stories.tsx +0 -19
- package/archive/Counter/index.tsx +0 -66
- package/archive/Counter/style.module.css +0 -19
- package/archive/DetailUpdater/DetailUpdater.stories.tsx +0 -96
- package/archive/DetailUpdater/style.module.css +0 -31
- package/archive/Dialog/Dialog.stories.tsx +0 -131
- package/archive/Dialog/index.tsx +0 -91
- package/archive/Dialog/style.module.css +0 -44
- package/archive/DropdownMenu/DropdownMenu.stories.tsx +0 -59
- package/archive/DropdownMenu/index.tsx +0 -51
- package/archive/DropdownMenu/style.module.css +0 -38
- package/archive/DynamicTextSection/DynamicTextSection.stories.tsx +0 -74
- package/archive/DynamicTextSection/index.tsx +0 -36
- package/archive/DynamicTextSection/style.module.css +0 -0
- package/archive/FileUploader/FileUploader.stories.tsx +0 -28
- package/archive/FileUploader/index.tsx +0 -135
- package/archive/FileUploader/style.module.css +0 -54
- package/archive/FilterItem/FilterItem.stories.tsx +0 -33
- package/archive/FilterItem/index.tsx +0 -101
- package/archive/FilterItem/style.module.css +0 -27
- package/archive/Footer/Footer.stories.tsx +0 -59
- package/archive/Footer/index.tsx +0 -50
- package/archive/Footer/style.module.css +0 -19
- package/archive/FooterNav/FooterNav.stories.tsx +0 -125
- package/archive/FooterNav/index.tsx +0 -57
- package/archive/FooterNav/style.module.css +0 -32
- package/archive/FooterNavItem/FooterNavItem.stories.tsx +0 -53
- package/archive/FooterNavItem/index.tsx +0 -80
- package/archive/FooterNavItem/style.module.css +0 -139
- package/archive/Form/index.tsx +0 -61
- package/archive/Form/style.module.css +0 -0
- package/archive/FyreCard/FyreCard.stories.tsx +0 -31
- package/archive/FyreCard/index.tsx +0 -52
- package/archive/FyreCard/style.module.css +0 -19
- package/archive/Greeting/Greeting.stories.tsx +0 -41
- package/archive/Greeting/index.tsx +0 -32
- package/archive/HamburgerIcon/HamburgerIcon.stories.tsx +0 -32
- package/archive/HamburgerIcon/index.tsx +0 -103
- package/archive/HamburgerIcon/style.module.css +0 -85
- package/archive/HorizontalLine/HorizontalLine.stories.tsx +0 -54
- package/archive/HorizontalLine/index.tsx +0 -40
- package/archive/HorizontalLine/style.module.css +0 -55
- package/archive/Icon/Icon.stories.tsx +0 -164
- package/archive/Icon/index.tsx +0 -115
- package/archive/Icon/style.module.css +0 -253
- package/archive/IconCard/IconCard.stories.tsx +0 -46
- package/archive/IconCard/index.tsx +0 -57
- package/archive/IconCard/style.module.css +0 -18
- package/archive/Image/Image.stories.tsx +0 -87
- package/archive/Image/index.tsx +0 -132
- package/archive/Image/style.module.css +0 -109
- package/archive/ImageInfo/ImageInfo.stories.tsx +0 -39
- package/archive/ImageInfo/index.tsx +0 -95
- package/archive/ImageInfo/style.module.css +0 -47
- package/archive/ImageLink/ImageLink.stories.tsx +0 -37
- package/archive/ImageLink/index.tsx +0 -49
- package/archive/ImageLink/style.module.css +0 -23
- package/archive/ImageLinkList/ImageLinkList.stories.tsx +0 -34
- package/archive/ImageLinkList/index.tsx +0 -33
- package/archive/ImageLinkList/style.module.css +0 -3
- package/archive/InformationIcon/InformationIcon.stories.tsx +0 -83
- package/archive/InformationIcon/index.tsx +0 -128
- package/archive/InformationIcon/style.module.css +0 -71
- package/archive/InformationIconBlock/InformationIconBlock.stories.tsx +0 -32
- package/archive/InformationIconBlock/index.tsx +0 -63
- package/archive/InformationIconBlock/style.module.css +0 -7
- package/archive/Input/Input.stories.tsx +0 -84
- package/archive/Input/index.tsx +0 -131
- package/archive/Input/style.module.css +0 -60
- package/archive/Jumbotron/Jumbotron.stories.tsx +0 -21
- package/archive/Jumbotron/index.tsx +0 -31
- package/archive/Jumbotron/style.module.css +0 -8
- package/archive/MenuButton/index.tsx +0 -82
- package/archive/MenuButton/style.module.css +0 -45
- package/archive/Modal/style.module.css +0 -35
- package/archive/NavItem/NavItem.stories.tsx +0 -90
- package/archive/NavItem/index.tsx +0 -65
- package/archive/NavItem/style.module.css +0 -71
- package/archive/NavOld/NavOld.stories.tsx +0 -193
- package/archive/NavOld/StickyNav.tsx +0 -191
- package/archive/NavOld/index.tsx +0 -273
- package/archive/NavOld/style.module.css +0 -156
- package/archive/NavTwo/Dropdown.tsx +0 -35
- package/archive/NavTwo/Nav.stories.tsx +0 -38
- package/archive/NavTwo/Sidebar.tsx +0 -34
- package/archive/NavTwo/StickyNav.tsx +0 -34
- package/archive/NavTwo/index.tsx +0 -45
- package/archive/NavTwo/style.module.css +0 -35
- package/archive/NewsCard/NewsCard.stories.tsx +0 -72
- package/archive/NewsCard/index.tsx +0 -57
- package/archive/NewsCard/style.module.css +0 -15
- package/archive/Pill/Pill.stories.tsx +0 -44
- package/archive/Pill/index.tsx +0 -64
- package/archive/Pill/style.module.css +0 -32
- package/archive/ProductCard/ProductCard.stories.tsx +0 -61
- package/archive/ProductCard/index.tsx +0 -111
- package/archive/ProductCard/style.module.css +0 -53
- package/archive/ProductCardV2/ProductCardV2.stories.tsx +0 -50
- package/archive/ProductCardV2/index.tsx +0 -119
- package/archive/ProductCardV2/style.module.css +0 -59
- package/archive/Proficiencies/Proficiencies.stories.tsx +0 -50
- package/archive/Proficiencies/index.tsx +0 -63
- package/archive/Proficiencies/style.module.css +0 -31
- package/archive/Profile/Profile.stories.tsx +0 -49
- package/archive/Profile/index.tsx +0 -103
- package/archive/Profile/style.module.css +0 -47
- package/archive/Row/Row.stories.tsx +0 -53
- package/archive/Row/index.tsx +0 -23
- package/archive/Row/style.module.css +0 -3
- package/archive/Search/style.module.css +0 -23
- package/archive/Select/style.module.css +0 -52
- package/archive/Showcase/index.tsx +0 -75
- package/archive/Showcase/style.module.css +0 -47
- package/archive/SideNav/style.module.css +0 -43
- package/archive/SocialBlock/SocialBlock.stories.tsx +0 -58
- package/archive/SocialBlock/index.tsx +0 -63
- package/archive/SocialButton/style.module.css +0 -77
- package/archive/StarRating/StarRating.stories.tsx +0 -23
- package/archive/StarRating/index.tsx +0 -71
- package/archive/Testimonial/Testimonial.stories.tsx +0 -110
- package/archive/Testimonial/index.tsx +0 -61
- package/archive/Testimonial/style.module.css +0 -27
- package/archive/TextAndTitle/TextAndTitle.stories.tsx +0 -70
- package/archive/TextAndTitle/index.tsx +0 -123
- package/archive/TextAndTitle/style.module.css +0 -75
- package/archive/TextArea/TextArea.stories.tsx +0 -55
- package/archive/TextArea/index.tsx +0 -125
- package/archive/TextArea/style.module.css +0 -60
- package/archive/Timeline/Timeline.stories.tsx +0 -92
- package/archive/Timeline/index.tsx +0 -254
- package/archive/Timeline/style.module.css +0 -134
- package/archive/TimelineV2/TimelineV2.stories.tsx +0 -95
- package/archive/TimelineV2/index.tsx +0 -70
- package/archive/TimelineV2/style.module.css +0 -28
- package/archive/Tubestops/Tubestops.stories.tsx +0 -42
- package/archive/Tubestops/index.tsx +0 -58
- package/archive/Tubestops/style.module.css +0 -54
- package/archive/UserIcon/UserIcon.stories.tsx +0 -52
- package/archive/UserIcon/index.tsx +0 -46
- package/archive/UserIcon/style.module.css +0 -19
- package/archive/Video/Video.stories.tsx +0 -23
- package/archive/Video/index.tsx +0 -47
- package/archive/theme.ts +0 -39
- package/archive/typography/Fonts/Fonts.stories.tsx +0 -14
- package/archive/typography/Fonts/Fonts.tsx +0 -181
- package/lib/components/Accordion/Accordion.stories.d.ts +0 -94
- package/lib/components/Accordion/index.d.ts +0 -8
- package/lib/components/Accordion/index.js +0 -15
- package/lib/components/AlertBar/AlertBar.stories.d.ts +0 -162
- package/lib/components/AlertBar/index.d.ts +0 -12
- package/lib/components/AlertBar/index.js +0 -49
- package/lib/components/Avatar/Avatar.stories.d.ts +0 -44
- package/lib/components/Avatar/index.d.ts +0 -4
- package/lib/components/index.d.ts +0 -4
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -6
- package/lib/styles/global.css +0 -75
- package/lib/styles/themes/local.css +0 -40
- package/lib/styles/themes/palette.css +0 -131
- package/lib/tailwind/boxShadow.ts +0 -9
- package/lib/tailwind/colors.ts +0 -410
- package/lib/tailwind/container.ts +0 -11
- package/lib/tailwind/preset.ts +0 -88
- package/lib/tailwind/spacing.ts +0 -14
- package/lib/utils/controls.d.ts +0 -36
- package/lib/utils/matchMedia.d.ts +0 -2
- package/lib/utils/screens.d.ts +0 -7
- package/src/styles/themes/palette.css +0 -131
- package/svg.d.ts +0 -4
- /package/{archive → src/components}/Calendar/style.css +0 -0
- /package/{archive → src/components}/Checkbox/Checkbox.mdx +0 -0
- /package/{archive → src}/fonts/Sora/OFL.txt +0 -0
- /package/{archive → src}/fonts/Sora/README.txt +0 -0
- /package/{archive → src}/fonts/Sora/Sora-VariableFont_wght.ttf +0 -0
- /package/{archive → src}/fonts/Sora/static/Sora-Bold.ttf +0 -0
- /package/{archive → src}/fonts/Sora/static/Sora-ExtraBold.ttf +0 -0
- /package/{archive → src}/fonts/Sora/static/Sora-ExtraLight.ttf +0 -0
- /package/{archive → src}/fonts/Sora/static/Sora-Light.ttf +0 -0
- /package/{archive → src}/fonts/Sora/static/Sora-Medium.ttf +0 -0
- /package/{archive → src}/fonts/Sora/static/Sora-Regular.ttf +0 -0
- /package/{archive → src}/fonts/Sora/static/Sora-SemiBold.ttf +0 -0
- /package/{archive → src}/fonts/Sora/static/Sora-Thin.ttf +0 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { forwardRef, HTMLAttributes } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Card } from '../';
|
|
4
|
+
import { Image, ImageProps } from '@components/Image';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
|
|
7
|
+
const TestimonialComponent = forwardRef<
|
|
8
|
+
HTMLDivElement,
|
|
9
|
+
HTMLAttributes<HTMLDivElement>
|
|
10
|
+
>(({ className, children, ...props }, ref) => {
|
|
11
|
+
return (
|
|
12
|
+
<Card ref={ref} className={clsx('grid gap-4', className)} {...props}>
|
|
13
|
+
{children}
|
|
14
|
+
</Card>
|
|
15
|
+
);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const TestimonialImage = forwardRef<
|
|
19
|
+
HTMLImageElement,
|
|
20
|
+
HTMLAttributes<HTMLImageElement> & ImageProps
|
|
21
|
+
>(({ className, src, ...props }, ref) => {
|
|
22
|
+
return (
|
|
23
|
+
<div ref={ref} className="mx-auto w-40 ">
|
|
24
|
+
<Image className="rounded-full" src={src} {...props} />
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const TestimonialTitle = forwardRef<
|
|
30
|
+
HTMLDivElement,
|
|
31
|
+
HTMLAttributes<HTMLDivElement>
|
|
32
|
+
>(({ className, children, ...props }, ref) => {
|
|
33
|
+
return (
|
|
34
|
+
<h3 ref={ref} className="text-center text-lg font-medium" {...props}>
|
|
35
|
+
{children}
|
|
36
|
+
</h3>
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const TestimonialSection = forwardRef<
|
|
41
|
+
HTMLDivElement,
|
|
42
|
+
HTMLAttributes<HTMLDivElement>
|
|
43
|
+
>(({ className, children, ...props }, ref) => {
|
|
44
|
+
return (
|
|
45
|
+
<div ref={ref} className={clsx('text-center', className)} {...props}>
|
|
46
|
+
{children}
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const TestimonialPosition = forwardRef<
|
|
52
|
+
HTMLDivElement,
|
|
53
|
+
HTMLAttributes<HTMLDivElement>
|
|
54
|
+
>(({ className, children, ...props }, ref) => {
|
|
55
|
+
return (
|
|
56
|
+
<p
|
|
57
|
+
ref={ref}
|
|
58
|
+
className={clsx('text-md font-regular text-sm', className)}
|
|
59
|
+
{...props}
|
|
60
|
+
>
|
|
61
|
+
{children}
|
|
62
|
+
</p>
|
|
63
|
+
);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const TestimonialDate = forwardRef<
|
|
67
|
+
HTMLDivElement,
|
|
68
|
+
HTMLAttributes<HTMLDivElement>
|
|
69
|
+
>(({ className, children, ...props }, ref) => {
|
|
70
|
+
return (
|
|
71
|
+
<p ref={ref} className="font-regular text-sm" {...props}>
|
|
72
|
+
{children}
|
|
73
|
+
</p>
|
|
74
|
+
);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const TestimonialText = forwardRef<
|
|
78
|
+
HTMLDivElement,
|
|
79
|
+
HTMLAttributes<HTMLDivElement>
|
|
80
|
+
>(({ className, children, ...props }, ref) => {
|
|
81
|
+
return (
|
|
82
|
+
<p className={clsx('text-md text-center font-light')} {...props}>
|
|
83
|
+
{children}
|
|
84
|
+
</p>
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const TestimonialAuthorDetails = forwardRef<
|
|
89
|
+
HTMLDivElement,
|
|
90
|
+
HTMLAttributes<HTMLDivElement>
|
|
91
|
+
>(({ className, children, ...props }, ref) => {
|
|
92
|
+
return (
|
|
93
|
+
<p
|
|
94
|
+
ref={ref}
|
|
95
|
+
className={clsx('text-center text-sm font-medium', className)}
|
|
96
|
+
{...props}
|
|
97
|
+
>
|
|
98
|
+
{children}
|
|
99
|
+
</p>
|
|
100
|
+
);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
TestimonialComponent.displayName = 'Testimonial';
|
|
104
|
+
|
|
105
|
+
TestimonialImage.displayName = 'Testimonial.Image';
|
|
106
|
+
TestimonialTitle.displayName = 'Testimonial.Title';
|
|
107
|
+
TestimonialSection.displayName = 'Testimonial.Section';
|
|
108
|
+
TestimonialPosition.displayName = 'Testimonial.Position';
|
|
109
|
+
TestimonialDate.displayName = 'Testimonial.Date';
|
|
110
|
+
TestimonialText.displayName = 'Testimonial.Text';
|
|
111
|
+
TestimonialAuthorDetails.displayName = 'Testimonial.AuthorDetails';
|
|
112
|
+
|
|
113
|
+
const Testimonial = Object.assign(TestimonialComponent, {
|
|
114
|
+
Image: TestimonialImage,
|
|
115
|
+
Title: TestimonialTitle,
|
|
116
|
+
Section: TestimonialSection,
|
|
117
|
+
Position: TestimonialPosition,
|
|
118
|
+
Date: TestimonialDate,
|
|
119
|
+
Text: TestimonialText,
|
|
120
|
+
AuthorDetails: TestimonialAuthorDetails,
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
export { Testimonial };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import { TextArea } from '.';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'V2Components/Text Area',
|
|
7
|
+
component: TextArea,
|
|
8
|
+
args: {
|
|
9
|
+
placeholder: 'This is a text area placeholder',
|
|
10
|
+
children: [
|
|
11
|
+
<TextArea.Item>
|
|
12
|
+
<TextArea.Label required>This is a label</TextArea.Label>
|
|
13
|
+
<TextArea.Box />
|
|
14
|
+
<TextArea.Validation />
|
|
15
|
+
</TextArea.Item>,
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
} satisfies Meta<typeof TextArea>;
|
|
19
|
+
|
|
20
|
+
export default meta;
|
|
21
|
+
|
|
22
|
+
type Story = StoryObj<typeof TextArea>;
|
|
23
|
+
|
|
24
|
+
export const Default: Story = {};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
forwardRef,
|
|
4
|
+
HTMLAttributes,
|
|
5
|
+
useContext,
|
|
6
|
+
useMemo,
|
|
7
|
+
useRef,
|
|
8
|
+
} from 'react';
|
|
9
|
+
|
|
10
|
+
import clsx from 'clsx';
|
|
11
|
+
|
|
12
|
+
export interface TextAreaContextProps {
|
|
13
|
+
autoComplete?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
formId?: string;
|
|
16
|
+
height?: string;
|
|
17
|
+
maxLength?: number;
|
|
18
|
+
minLength?: number;
|
|
19
|
+
pattern?: string;
|
|
20
|
+
required?: boolean;
|
|
21
|
+
readOnly?: boolean;
|
|
22
|
+
label?: string;
|
|
23
|
+
type?: string;
|
|
24
|
+
name?: string;
|
|
25
|
+
placeholder?: string;
|
|
26
|
+
withValidation?: boolean;
|
|
27
|
+
onChange?: (e: any) => void;
|
|
28
|
+
onBlur?: () => void;
|
|
29
|
+
onFocus?: () => void;
|
|
30
|
+
onClick?: () => void;
|
|
31
|
+
errors?: string[];
|
|
32
|
+
value?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const TextAreaContext = createContext<TextAreaContextProps | null>(null);
|
|
36
|
+
|
|
37
|
+
const TextAreaComponent = forwardRef<
|
|
38
|
+
HTMLDivElement,
|
|
39
|
+
HTMLAttributes<HTMLDivElement> & TextAreaContextProps
|
|
40
|
+
>(({ children, errors, placeholder, ...props }, ref) => {
|
|
41
|
+
const state = useMemo(
|
|
42
|
+
() => ({
|
|
43
|
+
errors,
|
|
44
|
+
placeholder,
|
|
45
|
+
...props,
|
|
46
|
+
}),
|
|
47
|
+
[errors, props],
|
|
48
|
+
);
|
|
49
|
+
return (
|
|
50
|
+
<TextAreaContext.Provider value={state}>
|
|
51
|
+
<div ref={ref}>{children}</div>
|
|
52
|
+
</TextAreaContext.Provider>
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const TextAreaItem = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
|
|
57
|
+
({ children, ...props }, ref) => {
|
|
58
|
+
const btnRef = useRef<any>(null);
|
|
59
|
+
return (
|
|
60
|
+
<div
|
|
61
|
+
className="mt-4 w-full cursor-pointer bg-white"
|
|
62
|
+
onClick={() => btnRef.current?.focus()}
|
|
63
|
+
ref={ref}
|
|
64
|
+
{...props}
|
|
65
|
+
>
|
|
66
|
+
{children}
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
},
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
const TextAreaLabel = forwardRef<
|
|
73
|
+
HTMLDivElement,
|
|
74
|
+
HTMLAttributes<HTMLDivElement> & { required?: boolean }
|
|
75
|
+
>(({ children, required = false }, ref) => {
|
|
76
|
+
return (
|
|
77
|
+
<div
|
|
78
|
+
ref={ref}
|
|
79
|
+
className="font-regular absolute -mt-3 ml-3 flex rounded-2xl bg-white px-1 text-sm "
|
|
80
|
+
>
|
|
81
|
+
<p>{children}</p>
|
|
82
|
+
{required && (
|
|
83
|
+
<p className="font-semiBold text-lg text-error-default"> *</p>
|
|
84
|
+
)}
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const TextAreaBox = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
|
|
90
|
+
({ ...props }) => {
|
|
91
|
+
const { errors, placeholder } = useContext(TextAreaContext) || {};
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<textarea
|
|
95
|
+
className="text-ink text-md w-full cursor-pointer rounded-md border border-black bg-white py-2 pl-4"
|
|
96
|
+
placeholder={placeholder}
|
|
97
|
+
/>
|
|
98
|
+
);
|
|
99
|
+
},
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
const TextAreaValidation = forwardRef<
|
|
103
|
+
HTMLDivElement,
|
|
104
|
+
HTMLAttributes<HTMLDivElement>
|
|
105
|
+
>(({ children, ...props }, ref) => {
|
|
106
|
+
const { errors } = useContext(TextAreaContext) || {};
|
|
107
|
+
return (
|
|
108
|
+
<div
|
|
109
|
+
ref={ref}
|
|
110
|
+
className="font-regular gap-y-2 text-sm text-error-default"
|
|
111
|
+
{...props}
|
|
112
|
+
>
|
|
113
|
+
{errors?.map((error, i) => {
|
|
114
|
+
return <p key={`error-msg-${i + 1}`}>{error}</p>;
|
|
115
|
+
})}
|
|
116
|
+
</div>
|
|
117
|
+
);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
TextAreaComponent.displayName = 'TextArea';
|
|
121
|
+
TextAreaItem.displayName = 'TextArea.Item';
|
|
122
|
+
TextAreaLabel.displayName = 'TextArea.Label';
|
|
123
|
+
TextAreaBox.displayName = 'TextArea.Box';
|
|
124
|
+
TextAreaValidation.displayName = 'TextArea.Validation';
|
|
125
|
+
|
|
126
|
+
const TextArea = Object.assign(TextAreaComponent, {
|
|
127
|
+
Item: TextAreaItem,
|
|
128
|
+
Label: TextAreaLabel,
|
|
129
|
+
Box: TextAreaBox,
|
|
130
|
+
Validation: TextAreaValidation,
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
export { TextArea };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { items } from '@components/Accordion/const';
|
|
2
|
+
import { Collapsible } from '@components/Collapsible';
|
|
3
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
4
|
+
|
|
5
|
+
import { Timeline } from '.';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'V2Components/Timeline',
|
|
9
|
+
component: Timeline,
|
|
10
|
+
parameters: {},
|
|
11
|
+
args: {
|
|
12
|
+
children: items.map((item, i) => {
|
|
13
|
+
return (
|
|
14
|
+
<Timeline.Item>
|
|
15
|
+
<Timeline.Dot
|
|
16
|
+
className="bg-primary"
|
|
17
|
+
index={i}
|
|
18
|
+
length={items.length}
|
|
19
|
+
/>
|
|
20
|
+
<Timeline.Content>
|
|
21
|
+
<Collapsible>
|
|
22
|
+
<Collapsible.Header>
|
|
23
|
+
{item.image && <Collapsible.Image src={item.image} />}
|
|
24
|
+
<Collapsible.HeaderContent>
|
|
25
|
+
<Collapsible.Label>{item.label}</Collapsible.Label>
|
|
26
|
+
<Collapsible.Title>{item.title}</Collapsible.Title>
|
|
27
|
+
<Collapsible.Subtitle>{item.subtitle}</Collapsible.Subtitle>
|
|
28
|
+
</Collapsible.HeaderContent>
|
|
29
|
+
</Collapsible.Header>
|
|
30
|
+
<Collapsible.Content>
|
|
31
|
+
<Collapsible.Text>{item.content}</Collapsible.Text>
|
|
32
|
+
</Collapsible.Content>
|
|
33
|
+
</Collapsible>
|
|
34
|
+
</Timeline.Content>
|
|
35
|
+
</Timeline.Item>
|
|
36
|
+
);
|
|
37
|
+
}),
|
|
38
|
+
},
|
|
39
|
+
} satisfies Meta<typeof Timeline>;
|
|
40
|
+
|
|
41
|
+
export default meta;
|
|
42
|
+
|
|
43
|
+
type Story = StoryObj<typeof Timeline>;
|
|
44
|
+
|
|
45
|
+
export const Default: Story = {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { forwardRef, HTMLAttributes } from 'react';
|
|
2
|
+
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
|
|
5
|
+
const TimelineComponent = forwardRef<
|
|
6
|
+
HTMLDivElement,
|
|
7
|
+
HTMLAttributes<HTMLDivElement>
|
|
8
|
+
>(({ id, className, children }, ref) => {
|
|
9
|
+
return (
|
|
10
|
+
<div ref={ref} id={id} className={className}>
|
|
11
|
+
{children}
|
|
12
|
+
</div>
|
|
13
|
+
);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const TimelineItem = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
|
|
17
|
+
({ id, children }, ref) => {
|
|
18
|
+
return (
|
|
19
|
+
<div ref={ref} id={id} className="flex">
|
|
20
|
+
{children}
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
23
|
+
},
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const TimelineDot = forwardRef<
|
|
27
|
+
HTMLDivElement,
|
|
28
|
+
HTMLAttributes<HTMLDivElement> & { index: number; length: number }
|
|
29
|
+
>(({ className, index, length }) => {
|
|
30
|
+
return (
|
|
31
|
+
<div className="hidden sm:block">
|
|
32
|
+
<p
|
|
33
|
+
className={clsx('z-10 m-auto mt-12 h-4 w-4 rounded-full', className)}
|
|
34
|
+
/>
|
|
35
|
+
<div
|
|
36
|
+
className={
|
|
37
|
+
index !== length - 1
|
|
38
|
+
? clsx('m-auto h-full w-1', className)
|
|
39
|
+
: 'border-r-2 border-transparent'
|
|
40
|
+
}
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const TimelineContent = forwardRef<
|
|
47
|
+
HTMLDivElement,
|
|
48
|
+
HTMLAttributes<HTMLDivElement>
|
|
49
|
+
>(({ children }) => {
|
|
50
|
+
return <div className="my-2 w-full sm:ml-8">{children}</div>;
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
TimelineComponent.displayName = 'Timeline';
|
|
54
|
+
|
|
55
|
+
TimelineItem.displayName = 'Timeline.Item';
|
|
56
|
+
TimelineDot.displayName = 'Timeline.Dot';
|
|
57
|
+
TimelineContent.displayName = 'Timeline.Content';
|
|
58
|
+
|
|
59
|
+
const Timeline = Object.assign(TimelineComponent, {
|
|
60
|
+
Item: TimelineItem,
|
|
61
|
+
Dot: TimelineDot,
|
|
62
|
+
Content: TimelineContent,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export { Timeline };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import { Tubestops } from '.';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'V2Components/Tubestops',
|
|
7
|
+
component: Tubestops,
|
|
8
|
+
args: {
|
|
9
|
+
activeStop: 3,
|
|
10
|
+
children: [...Array(5)].map((_, i) => (
|
|
11
|
+
<Tubestops.Stop stopId={i + 1}>
|
|
12
|
+
<Tubestops.Text>{`Stop ${i + 1}`}</Tubestops.Text>
|
|
13
|
+
</Tubestops.Stop>
|
|
14
|
+
)),
|
|
15
|
+
},
|
|
16
|
+
} satisfies Meta<typeof Tubestops>;
|
|
17
|
+
|
|
18
|
+
export default meta;
|
|
19
|
+
|
|
20
|
+
type Story = StoryObj<typeof Tubestops>;
|
|
21
|
+
|
|
22
|
+
export const Default: Story = {};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Children,
|
|
3
|
+
createContext,
|
|
4
|
+
forwardRef,
|
|
5
|
+
HTMLAttributes,
|
|
6
|
+
useContext,
|
|
7
|
+
useMemo,
|
|
8
|
+
useState,
|
|
9
|
+
} from 'react';
|
|
10
|
+
|
|
11
|
+
import clsx from 'clsx';
|
|
12
|
+
|
|
13
|
+
export interface TubestopsContextProps {
|
|
14
|
+
stops?: number;
|
|
15
|
+
activeStop?: number;
|
|
16
|
+
currentStop?: number;
|
|
17
|
+
setCurrentStop?: (stop: number) => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface TubestopsStopContextProps {
|
|
21
|
+
stopNumber: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const TubestopsContext = createContext<TubestopsContextProps | null>(null);
|
|
25
|
+
const TubestopsStopContext = createContext<TubestopsStopContextProps | null>(
|
|
26
|
+
null,
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const TubestopsComponent = forwardRef<
|
|
30
|
+
HTMLDivElement,
|
|
31
|
+
HTMLAttributes<HTMLDivElement> & TubestopsContextProps
|
|
32
|
+
>(({ className, children, activeStop = 0 }, ref) => {
|
|
33
|
+
const [currentStop, setCurrentStop] = useState(activeStop);
|
|
34
|
+
const totalStops = Children.count(children);
|
|
35
|
+
|
|
36
|
+
const state = useMemo(
|
|
37
|
+
() => ({
|
|
38
|
+
stops: totalStops ?? 0,
|
|
39
|
+
currentStop,
|
|
40
|
+
setCurrentStop,
|
|
41
|
+
}),
|
|
42
|
+
[currentStop, setCurrentStop],
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<TubestopsContext.Provider value={state}>
|
|
47
|
+
<div ref={ref} className={clsx('flex py-4', className)}>
|
|
48
|
+
{children}
|
|
49
|
+
</div>
|
|
50
|
+
</TubestopsContext.Provider>
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const TubestopsStop = forwardRef<
|
|
55
|
+
HTMLDivElement,
|
|
56
|
+
HTMLAttributes<HTMLDivElement> & { stopId: number }
|
|
57
|
+
>(({ className, stopId = 0, children }, ref) => {
|
|
58
|
+
const { currentStop = 0, stops = 0 } = useContext(TubestopsContext) || {};
|
|
59
|
+
const [stopNumber] = useState(stopId);
|
|
60
|
+
|
|
61
|
+
const state = useMemo(
|
|
62
|
+
() => ({
|
|
63
|
+
stopNumber,
|
|
64
|
+
}),
|
|
65
|
+
[stopNumber],
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<TubestopsStopContext.Provider value={state}>
|
|
70
|
+
<div ref={ref} className={clsx(className, 'w-full min-w-[120px]')}>
|
|
71
|
+
<div
|
|
72
|
+
className={clsx({
|
|
73
|
+
'mt-4 h-1 w-full translate-x-1/2 bg-tubestop-line-future':
|
|
74
|
+
stopId >= currentStop && stopId < stops,
|
|
75
|
+
'mt-4 h-1 w-full translate-x-1/2 bg-tubestop-line-complete':
|
|
76
|
+
stopId < currentStop && stopId < stops,
|
|
77
|
+
})}
|
|
78
|
+
/>
|
|
79
|
+
<p
|
|
80
|
+
className={clsx(
|
|
81
|
+
{
|
|
82
|
+
'relative z-20 -mt-4 bg-tubestop-station-complete':
|
|
83
|
+
stopId < currentStop,
|
|
84
|
+
'relative z-20 -mt-4 bg-tubestop-station-active':
|
|
85
|
+
currentStop === stopId,
|
|
86
|
+
'relative z-20 -mt-4 bg-tubestop-station-future':
|
|
87
|
+
stopId > currentStop,
|
|
88
|
+
'mt-1': stopId === stops,
|
|
89
|
+
},
|
|
90
|
+
'z-10 mx-auto h-6 w-6 rounded-full',
|
|
91
|
+
)}
|
|
92
|
+
/>
|
|
93
|
+
{children}
|
|
94
|
+
</div>
|
|
95
|
+
</TubestopsStopContext.Provider>
|
|
96
|
+
);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const TubestopsText = forwardRef<
|
|
100
|
+
HTMLParagraphElement,
|
|
101
|
+
HTMLAttributes<HTMLParagraphElement>
|
|
102
|
+
>(({ className, children }, ref) => {
|
|
103
|
+
const { currentStop = 0 } = useContext(TubestopsContext) || {};
|
|
104
|
+
const { stopNumber = 0 } = useContext(TubestopsStopContext) || {};
|
|
105
|
+
return (
|
|
106
|
+
<p
|
|
107
|
+
ref={ref}
|
|
108
|
+
className={clsx(
|
|
109
|
+
'mt-2 text-center',
|
|
110
|
+
{
|
|
111
|
+
'font-medium text-tubestop-text-complete': stopNumber < currentStop,
|
|
112
|
+
'font-bold text-tubestop-text-active': currentStop === stopNumber,
|
|
113
|
+
'font-medium text-tubestop-text-future': stopNumber > currentStop,
|
|
114
|
+
},
|
|
115
|
+
className,
|
|
116
|
+
)}
|
|
117
|
+
>
|
|
118
|
+
{children}
|
|
119
|
+
</p>
|
|
120
|
+
);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
TubestopsComponent.displayName = 'Tubestop';
|
|
124
|
+
TubestopsStop.displayName = 'Tubestops.Stop';
|
|
125
|
+
TubestopsText.displayName = 'Tubestops.Text';
|
|
126
|
+
|
|
127
|
+
const Tubestops = Object.assign(TubestopsComponent, {
|
|
128
|
+
Stop: TubestopsStop,
|
|
129
|
+
Text: TubestopsText,
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
export { Tubestops };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Video } from './';
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import Mp4File from './assets/example.mp4';
|
|
5
|
+
import WebmFile from './assets/example.webm';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'V2Components/Video',
|
|
9
|
+
component: Video,
|
|
10
|
+
args: {
|
|
11
|
+
children: [<Video.File src={WebmFile} type="video/webm" />],
|
|
12
|
+
},
|
|
13
|
+
} satisfies Meta<typeof Video>;
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
|
|
17
|
+
type Story = StoryObj<typeof Video>;
|
|
18
|
+
|
|
19
|
+
export const Default: Story = {};
|
|
20
|
+
|
|
21
|
+
export const Mp4: Story = {
|
|
22
|
+
...Default,
|
|
23
|
+
args: {
|
|
24
|
+
children: [<Video.File src={Mp4File} type="video/mp4" />],
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const withControls: Story = {
|
|
29
|
+
...Default,
|
|
30
|
+
args: {
|
|
31
|
+
withControls: true,
|
|
32
|
+
children: [<Video.File src={Mp4File} type="video/mp4" />],
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Muted: Story = {
|
|
37
|
+
...Default,
|
|
38
|
+
args: {
|
|
39
|
+
muted: true,
|
|
40
|
+
children: [<Video.File src={Mp4File} type="video/mp4" />],
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const autoPlay: Story = {
|
|
45
|
+
...Default,
|
|
46
|
+
args: {
|
|
47
|
+
autoPlay: true,
|
|
48
|
+
children: [<Video.File src={Mp4File} type="video/mp4" />],
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const withPoster: Story = {
|
|
53
|
+
...Default,
|
|
54
|
+
args: {
|
|
55
|
+
withPoster: true,
|
|
56
|
+
children: [<Video.File src={Mp4File} type="video/mp4" />],
|
|
57
|
+
},
|
|
58
|
+
};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { forwardRef, HTMLAttributes } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface VideoProps {
|
|
4
|
+
autoPlay?: boolean;
|
|
5
|
+
muted?: boolean;
|
|
6
|
+
poster?: string;
|
|
7
|
+
mp4File?: string;
|
|
8
|
+
webmFile?: string;
|
|
9
|
+
withControls?: boolean;
|
|
10
|
+
withPoster?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const VideoComponent = forwardRef<
|
|
14
|
+
HTMLVideoElement,
|
|
15
|
+
HTMLAttributes<HTMLVideoElement> & VideoProps
|
|
16
|
+
>(
|
|
17
|
+
(
|
|
18
|
+
{
|
|
19
|
+
children,
|
|
20
|
+
poster,
|
|
21
|
+
withControls = false,
|
|
22
|
+
autoPlay = false,
|
|
23
|
+
muted = false,
|
|
24
|
+
...props
|
|
25
|
+
},
|
|
26
|
+
ref,
|
|
27
|
+
) => {
|
|
28
|
+
return (
|
|
29
|
+
<video
|
|
30
|
+
className="h-full w-full max-w-[800px]"
|
|
31
|
+
ref={ref}
|
|
32
|
+
poster={poster}
|
|
33
|
+
controls={withControls}
|
|
34
|
+
autoPlay={autoPlay}
|
|
35
|
+
muted={muted}
|
|
36
|
+
{...props}
|
|
37
|
+
>
|
|
38
|
+
{children}
|
|
39
|
+
</video>
|
|
40
|
+
);
|
|
41
|
+
},
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const VideoFile = forwardRef<
|
|
45
|
+
HTMLSourceElement,
|
|
46
|
+
HTMLAttributes<HTMLSourceElement> & {
|
|
47
|
+
src: string;
|
|
48
|
+
type: 'video/mp4' | 'video/webm' | 'video/ogv';
|
|
49
|
+
}
|
|
50
|
+
>(({ src, type, ...props }, ref) => {
|
|
51
|
+
return <source ref={ref} src={src} type={type} {...props} />;
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
VideoComponent.displayName = 'Video';
|
|
55
|
+
VideoFile.displayName = 'Video.File';
|
|
56
|
+
|
|
57
|
+
const Video = Object.assign(VideoComponent, {
|
|
58
|
+
File: VideoFile,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export { Video };
|
|
62
|
+
|
|
63
|
+
// export const Video = ({
|
|
64
|
+
// id,
|
|
65
|
+
// className,
|
|
66
|
+
// autoPlay,
|
|
67
|
+
// muted,
|
|
68
|
+
// poster,
|
|
69
|
+
// mp4File,
|
|
70
|
+
// webmFile,
|
|
71
|
+
// ogvFile,
|
|
72
|
+
// height,
|
|
73
|
+
// width,
|
|
74
|
+
// withControls,
|
|
75
|
+
// }: Props) => {
|
|
76
|
+
// return (
|
|
77
|
+
// <video
|
|
78
|
+
// id={id}
|
|
79
|
+
// className={className}
|
|
80
|
+
// poster={poster}
|
|
81
|
+
// width={width}
|
|
82
|
+
// height={height}
|
|
83
|
+
// controls={withControls}
|
|
84
|
+
// autoPlay={autoPlay}
|
|
85
|
+
// muted={muted}
|
|
86
|
+
// >
|
|
87
|
+
// <source src={mp4File} type="video/mp4" />
|
|
88
|
+
// {webmFile !== null && <source src={webmFile} type="video/webm" />}
|
|
89
|
+
// {ogvFile !== undefined && <source src={ogvFile} type="video/ogg" />}
|
|
90
|
+
// </video>
|
|
91
|
+
// );
|
|
92
|
+
// }
|