@stackshift-ui/header 7.0.0-beta.0 → 7.0.0-beta.10

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.
Files changed (54) hide show
  1. package/package.json +14 -14
  2. package/src/header.tsx +22 -15
  3. package/src/header_a.tsx +6 -30
  4. package/src/header_b.tsx +6 -31
  5. package/src/header_c.tsx +7 -36
  6. package/src/header_d.tsx +6 -30
  7. package/src/header_e.tsx +6 -30
  8. package/src/header_f.tsx +2 -8
  9. package/src/header_g.tsx +3 -11
  10. package/src/helpers/index.tsx +130 -0
  11. package/src/types.ts +136 -3
  12. package/dist/chunk-5DSFRN7E.mjs +0 -1
  13. package/dist/chunk-7SQGIFHM.mjs +0 -1
  14. package/dist/chunk-DN6UM2LP.mjs +0 -1
  15. package/dist/chunk-IZSK2OAC.mjs +0 -1
  16. package/dist/chunk-KCZJVXVR.mjs +0 -1
  17. package/dist/chunk-LA2DIHLF.mjs +0 -1
  18. package/dist/chunk-O23POPQC.mjs +0 -1
  19. package/dist/chunk-PPCMCZ5V.mjs +0 -1
  20. package/dist/chunk-W2QPS3BW.mjs +0 -1
  21. package/dist/header.d.ts +0 -34
  22. package/dist/header.js +0 -1
  23. package/dist/header.mjs +0 -1
  24. package/dist/header_a.d.ts +0 -3
  25. package/dist/header_a.js +0 -1
  26. package/dist/header_a.mjs +0 -1
  27. package/dist/header_b.d.ts +0 -3
  28. package/dist/header_b.js +0 -1
  29. package/dist/header_b.mjs +0 -1
  30. package/dist/header_c.d.ts +0 -3
  31. package/dist/header_c.js +0 -1
  32. package/dist/header_c.mjs +0 -1
  33. package/dist/header_d.d.ts +0 -3
  34. package/dist/header_d.js +0 -1
  35. package/dist/header_d.mjs +0 -1
  36. package/dist/header_e.d.ts +0 -3
  37. package/dist/header_e.js +0 -1
  38. package/dist/header_e.mjs +0 -1
  39. package/dist/header_f.d.ts +0 -3
  40. package/dist/header_f.js +0 -1
  41. package/dist/header_f.mjs +0 -1
  42. package/dist/header_g.d.ts +0 -3
  43. package/dist/header_g.js +0 -1
  44. package/dist/header_g.mjs +0 -1
  45. package/dist/index.d.ts +0 -8
  46. package/dist/index.js +0 -2
  47. package/dist/index.mjs +0 -2
  48. package/dist/types.d.ts +0 -403
  49. package/dist/types.js +0 -1
  50. package/dist/utils/portableText/customBlockStyle.d.ts +0 -2
  51. package/dist/utils/portableText/customBlockStyle.js +0 -1
  52. package/dist/utils/portableText/customBlockStyle.mjs +0 -1
  53. package/dist/utils/portableText.d.ts +0 -0
  54. package/dist/utils/portableText.js +0 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stackshift-ui/header",
3
3
  "description": "",
4
- "version": "7.0.0-beta.0",
4
+ "version": "7.0.0-beta.10",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "main": "./dist/index.js",
@@ -33,21 +33,21 @@
33
33
  "dependencies": {
34
34
  "@portabletext/react": "^3.1.0",
35
35
  "react-icons": "^5.3.0",
36
- "@stackshift-ui/heading": "7.0.0-beta.0",
37
- "@stackshift-ui/button": "6.1.0-beta.0",
38
- "@stackshift-ui/container": "7.0.0-beta.0",
39
- "@stackshift-ui/section": "7.0.0-beta.0",
40
- "@stackshift-ui/flex": "7.0.0-beta.0",
41
- "@stackshift-ui/image": "6.1.0-beta.0",
42
- "@stackshift-ui/scripts": "6.1.0-beta.0",
43
- "@stackshift-ui/system": "6.1.0-beta.0",
44
- "@stackshift-ui/text": "7.0.0-beta.0",
45
- "@stackshift-ui/signin-signup": "7.0.0-beta.0",
46
- "@stackshift-ui/swiper-pagination": "7.0.0-beta.0",
47
- "@stackshift-ui/link": "6.0.12-beta.0"
36
+ "@stackshift-ui/flex": "7.0.0-beta.5",
37
+ "@stackshift-ui/heading": "7.0.0-beta.5",
38
+ "@stackshift-ui/button": "7.0.0-beta.7",
39
+ "@stackshift-ui/image": "7.0.0-beta.6",
40
+ "@stackshift-ui/container": "7.0.0-beta.5",
41
+ "@stackshift-ui/scripts": "7.0.0-beta.4",
42
+ "@stackshift-ui/section": "7.0.0-beta.5",
43
+ "@stackshift-ui/link": "7.0.0-beta.5",
44
+ "@stackshift-ui/system": "7.0.0-beta.5",
45
+ "@stackshift-ui/text": "7.0.0-beta.5",
46
+ "@stackshift-ui/signin-signup": "7.0.0-beta.10",
47
+ "@stackshift-ui/swiper-pagination": "7.0.0-beta.5"
48
48
  },
