@stackshift-ui/header 6.0.4 → 6.0.6-beta.0

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.
@@ -0,0 +1,136 @@
1
+ import { Button } from "@stackshift-ui/button";
2
+ import { Container } from "@stackshift-ui/container";
3
+ import { Flex } from "@stackshift-ui/flex";
4
+ import { Heading } from "@stackshift-ui/heading";
5
+ import { Image } from "@stackshift-ui/image";
6
+ import { Section } from "@stackshift-ui/section";
7
+ import { Text } from "@stackshift-ui/text";
8
+ import React from "react";
9
+ import { ButtonProps, HeaderProps } from ".";
10
+ import { Images } from "./types";
11
+
12
+ export default function Header_B({
13
+ images,
14
+ title,
15
+ description,
16
+ primaryButton,
17
+ secondaryButton,
18
+ }: HeaderProps) {
19
+ return (
20
+ <Section className="relative z-10 py-20 bg-background">
21
+ <Container maxWidth={1280}>
22
+ <Flex align="center" direction="col" gap={4} className="lg:flex-row">
23
+ <Flex align="center" direction="col" className="w-full basis-1/2">
24
+ <div className="max-w-md mx-auto text-center lg:text-left">
25
+ <TitleAndDescription title={title} description={description} />
26
+ <Buttons primaryButton={primaryButton} secondaryButton={secondaryButton} />
27
+ </div>
28
+ </Flex>
29
+ {images && <ImageGallery images={images} />}
30
+ </Flex>
31
+ </Container>
32
+ </Section>
33
+ );
34
+ }
35
+
36
+ function TitleAndDescription({ title, description }: { title?: string; description?: string }) {
37
+ return (
38
+ <React.Fragment>
39
+ {title && (
40
+ <Heading fontSize="3xl" className="mb-3">
41
+ {title}
42
+ </Heading>
43
+ )}
44
+ {description && (
45
+ <Text muted className="my-6">
46
+ {description}
47
+ </Text>
48
+ )}
49
+ </React.Fragment>
50
+ );
51
+ }
52
+
53
+ function Buttons({
54
+ primaryButton,
55
+ secondaryButton,
56
+ }: {
57
+ primaryButton?: ButtonProps;
58
+ secondaryButton?: ButtonProps;
59
+ }) {
60
+ return (
61
+ <Flex
62
+ align="center"
63
+ gap={2}
64
+ className="flex items-center justify-center lg:justify-start gap-2 flex-col md:flex-row">
65
+ {primaryButton?.label && (
66
+ <Button as="link" link={primaryButton} ariaLabel={primaryButton?.label}>
67
+ {primaryButton?.label}
68
+ </Button>
69
+ )}
70
+ {secondaryButton?.label && (
71
+ <Button
72
+ as="link"
73
+ link={secondaryButton}
74
+ className="bg-secondary hover:bg-secondary/50 inline-block rounded-global font-bold transition duration-200 px-6 py-3"
75
+ ariaLabel={secondaryButton?.label}>
76
+ {secondaryButton?.label}
77
+ </Button>
78
+ )}
79
+ </Flex>
80
+ );
81
+ }
82
+
83
+ function ImageGallery({ images }: { images: Images[] }) {
84
+ if (!images) return null;
85
+
86
+ return (
87
+ <div className="w-full px-4 lg:w-1/2">
88
+ <div className="mb-3 sm:flex lg:mb-4 lg:ml-6">
89
+ {images?.[0]?.image && (
90
+ <Image
91
+ className="relative object-cover mb-3 mr-2 overflow-hidden rounded-xl sm:mb-0 sm:w-1/3 md:rounded-3xl lg:rounded-br-none"
92
+ sizes="100vw"
93
+ src={`${images?.[0]?.image}`}
94
+ width={941}
95
+ height={734}
96
+ alt={images?.[0]?.alt ?? "header-image-1"}
97
+ />
98
+ )}
99
+ {images?.[1]?.image && (
100
+ <Image
101
+ className="relative object-cover overflow-hidden rounded-xl sm:ml-2 sm:w-2/3 md:rounded-3xl lg:rounded-bl-none"
102
+ sizes="100vw"
103
+ src={`${images?.[1]?.image}`}
104
+ width={1050}
105
+ height={701}
106
+ alt={images?.[1]?.alt ?? "header-image-2"}
107
+ />
108
+ )}
109
+ </div>
110
+ <div className="mb-3 sm:flex lg:mb-4 lg:mr-6">
111
+ {images?.[2]?.image && (
112
+ <Image
113
+ className="object-cover mb-3 mr-2 overflow-hidden rounded-xl sm:w-2/3 md:mb-0 md:rounded-3xl lg:rounded-br-none"
114
+ sizes="100vw"
115
+ src={`${images?.[2]?.image}`}
116
+ width={1050}
117
+ height={701}
118
+ alt={images?.[2]?.alt ?? "header-image-3"}
119
+ />
120
+ )}
121
+ {images?.[3]?.image && (
122
+ <Image
123
+ className="object-cover overflow-hidden rounded-xl sm:ml-2 sm:w-1/3 md:rounded-3xl lg:rounded-bl-none"
124
+ sizes="100vw"
125
+ src={`${images?.[3]?.image}`}
126
+ width={941}
127
+ height={734}
128
+ alt={images?.[3]?.alt ?? "header-image-4"}
129
+ />
130
+ )}
131
+ </div>
132
+ </div>
133
+ );
134
+ }
135
+
136
+ export { Header_B };
@@ -0,0 +1,87 @@
1
+ import { Button } from "@stackshift-ui/button";
2
+ import { Container } from "@stackshift-ui/container";
3
+ import { Flex } from "@stackshift-ui/flex";
4
+ import { Heading } from "@stackshift-ui/heading";
5
+ import { Section } from "@stackshift-ui/section";
6
+ import { ButtonProps, HeaderProps } from ".";
7
+
8
+ export default function Header_C({
9
+ videoLink,
10
+ title,
11
+ primaryButton,
12
+ secondaryButton,
13
+ }: HeaderProps) {
14
+ // get the video link ID
15
+ let videoLinkId;
16
+
17
+ if (videoLink) {
18
+ if (videoLink.includes("embed")) {
19
+ videoLinkId = videoLink.split("/")[4];
20
+ } else {
21
+ videoLinkId = videoLink.split("/watch?v=")[1] || videoLink.split("/")[3];
22
+ }
23
+ }
24
+
25
+ return (
26
+ <Section className="py-20 md:py-52 bg-background">
27
+ <Container maxWidth={1280}>
28
+ <div className="max-w-2xl mx-auto mb-12 text-center md:mb-20">
29
+ {title && (
30
+ <Heading fontSize="3xl" className="mb-10">
31
+ {title}
32
+ </Heading>
33
+ )}
34
+ <Buttons primaryButton={primaryButton} secondaryButton={secondaryButton} />
35
+ </div>
36
+ <div className="md:mx-20 lg:mx-60 xl:mx-60">
37
+ {videoLinkId && <VideoPlayer videoLinkId={videoLinkId} title={title} />}
38
+ </div>
39
+ </Container>
40
+ </Section>
41
+ );
42
+ }
43
+
44
+ function VideoPlayer({ videoLinkId, title }: { videoLinkId?: string; title?: string }) {
45
+ return (
46
+ <div className="aspect-video">
47
+ <iframe
48
+ aria-label="Show Video Frame"
49
+ className="w-full h-full border-4 rounded-3xl border-primary"
50
+ src={`https://www.youtube.com/embed/${videoLinkId}`}
51
+ srcDoc={`<style>*{padding:0;margin:0;overflow:hidden;border-radius:24px}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}</style><a href=${`https://www.youtube.com/embed/${videoLinkId}`}><img src=${`https://i.ytimg.com/vi_webp/${videoLinkId}/maxresdefault.webp`} alt=${title} loading="lazy" /><span>▶</span></a>`}
52
+ loading="lazy"
53
+ allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
54
+ allowFullScreen
55
+ />
56
+ </div>
57
+ );
58
+ }
59
+
60
+ function Buttons({
61
+ primaryButton,
62
+ secondaryButton,
63
+ }: {
64
+ primaryButton?: ButtonProps;
65
+ secondaryButton?: ButtonProps;
66
+ }) {
67
+ return (
68
+ <Flex align="center" gap={4} justify="center" className="flex-col lg:flex-row">
69
+ {primaryButton?.label && (
70
+ <Button as="link" ariaLabel={primaryButton?.label} link={primaryButton}>
71
+ {primaryButton?.label}
72
+ </Button>
73
+ )}
74
+ {secondaryButton?.label && (
75
+ <Button
76
+ as="link"
77
+ ariaLabel={secondaryButton?.label}
78
+ link={secondaryButton}
79
+ className="bg-secondary hover:bg-secondary/50 inline-block rounded-global font-bold transition duration-200 px-3 py-4">
80
+ {secondaryButton?.label}
81
+ </Button>
82
+ )}
83
+ </Flex>
84
+ );
85
+ }
86
+
87
+ export { Header_C };
@@ -0,0 +1,113 @@
1
+ import { Button } from "@stackshift-ui/button";
2
+ import { Container } from "@stackshift-ui/container";
3
+ import { Flex } from "@stackshift-ui/flex";
4
+ import { Heading } from "@stackshift-ui/heading";
5
+ import { Image } from "@stackshift-ui/image";
6
+ import { Section } from "@stackshift-ui/section";
7
+ import { Text } from "@stackshift-ui/text";
8
+ import React from "react";
9
+ import { ButtonProps, HeaderProps } from ".";
10
+
11
+ export default function Header_D({
12
+ title,
13
+ description,
14
+ primaryButton,
15
+ secondaryButton,
16
+ mainImage,
17
+ }: HeaderProps): JSX.Element {
18
+ return (
19
+ <Section className="py-20 bg-background">
20
+ <Container maxWidth={1280}>
21
+ <Flex align="center" className="flex-col lg:flex-row" gap={4}>
22
+ <Flex align="center" className="w-full basis-1/2" direction="col">
23
+ <Container className="mx-auto items-center text-center lg:text-left" maxWidth="md">
24
+ <TitleAndDescription title={title} description={description} />
25
+ <Buttons primaryButton={primaryButton} secondaryButton={secondaryButton} />
26
+ </Container>
27
+ </Flex>
28
+ <MainImage mainImage={mainImage} />
29
+ </Flex>
30
+ </Container>
31
+ </Section>
32
+ );
33
+ }
34
+
35
+ function TitleAndDescription({ title, description }: { title?: string; description?: string }) {
36
+ return (
37
+ <React.Fragment>
38
+ {title ? (
39
+ <Heading fontSize="3xl" className="mb-3" type="h1">
40
+ {title}
41
+ </Heading>
42
+ ) : null}
43
+ {description ? (
44
+ <Text className="my-6" muted>
45
+ {description}
46
+ </Text>
47
+ ) : null}
48
+ </React.Fragment>
49
+ );
50
+ }
51
+
52
+ function Buttons({
53
+ primaryButton,
54
+ secondaryButton,
55
+ }: {
56
+ primaryButton?: ButtonProps;
57
+ secondaryButton?: ButtonProps;
58
+ }) {
59
+ return (
60
+ <Flex
61
+ align="center"
62
+ className="flex items-center justify-center lg:justify-start gap-2 flex-col md:flex-row"
63
+ gap={2}>
64
+ {primaryButton?.label ? (
65
+ <Button
66
+ as="link"
67
+ link={primaryButton}
68
+ ariaLabel={primaryButton?.ariaLabel ?? primaryButton?.label}
69
+ variant="solid"
70
+ className="bg-primary hover:bg-primary/50 rounded-global px-6 py-3 text-white">
71
+ {primaryButton.label}
72
+ </Button>
73
+ ) : null}
74
+ {secondaryButton?.label ? (
75
+ <Button
76
+ as="link"
77
+ link={secondaryButton}
78
+ ariaLabel={secondaryButton.ariaLabel ?? secondaryButton?.label}
79
+ variant="solid"
80
+ className="bg-secondary hover:bg-secondary/50 rounded-global px-6 py-3">
81
+ {secondaryButton.label}
82
+ </Button>
83
+ ) : null}
84
+ </Flex>
85
+ );
86
+ }
87
+
88
+ interface MainImageProps {
89
+ mainImage?: {
90
+ image?: string | any;
91
+ alt?: string;
92
+ };
93
+ }
94
+
95
+ function MainImage({ mainImage }: MainImageProps) {
96
+ if (!mainImage?.image) return null;
97
+
98
+ return (
99
+ <div className="w-full h-full">
100
+ <Image
101
+ alt={mainImage.alt ?? "header-main-image"}
102
+ className="rounded-md"
103
+ height={700}
104
+ sizes="100vw"
105
+ src={`${mainImage?.image}`}
106
+ style={{ objectFit: "contain" }}
107
+ width={1050}
108
+ />
109
+ </div>
110
+ );
111
+ }
112
+
113
+ export { Header_D };
@@ -0,0 +1,84 @@
1
+ import { Button } from "@stackshift-ui/button";
2
+ import { Container } from "@stackshift-ui/container";
3
+ import { Flex } from "@stackshift-ui/flex";
4
+ import { Heading } from "@stackshift-ui/heading";
5
+ import { Section } from "@stackshift-ui/section";
6
+ import { SigninSignup_A } from "@stackshift-ui/signin-signup";
7
+ import { Text } from "@stackshift-ui/text";
8
+ import React from "react";
9
+ import { ButtonProps, HeaderProps } from ".";
10
+
11
+ export default function Header_E({
12
+ title,
13
+ description,
14
+ primaryButton,
15
+ secondaryButton,
16
+ formLinks,
17
+ form,
18
+ }: HeaderProps) {
19
+ return (
20
+ <Section className="relative py-20 bg-background">
21
+ <Container maxWidth={1280}>
22
+ <Flex align="center" className="flex-col lg:flex-row" gap={4}>
23
+ <Flex align="center" direction="col" className="w-full basis-1/2">
24
+ <div className="max-w-md mx-auto text-center lg:text-left">
25
+ <TitleAndDescription title={title} description={description} />
26
+ <Buttons primaryButton={primaryButton} secondaryButton={secondaryButton} />
27
+ </div>
28
+ </Flex>
29
+ <div className="w-full lg:w-1/2">
30
+ <div className="max-w-sm mx-auto text-center">
31
+ <SigninSignup_A form={form} formLinks={formLinks} />
32
+ </div>
33
+ </div>
34
+ </Flex>
35
+ </Container>
36
+ </Section>
37
+ );
38
+ }
39
+
40
+ function TitleAndDescription({ title, description }: { title?: string; description?: string }) {
41
+ return (
42
+ <React.Fragment>
43
+ {title && (
44
+ <Heading fontSize="3xl" className="mb-3">
45
+ {title}
46
+ </Heading>
47
+ )}
48
+ {description && (
49
+ <Text muted className="my-6">
50
+ {description}
51
+ </Text>
52
+ )}
53
+ </React.Fragment>
54
+ );
55
+ }
56
+
57
+ function Buttons({
58
+ primaryButton,
59
+ secondaryButton,
60
+ }: {
61
+ primaryButton?: ButtonProps;
62
+ secondaryButton?: ButtonProps;
63
+ }) {
64
+ return (
65
+ <Flex align="center" gap={2} className="flex-col md:flex-row justify-center lg:justify-start">
66
+ {primaryButton?.label && (
67
+ <Button as="link" link={primaryButton} ariaLabel={primaryButton?.label}>
68
+ {primaryButton?.label}
69
+ </Button>
70
+ )}
71
+ {secondaryButton?.label && (
72
+ <Button
73
+ as="link"
74
+ link={secondaryButton}
75
+ className="bg-secondary hover:bg-secondary/50 inline-block rounded-global font-bold transition duration-200 px-6 py-3"
76
+ ariaLabel={secondaryButton?.label}>
77
+ {secondaryButton?.label}
78
+ </Button>
79
+ )}
80
+ </Flex>
81
+ );
82
+ }
83
+
84
+ export { Header_E };
package/src/index.ts ADDED
@@ -0,0 +1,9 @@
1
+ "use client";
2
+
3
+ // component exports
4
+ export * from "./header";
5
+ export * from "./header_a";
6
+ export * from "./header_b";
7
+ export * from "./header_c";
8
+ export * from "./header_d";
9
+ export * from "./header_e";