49
49
  "peerDependencies": {
50
- "@stackshift-ui/system": ">=6.1.0-beta.0",
50
+ "@stackshift-ui/system": ">=7.0.0-beta.5",
51
51
  "@types/react": "16.8 - 19",
52
52
  "next": "10 - 14",
53
53
  "react": "16.8 - 19",
package/src/header.tsx CHANGED
@@ -1,22 +1,29 @@
1
- import React, { lazy } from "react";
1
+ import React from "react";
2
+ import HeaderA from "./header_a";
3
+ import HeaderB from "./header_b";
4
+ import HeaderC from "./header_c";
5
+ import HeaderD from "./header_d";
6
+ import HeaderE from "./header_e";
7
+ import HeaderF from "./header_f";
8
+ import HeaderG from "./header_g";
2
9
  import {
3
- Form,
4
- HeaderSections,
5
- Images,
6
- LabeledRouteWithKey,
7
- MainImage,
8
- SectionsProps,
9
- Template,
10
+ Form,
11
+ HeaderSections,
12
+ Images,
13
+ LabeledRouteWithKey,
14
+ MainImage,
15
+ SectionsProps,
16
+ Template,
10
17
  } from "./types";
11
18
 
12
19
  const Variants = {
13
- variant_a: lazy(() => import("./header_a")),
14
- variant_b: lazy(() => import("./header_b")),
15
- variant_c: lazy(() => import("./header_c")),
16
- variant_d: lazy(() => import("./header_d")),
17
- variant_e: lazy(() => import("./header_e")),
18
- variant_f: lazy(() => import("./header_f")),
19
- variant_g: lazy(() => import("./header_g")),
20
+ variant_a: HeaderA,
21
+ variant_b: HeaderB,
22
+ variant_c: HeaderC,
23
+ variant_d: HeaderD,
24
+ variant_e: HeaderE,
25
+ variant_f: HeaderF,
26
+ variant_g: HeaderG,
20
27
  };
21
28
 
22
29
  export interface ButtonProps {
package/src/header_a.tsx CHANGED
@@ -3,9 +3,7 @@ import { Container } from "@stackshift-ui/container";
3
3
  import { Flex } from "@stackshift-ui/flex";
4
4
  import { Heading } from "@stackshift-ui/heading";
5
5
  import { Image } from "@stackshift-ui/image";
6
- import { Link } from "@stackshift-ui/link";
7
6
  import { Section } from "@stackshift-ui/section";
8
- import { buildSanityLink } from "@stackshift-ui/system";
9
7
  import { Text } from "@stackshift-ui/text";
10
8
  import React from "react";
11
9
  import { ButtonProps, HeaderProps } from ".";
@@ -58,18 +56,6 @@ function Buttons({
58
56
  primaryButton?: ButtonProps;
59
57
  secondaryButton?: ButtonProps;
60
58
  }) {
61
- const primaryButtonLink = buildSanityLink({
62
- type: "linkInternal",
63
- internalLink: primaryButton?.link?.target === "_self" ? primaryButton?.link?.route : "",
64
- externalLink: primaryButton?.link?.target != "_self" ? primaryButton?.link?.route : "",
65
- });
66
-
67
- const secondaryButtonLink = buildSanityLink({
68
- type: "linkInternal",
69
- internalLink: secondaryButton?.link?.target === "_self" ? secondaryButton?.link?.route : "",
70
- externalLink: secondaryButton?.link?.target != "_self" ? secondaryButton?.link?.route : "",
71
- });
72
-
73
59
  return (
74
60
  <Flex
75
61
  align="center"
@@ -78,27 +64,17 @@ function Buttons({
78
64
  direction="col"
79
65
  className="lg:justify-start md:flex-row">
80
66
  {primaryButton?.label && (
81
- <Button variant="default" aria-label={primaryButton?.label} asChild>
82
- <Link
83
- href={primaryButtonLink.href}
84
- target={primaryButtonLink.target}
85
- rel={primaryButtonLink.rel}>
86
- {primaryButton?.label}
87
- </Link>
67
+ <Button as="link" link={primaryButton}>
68
+ {primaryButton?.label}
88
69
  </Button>
89
70
  )}
90
71
  {secondaryButton?.label && (
91
72
  <Button
73
+ as="link"
74
+ link={secondaryButton}
92
75
  variant="secondary"
93
- className="bg-transparent border hover:bg-gray-300 inline-block font-default text-default transition duration-200 rounded-global"
94
- aria-label={secondaryButton?.label}
95
- asChild>
96
- <Link
97
- href={secondaryButtonLink.href}
98
- target={secondaryButtonLink.target}
99
- rel={secondaryButtonLink.rel}>
100
- {secondaryButton?.label}
101
- </Link>
76
+ className="bg-transparent border hover:bg-gray-300 inline-block font-default text-default transition duration-200 rounded-global">
77
+ {secondaryButton?.label}
102
78
  </Button>
103
79
  )}
104
80
  </Flex>
package/src/header_b.tsx CHANGED
@@ -3,9 +3,7 @@ import { Container } from "@stackshift-ui/container";
3
3
  import { Flex } from "@stackshift-ui/flex";
4
4
  import { Heading } from "@stackshift-ui/heading";
5
5
  import { Image } from "@stackshift-ui/image";
6
- import { Link } from "@stackshift-ui/link";
7
6
  import { Section } from "@stackshift-ui/section";
8
- import { buildSanityLink } from "@stackshift-ui/system";
9
7
  import { Text } from "@stackshift-ui/text";
10
8
  import React from "react";
11
9
  import { ButtonProps, HeaderProps } from ".";
@@ -59,18 +57,6 @@ function Buttons({
59
57
  primaryButton?: ButtonProps;
60
58
  secondaryButton?: ButtonProps;
61
59
  }) {
62
- const primaryButtonLink = buildSanityLink({
63
- type: "linkInternal",
64
- internalLink: primaryButton?.link?.target === "_self" ? primaryButton?.link?.route : "",
65
- externalLink: primaryButton?.link?.target != "_self" ? primaryButton?.link?.route : "",
66
- });
67
-
68
- const secondaryButtonLink = buildSanityLink({
69
- type: "linkInternal",
70
- internalLink: secondaryButton?.link?.target === "_self" ? secondaryButton?.link?.route : "",
71
- externalLink: secondaryButton?.link?.target != "_self" ? secondaryButton?.link?.route : "",
72
- });
73
-
74
60
  return (
75
61
  <Flex
76
62
  align="center"
@@ -79,27 +65,16 @@ function Buttons({
79
65
  direction="col"
80
66
  className="lg:justify-start md:flex-row">
81
67
  {primaryButton?.label && (
82
- <Button variant="default" aria-label={primaryButton?.label} asChild>
83
- <Link
84
- href={primaryButtonLink.href}
85
- target={primaryButtonLink.target}
86
- rel={primaryButtonLink.rel}>
87
- {primaryButton?.label}
88
- </Link>
68
+ <Button as="link" link={primaryButton}>
69
+ {primaryButton?.label}
89
70
  </Button>
90
71
  )}
91
72
  {secondaryButton?.label && (
92
73
  <Button
93
- variant="secondary"
94
- className="bg-transparent border hover:bg-gray-300 inline-block font-default text-default transition duration-200 rounded-global"
95
- aria-label={secondaryButton?.label}
96
- asChild>
97
- <Link
98
- href={secondaryButtonLink.href}
99
- target={secondaryButtonLink.target}
100
- rel={secondaryButtonLink.rel}>
101
- {secondaryButton?.label}
102
- </Link>
74
+ as="link"
75
+ link={secondaryButton}
76
+ className="bg-transparent border hover:bg-gray-300 inline-block font-default text-default transition duration-200 rounded-global">
77
+ {secondaryButton?.label}
103
78
  </Button>
104
79
  )}
105
80
  </Flex>
package/src/header_c.tsx CHANGED
@@ -2,9 +2,7 @@ import { Button } from "@stackshift-ui/button";
2
2
  import { Container } from "@stackshift-ui/container";
3
3
  import { Flex } from "@stackshift-ui/flex";
4
4
  import { Heading } from "@stackshift-ui/heading";
5
- import { Link } from "@stackshift-ui/link";
6
5
  import { Section } from "@stackshift-ui/section";
7
- import { buildSanityLink } from "@stackshift-ui/system";
8
6
  import { ButtonProps, HeaderProps } from ".";
9
7
 
10
8
  export default function Header_C({
@@ -66,47 +64,20 @@ function Buttons({
66
64
  primaryButton?: ButtonProps;
67
65
  secondaryButton?: ButtonProps;
68
66
  }) {
69
- const primaryButtonLink = buildSanityLink({
70
- type: "linkInternal",
71
- internalLink: primaryButton?.link?.target === "_self" ? primaryButton?.link?.route : "",
72
- externalLink: primaryButton?.link?.target != "_self" ? primaryButton?.link?.route : "",
73
- });
74
-
75
- const secondaryButtonLink = buildSanityLink({
76
- type: "linkInternal",
77
- internalLink: secondaryButton?.link?.target === "_self" ? secondaryButton?.link?.route : "",
78
- externalLink: secondaryButton?.link?.target != "_self" ? secondaryButton?.link?.route : "",
79
- });
80
-
81
67
  return (
82
- <Flex
83
- align="center"
84
- justify="center"
85
- gap={2}
86
- direction="col"
87
- className="lg:justify-start md:flex-row">
68
+ <Flex align="center" justify="center" gap={2} direction="col" className="md:flex-row">
88
69
  {primaryButton?.label && (
89
- <Button variant="default" aria-label={primaryButton?.label} asChild>
90
- <Link
91
- href={primaryButtonLink.href}
92
- target={primaryButtonLink.target}
93
- rel={primaryButtonLink.rel}>
94
- {primaryButton?.label}
95
- </Link>
70
+ <Button as="link" link={primaryButton}>
71
+ {primaryButton?.label}
96
72
  </Button>
97
73
  )}
98
74
  {secondaryButton?.label && (
99
75
  <Button
76
+ as="link"
77
+ link={secondaryButton}
100
78
  variant="secondary"
101
- className="bg-transparent border hover:bg-gray-300 inline-block font-default text-default transition duration-200 rounded-global"
102
- aria-label={secondaryButton?.label}
103
- asChild>
104
- <Link
105
- href={secondaryButtonLink.href}
106
- target={secondaryButtonLink.target}
107
- rel={secondaryButtonLink.rel}>
108
- {secondaryButton?.label}
109
- </Link>
79
+ className="bg-transparent border hover:bg-gray-300 inline-block font-default text-default transition duration-200 rounded-global">
80
+ {secondaryButton?.label}
110
81
  </Button>
111
82
  )}
112
83
  </Flex>
package/src/header_d.tsx CHANGED
@@ -3,9 +3,7 @@ import { Container } from "@stackshift-ui/container";
3
3
  import { Flex } from "@stackshift-ui/flex";
4
4
  import { Heading } from "@stackshift-ui/heading";
5
5
  import { Image } from "@stackshift-ui/image";
6
- import { Link } from "@stackshift-ui/link";
7
6
  import { Section } from "@stackshift-ui/section";
8
- import { buildSanityLink } from "@stackshift-ui/system";
9
7
  import { Text } from "@stackshift-ui/text";
10
8
  import React from "react";
11
9
  import { ButtonProps, HeaderProps } from ".";
@@ -58,18 +56,6 @@ function Buttons({
58
56
  primaryButton?: ButtonProps;
59
57
  secondaryButton?: ButtonProps;
60
58
  }) {
61
- const primaryButtonLink = buildSanityLink({
62
- type: "linkInternal",
63
- internalLink: primaryButton?.link?.target === "_self" ? primaryButton?.link?.route : "",
64
- externalLink: primaryButton?.link?.target != "_self" ? primaryButton?.link?.route : "",
65
- });
66
-
67
- const secondaryButtonLink = buildSanityLink({
68
- type: "linkInternal",
69
- internalLink: secondaryButton?.link?.target === "_self" ? secondaryButton?.link?.route : "",
70
- externalLink: secondaryButton?.link?.target != "_self" ? secondaryButton?.link?.route : "",
71
- });
72
-
73
59
  return (
74
60
  <Flex
75
61
  align="center"
@@ -78,27 +64,17 @@ function Buttons({
78
64
  direction="col"
79
65
  className="lg:justify-start md:flex-row">
80
66
  {primaryButton?.label && (
81
- <Button variant="default" aria-label={primaryButton?.label} asChild>
82
- <Link
83
- href={primaryButtonLink.href}
84
- target={primaryButtonLink.target}
85
- rel={primaryButtonLink.rel}>
86
- {primaryButton?.label}
87
- </Link>
67
+ <Button as="link" link={primaryButton}>
68
+ {primaryButton?.label}
88
69
  </Button>
89
70
  )}
90
71
  {secondaryButton?.label && (
91
72
  <Button
73
+ as="link"
74
+ link={secondaryButton}
92
75
  variant="secondary"
93
- className="bg-transparent border hover:bg-gray-300 inline-block font-default text-default transition duration-200 rounded-global"
94
- aria-label={secondaryButton?.label}
95
- asChild>
96
- <Link
97
- href={secondaryButtonLink.href}
98
- target={secondaryButtonLink.target}
99
- rel={secondaryButtonLink.rel}>
100
- {secondaryButton?.label}
101
- </Link>
76
+ className="bg-transparent border hover:bg-gray-300 inline-block font-default text-default transition duration-200 rounded-global">
77
+ {secondaryButton?.label}
102
78
  </Button>
103
79
  )}
104
80
  </Flex>
package/src/header_e.tsx CHANGED
@@ -2,10 +2,8 @@ import { Button } from "@stackshift-ui/button";
2
2
  import { Container } from "@stackshift-ui/container";
3
3
  import { Flex } from "@stackshift-ui/flex";
4
4
  import { Heading } from "@stackshift-ui/heading";
5
- import { Link } from "@stackshift-ui/link";
6
5
  import { Section } from "@stackshift-ui/section";
7
6
  import { SigninSignup_A } from "@stackshift-ui/signin-signup";
8
- import { buildSanityLink } from "@stackshift-ui/system";
9
7
  import { Text } from "@stackshift-ui/text";
10
8
  import React from "react";
11
9
  import { ButtonProps, HeaderProps } from ".";
@@ -63,18 +61,6 @@ function Buttons({
63
61
  primaryButton?: ButtonProps;
64
62
  secondaryButton?: ButtonProps;
65
63
  }) {
66
- const primaryButtonLink = buildSanityLink({
67
- type: "linkInternal",
68
- internalLink: primaryButton?.link?.target === "_self" ? primaryButton?.link?.route : "",
69
- externalLink: primaryButton?.link?.target != "_self" ? primaryButton?.link?.route : "",
70
- });
71
-
72
- const secondaryButtonLink = buildSanityLink({
73
- type: "linkInternal",
74
- internalLink: secondaryButton?.link?.target === "_self" ? secondaryButton?.link?.route : "",
75
- externalLink: secondaryButton?.link?.target != "_self" ? secondaryButton?.link?.route : "",
76
- });
77
-
78
64
  return (
79
65
  <Flex
80
66
  align="center"
@@ -83,27 +69,17 @@ function Buttons({
83
69
  direction="col"
84
70
  className="lg:justify-start md:flex-row">
85
71
  {primaryButton?.label && (
86
- <Button variant="default" aria-label={primaryButton?.label} asChild>
87
- <Link
88
- href={primaryButtonLink.href}
89
- target={primaryButtonLink.target}
90
- rel={primaryButtonLink.rel}>
91
- {primaryButton?.label}
92
- </Link>
72
+ <Button variant="default" as="link" link={primaryButton}>
73
+ {primaryButton?.label}
93
74
  </Button>
94
75
  )}
95
76
  {secondaryButton?.label && (
96
77
  <Button
78
+ as="link"
79
+ link={secondaryButton}
97
80
  variant="secondary"
98
- className="bg-transparent border hover:bg-gray-300 inline-block font-default text-default transition duration-200 rounded-global"
99
- aria-label={secondaryButton?.label}
100
- asChild>
101
- <Link
102
- href={secondaryButtonLink.href}
103
- target={secondaryButtonLink.target}
104
- rel={secondaryButtonLink.rel}>
105
- {secondaryButton?.label}
106
- </Link>
81
+ className="bg-transparent border hover:bg-gray-300 inline-block font-default text-default transition duration-200 rounded-global">
82
+ {secondaryButton?.label}
107
83
  </Button>
108
84
  )}
109
85
  </Flex>
package/src/header_f.tsx CHANGED
@@ -11,7 +11,7 @@ import { customBlockStyle } from "./utils/portableText/customBlockStyle";
11
11
  import { Link } from "@stackshift-ui/link";
12
12
  import { buildSanityLink } from "@stackshift-ui/system";
13
13
  import { HeaderProps } from ".";
14
- import { HeaderBox, HeaderSections } from "./types";
14
+ import { HeaderBox, HeaderSections, LabeledRoute } from "./types";
15
15
 
16
16
  const IMAGE_HEIGHT_CLASSES = {
17
17
  lg: "min-h-[200px] sm:min-h-[400px] md:min-h-[600px] lg:min-h-[800px] xl:min-h-[1150px]",
@@ -162,13 +162,7 @@ const HeaderTitleSection = ({ header }: { header: HeaderBox }) => (
162
162
  );
163
163
 
164
164
  const HeaderButton = ({ header }: { header: HeaderSections }) => {
165
- const primaryButtonLink = buildSanityLink({
166
- type: "linkInternal",
167
- internalLink:
168
- header?.primaryButton?.link?.target === "_self" ? header?.primaryButton?.link?.route : "",
169
- externalLink:
170
- header?.primaryButton?.link?.target != "_self" ? header?.primaryButton?.link?.route : "",
171
- });
165
+ const primaryButtonLink = buildSanityLink(header.primaryButton as LabeledRoute);
172
166
 
173
167
  return (
174
168
  <div className={`flex justify-${header?.alignment} gap-4`}>
package/src/header_g.tsx CHANGED
@@ -8,6 +8,7 @@ import { buildSanityLink } from "@stackshift-ui/system";
8
8
  import { Text } from "@stackshift-ui/text";
9
9
  import { useEffect, useState } from "react";
10
10
  import { HeaderProps } from ".";
11
+ import { LabeledRoute } from "./types";
11
12
 
12
13
  export default function Header_G({
13
14
  mediaItems,
@@ -45,17 +46,8 @@ export default function Header_G({
45
46
  }
46
47
  };
47
48
 
48
- const primaryButtonLink = buildSanityLink({
49
- type: "linkInternal",
50
- internalLink: primaryButton?.link?.target === "_self" ? primaryButton?.link?.route : "",
51
- externalLink: primaryButton?.link?.target != "_self" ? primaryButton?.link?.route : "",
52
- });
53
-
54
- const secondaryButtonLink = buildSanityLink({
55
- type: "linkInternal",
56
- internalLink: secondaryButton?.link?.target === "_self" ? secondaryButton?.link?.route : "",
57
- externalLink: secondaryButton?.link?.target != "_self" ? secondaryButton?.link?.route : "",
58
- });
49
+ const primaryButtonLink = buildSanityLink(primaryButton as LabeledRoute);
50
+ const secondaryButtonLink = buildSanityLink(secondaryButton as LabeledRoute);
59
51
 
60
52
  return (
61
53
  <Section>
@@ -0,0 +1,130 @@
1
+ import { Link } from "@stackshift-ui/link";
2
+ import { ConditionalLinkTypes, Logo } from "../types";
3
+
4
+ export const logoLink = (logo: Logo) => {
5
+ if (logo?.internalLink && logo?.type === "linkInternal") {
6
+ if (logo?.internalLink?.toLowerCase()?.includes("home")) {
7
+ return "/";
8
+ }
9
+ return `/${logo.internalLink}`;
10
+ } else if (logo?.externalLink && logo?.type === "linkExternal") {
11
+ return logo?.externalLink ?? "/";
12
+ } else {
13
+ return "/";
14
+ }
15
+ };
16
+
17
+ export const ConditionalLink = ({
18
+ className,
19
+ ariaLabel,
20
+ style = {},
21
+ children,
22
+ link,
23
+ target,
24
+ }: ConditionalLinkTypes) => {
25
+ const defaultStyle =
26
+ "inline-block py-2 px-6 rounded-l-xl rounded-t-xl bg-primary hover:bg-primary-foreground text-gray-50 font-bold leading-loose outline-none transition duration-200";
27
+
28
+ if (!link?.internalLink && !link?.externalLink) {
29
+ return (
30
+ <a
31
+ className={className ?? defaultStyle}
32
+ aria-label={ariaLabel}
33
+ //style={style}
34
+ target={target}
35
+ href="/page-not-found">
36
+ {children}
37
+ </a>
38
+ );
39
+ } else if (
40
+ (link?.type === "linkInternal" || link.linkType === "linkInternal") &&
41
+ // link?.internalLink?.toLowerCase()?.includes("home")
42
+ link?.internalLink?.toLowerCase() === "home"
43
+ ) {
44
+ return (
45
+ <Link
46
+ href={link?.referenceType === "projects" ? "/projects" : "/"}
47
+ aria-label={ariaLabel}
48
+ className={className ?? defaultStyle}
49
+ //style={style}
50
+ target={target}>
51
+ {children}
52
+ </Link>
53
+ );
54
+ } else if (link?.type === "linkInternal" || link?.linkType === "linkInternal") {
55
+ let hrefPath = "";
56
+
57
+ switch (link?.referenceType) {
58
+ case "projects":
59
+ hrefPath = `/projects/${link?.internalLink}`;
60
+ break;
61
+ case "commercial":
62
+ hrefPath = `/projects/commercial/${link?.internalLink}`;
63
+ break;
64
+ case "residential":
65
+ hrefPath = `/projects/residential/${link?.internalLink}`;
66
+ break;
67
+ case "landscape":
68
+ hrefPath = `/projects/landscape/${link?.internalLink}`;
69
+ break;
70
+ case "public":
71
+ hrefPath = `/projects/public/${link?.internalLink}`;
72
+ break;
73
+ case "teaching":
74
+ hrefPath = `/projects/teaching/${link?.internalLink}`;
75
+ break;
76
+ case "designInMotion":
77
+ hrefPath = `/projects/future-projects/${link?.internalLink}`;
78
+ break;
79
+ case "renovation":
80
+ hrefPath = `/projects/residential/renovation/${link?.internalLink}`;
81
+ break;
82
+ case "newConstruction":
83
+ hrefPath = `/projects/residential/new-construction/${link?.internalLink}`;
84
+ break;
85
+ case "ourTeam":
86
+ hrefPath = `/our-team/${link?.internalLink}`;
87
+ break;
88
+ case "recognition":
89
+ hrefPath = `/recognition/${link?.internalLink}`;
90
+ break;
91
+
92
+ default:
93
+ hrefPath = `/${link?.internalLink}`;
94
+ }
95
+
96
+ return (
97
+ <Link
98
+ href={hrefPath}
99
+ aria-label={ariaLabel}
100
+ className={className ?? defaultStyle}
101
+ //style={style}
102
+ target={target}>
103
+ {children}
104
+ </Link>
105
+ );
106
+ } else if (link?.type === "linkExternal" || link?.linkType === "linkExternal") {
107
+ return (
108
+ <a
109
+ aria-label={ariaLabel}
110
+ className={className ?? defaultStyle}
111
+ //style={style}
112
+ href={link?.externalLink ?? ""}
113
+ target={target}
114
+ rel={link?.linkTarget === "_blank" ? "noopener noreferrer" : undefined}>
115
+ {children}
116
+ </a>
117
+ );
118
+ } else {
119
+ return (
120
+ <Link
121
+ href="/"
122
+ aria-label={ariaLabel}
123
+ className={className ?? defaultStyle}
124
+ //style={style}
125
+ target={target}>
126
+ {children}
127
+ </Link>
128
+ );
129
+ }
130
+ };