@stackshift-ui/text-component 1.0.0 → 6.0.3
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/package.json +11 -10
- package/src/helper/index.tsx +63 -0
- package/src/index.ts +7 -0
- package/src/text-component.test.tsx +64 -0
- package/src/text-component.tsx +34 -0
- package/src/text_a.tsx +34 -0
- package/src/text_b.tsx +43 -0
- package/src/text_c.tsx +57 -0
- package/src/types.ts +422 -0
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackshift-ui/text-component",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "6.0.3",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"module": "./dist/index.mjs",
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
10
|
"files": [
|
|
11
|
-
"dist/**"
|
|
11
|
+
"dist/**",
|
|
12
|
+
"src"
|
|
12
13
|
],
|
|
13
14
|
"author": "WebriQ <info@webriq.com>",
|
|
14
15
|
"devDependencies": {
|
|
@@ -29,18 +30,18 @@
|
|
|
29
30
|
"typescript": "^5.6.2",
|
|
30
31
|
"vite-tsconfig-paths": "^5.0.1",
|
|
31
32
|
"vitest": "^2.1.1",
|
|
32
|
-
"@stackshift-ui/eslint-config": "
|
|
33
|
-
"@stackshift-ui/typescript-config": "
|
|
33
|
+
"@stackshift-ui/eslint-config": "6.0.2",
|
|
34
|
+
"@stackshift-ui/typescript-config": "6.0.2"
|
|
34
35
|
},
|
|
35
36
|
"dependencies": {
|
|
36
37
|
"@portabletext/react": "^3.1.0",
|
|
37
38
|
"@portabletext/types": "^2.0.13",
|
|
38
|
-
"@stackshift-ui/
|
|
39
|
-
"@stackshift-ui/
|
|
40
|
-
"@stackshift-ui/
|
|
41
|
-
"@stackshift-ui/section": "
|
|
42
|
-
"@stackshift-ui/system": "
|
|
43
|
-
"@stackshift-ui/
|
|
39
|
+
"@stackshift-ui/heading": "6.0.3",
|
|
40
|
+
"@stackshift-ui/flex": "6.0.3",
|
|
41
|
+
"@stackshift-ui/scripts": "6.0.2",
|
|
42
|
+
"@stackshift-ui/section": "6.0.3",
|
|
43
|
+
"@stackshift-ui/system": "6.0.3",
|
|
44
|
+
"@stackshift-ui/container": "6.0.3"
|
|
44
45
|
},
|
|
45
46
|
"peerDependencies": {
|
|
46
47
|
"@types/react": "16.8 - 19",
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { MyPortableTextComponents } from "../types";
|
|
2
|
+
|
|
3
|
+
// block styling as props to `components` of the PortableText component
|
|
4
|
+
export const textComponentBlockStyling: MyPortableTextComponents = {
|
|
5
|
+
block: {
|
|
6
|
+
h1: ({ children }) => {
|
|
7
|
+
return <h1 className="mb-6 leading-loose text-gray-900 text-7xl">{children}</h1>;
|
|
8
|
+
},
|
|
9
|
+
h2: ({ children }) => {
|
|
10
|
+
return <h2 className="mb-6 text-5xl leading-loose text-gray-900">{children}</h2>;
|
|
11
|
+
},
|
|
12
|
+
h3: ({ children }) => {
|
|
13
|
+
return <h3 className="mb-6 text-3xl leading-loose text-gray-900">{children}</h3>;
|
|
14
|
+
},
|
|
15
|
+
h4: ({ children }) => {
|
|
16
|
+
return <h4 className="mb-6 text-xl leading-loose text-gray-900">{children}</h4>;
|
|
17
|
+
},
|
|
18
|
+
normal: ({ children }) => {
|
|
19
|
+
return <p className="mb-5 leading-relaxed text-justify text-gray-500">{children}</p>;
|
|
20
|
+
},
|
|
21
|
+
blockquote: ({ children }) => {
|
|
22
|
+
return (
|
|
23
|
+
<blockquote className="mb-6 italic leading-loose text-gray-500 px-14">
|
|
24
|
+
- {children}
|
|
25
|
+
</blockquote>
|
|
26
|
+
);
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
code: ({ value }) => {
|
|
30
|
+
return (
|
|
31
|
+
<pre data-language={value.language}>
|
|
32
|
+
<code>{value.code}</code>
|
|
33
|
+
</pre>
|
|
34
|
+
);
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
list: {
|
|
38
|
+
bullet: ({ children }) => {
|
|
39
|
+
return <ul className="pl-10 mb-6 leading-loose text-gray-900 list-disc">{children}</ul>;
|
|
40
|
+
},
|
|
41
|
+
number: ({ children }) => {
|
|
42
|
+
return <ol className="mb-6 leading-loose text-gray-900 list-decimal">{children}</ol>;
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
listItem: {
|
|
46
|
+
bullet: ({ children }) => <li className="mb-6 leading-loose text-gray-900">{children}</li>,
|
|
47
|
+
},
|
|
48
|
+
marks: {
|
|
49
|
+
strong: ({ children }) => <strong>{children}</strong>,
|
|
50
|
+
em: ({ children }) => <em>{children}</em>,
|
|
51
|
+
code: ({ children }) => <code>{children}</code>,
|
|
52
|
+
link: ({ children, value }) => (
|
|
53
|
+
<a
|
|
54
|
+
aria-label={value.href ?? "external link"}
|
|
55
|
+
className="text-primary-foreground hover:text-secondary-foreground"
|
|
56
|
+
href={value?.href}
|
|
57
|
+
target="_blank"
|
|
58
|
+
rel="noopener noreferrer">
|
|
59
|
+
{children}
|
|
60
|
+
</a>
|
|
61
|
+
),
|
|
62
|
+
},
|
|
63
|
+
};
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
2
|
+
import { cleanup, render, screen, waitFor } from "@testing-library/react";
|
|
3
|
+
import { afterEach, describe, test } from "vitest";
|
|
4
|
+
import { TextComponent } from "./text-component";
|
|
5
|
+
|
|
6
|
+
const variants = {
|
|
7
|
+
title: "Trusted by brands all over the world",
|
|
8
|
+
firstColumn: [
|
|
9
|
+
{
|
|
10
|
+
_key: "unique-key",
|
|
11
|
+
style: "normal",
|
|
12
|
+
_type: "block",
|
|
13
|
+
markDefs: [],
|
|
14
|
+
children: [
|
|
15
|
+
{
|
|
16
|
+
_type: "span",
|
|
17
|
+
text: "Etiam facilisis mauris leo, eu aliquet est iaculis eu. Mauris vitae pellentesque augue, quis efficitur elit. Suspendisse potenti. Vivamus et sem eget ligula bibendum pulvinar. Nullam libero velit, efficitur ut dui eget, tempus ultricies felis. Pellentesque ut lorem id velit aliquam pharetra id placerat purus. Aliquam erat mauris, cursus eget cursus in, rutrum et nisi. Phasellus consequat vehicula metus non sagittis. Sed quis ipsum non velit tempus consequat sit amet eget augue. Donec feugiat ultricies ultrices",
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
describe("text-component", () => {
|
|
25
|
+
afterEach(cleanup);
|
|
26
|
+
|
|
27
|
+
test("variant_a: renders without errors", async ({ expect }) => {
|
|
28
|
+
// @todo: We should consider adding this static data into its own repository so we can reuse it across different projects
|
|
29
|
+
render(
|
|
30
|
+
<TextComponent
|
|
31
|
+
data={{
|
|
32
|
+
variant: "variant_a",
|
|
33
|
+
variants,
|
|
34
|
+
}}
|
|
35
|
+
/>,
|
|
36
|
+
);
|
|
37
|
+
await waitFor(() => screen.findByText("Trusted by brands all over the world"));
|
|
38
|
+
screen.debug();
|
|
39
|
+
|
|
40
|
+
expect(screen.getByText("Trusted by brands all over the world")).toBeInTheDocument();
|
|
41
|
+
expect(
|
|
42
|
+
screen.getByText(/Etiam facilisis mauris leo, eu aliquet est iaculis eu/),
|
|
43
|
+
).toBeInTheDocument();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test("variant_b: renders without errors", async ({ expect }) => {
|
|
47
|
+
// @todo: We should consider adding this static data into its own repository so we can reuse it across different projects
|
|
48
|
+
render(
|
|
49
|
+
<TextComponent
|
|
50
|
+
data={{
|
|
51
|
+
variant: "variant_b",
|
|
52
|
+
variants,
|
|
53
|
+
}}
|
|
54
|
+
/>,
|
|
55
|
+
);
|
|
56
|
+
await waitFor(() => screen.findByText("Trusted by brands all over the world"));
|
|
57
|
+
screen.debug();
|
|
58
|
+
|
|
59
|
+
expect(screen.getByText("Trusted by brands all over the world")).toBeInTheDocument();
|
|
60
|
+
expect(
|
|
61
|
+
screen.getByText(/Etiam facilisis mauris leo, eu aliquet est iaculis eu/),
|
|
62
|
+
).toBeInTheDocument();
|
|
63
|
+
});
|
|
64
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { PortableTextBlock } from "@portabletext/types";
|
|
2
|
+
import { lazy } from "react";
|
|
3
|
+
import { SectionsProps } from "./types";
|
|
4
|
+
|
|
5
|
+
const Variants = {
|
|
6
|
+
variant_a: lazy(() => import("./text_a")),
|
|
7
|
+
variant_b: lazy(() => import("./text_b")),
|
|
8
|
+
variant_c: lazy(() => import("./text_c")),
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export interface TextComponentProps {
|
|
12
|
+
heading?: string;
|
|
13
|
+
firstColumn?: PortableTextBlock[];
|
|
14
|
+
secondColumn?: PortableTextBlock[];
|
|
15
|
+
thirdColumn?: PortableTextBlock[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const displayName = "TextComponent";
|
|
19
|
+
|
|
20
|
+
export const TextComponent: React.FC<SectionsProps> = ({ data }) => {
|
|
21
|
+
const variant = data?.variant;
|
|
22
|
+
const Variant = variant && Variants[variant as keyof typeof Variants];
|
|
23
|
+
|
|
24
|
+
const props = {
|
|
25
|
+
heading: data?.variants?.title ?? undefined,
|
|
26
|
+
firstColumn: data?.variants?.firstColumn ?? undefined,
|
|
27
|
+
secondColumn: data?.variants?.secondColumn ?? undefined,
|
|
28
|
+
thirdColumn: data?.variants?.thirdColumn ?? undefined,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return Variant ? <Variant {...props} /> : null;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
TextComponent.displayName = displayName;
|
package/src/text_a.tsx
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { PortableText } from "@portabletext/react";
|
|
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 { TextComponentProps } from ".";
|
|
7
|
+
import { textComponentBlockStyling } from "./helper";
|
|
8
|
+
|
|
9
|
+
export default function TextComponent_A({ heading, firstColumn }: TextComponentProps) {
|
|
10
|
+
return (
|
|
11
|
+
<Section className="py-20 bg-background">
|
|
12
|
+
<Container maxWidth={1280}>
|
|
13
|
+
{heading && (
|
|
14
|
+
<Heading fontSize="xl" className="mb-5 text-center">
|
|
15
|
+
{heading}
|
|
16
|
+
</Heading>
|
|
17
|
+
)}
|
|
18
|
+
<Flex wrap justify="center" className="mx-auto">
|
|
19
|
+
{firstColumn && (
|
|
20
|
+
<div className="mb-2 text-xs md:mb-0 md:w-1/2 lg:text-base">
|
|
21
|
+
<PortableText
|
|
22
|
+
value={firstColumn}
|
|
23
|
+
components={textComponentBlockStyling}
|
|
24
|
+
onMissingComponent={false} // Disabling warnings / handling unknown types
|
|
25
|
+
/>
|
|
26
|
+
</div>
|
|
27
|
+
)}
|
|
28
|
+
</Flex>
|
|
29
|
+
</Container>
|
|
30
|
+
</Section>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { TextComponent_A };
|
package/src/text_b.tsx
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { PortableText } from "@portabletext/react";
|
|
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 { TextComponentProps } from ".";
|
|
7
|
+
import { textComponentBlockStyling } from "./helper";
|
|
8
|
+
|
|
9
|
+
export default function TextComponent_B({
|
|
10
|
+
heading,
|
|
11
|
+
firstColumn,
|
|
12
|
+
secondColumn,
|
|
13
|
+
}: TextComponentProps) {
|
|
14
|
+
return (
|
|
15
|
+
<Section className="py-20 bg-background">
|
|
16
|
+
<Container maxWidth={1280}>
|
|
17
|
+
{heading && (
|
|
18
|
+
<Heading fontSize="xl" className="w-full mb-4 text-center">
|
|
19
|
+
{heading}
|
|
20
|
+
</Heading>
|
|
21
|
+
)}
|
|
22
|
+
<Flex wrap justify="center" className="mx-auto ">
|
|
23
|
+
{firstColumn && (
|
|
24
|
+
<div className="px-5 mb-3 text-xs leading-relaxed text-justify text-gray-500 lg:mb-6 lg:w-1/4 lg:text-base">
|
|
25
|
+
<PortableText value={firstColumn} components={textComponentBlockStyling} />
|
|
26
|
+
</div>
|
|
27
|
+
)}
|
|
28
|
+
{secondColumn && (
|
|
29
|
+
<div className="px-5 mb-6 text-xs leading-relaxed text-justify text-gray-500 md:mb-0 lg:w-1/4 lg:text-base">
|
|
30
|
+
<PortableText
|
|
31
|
+
value={secondColumn}
|
|
32
|
+
components={textComponentBlockStyling}
|
|
33
|
+
onMissingComponent={false} // Disabling warnings / handling unknown types
|
|
34
|
+
/>
|
|
35
|
+
</div>
|
|
36
|
+
)}
|
|
37
|
+
</Flex>
|
|
38
|
+
</Container>
|
|
39
|
+
</Section>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { TextComponent_B };
|
package/src/text_c.tsx
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { PortableText } from "@portabletext/react";
|
|
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 { TextComponentProps } from ".";
|
|
7
|
+
import { textComponentBlockStyling } from "./helper";
|
|
8
|
+
|
|
9
|
+
export default function TextComponent_C({
|
|
10
|
+
heading,
|
|
11
|
+
firstColumn,
|
|
12
|
+
secondColumn,
|
|
13
|
+
thirdColumn,
|
|
14
|
+
}: TextComponentProps) {
|
|
15
|
+
return (
|
|
16
|
+
<Section className="py-20 bg-background">
|
|
17
|
+
<Container className="container px-4 mx-auto" maxWidth={1280}>
|
|
18
|
+
{heading && (
|
|
19
|
+
<Heading fontSize="xl" className="w-full mb-5 text-center">
|
|
20
|
+
{heading}
|
|
21
|
+
</Heading>
|
|
22
|
+
)}
|
|
23
|
+
<Flex wrap justify="center" className="mx-auto">
|
|
24
|
+
{firstColumn && (
|
|
25
|
+
<div className="px-3 mb-6 text-xs leading-relaxed text-justify text-gray-500 md:mb-0 lg:w-1/4 lg:text-base">
|
|
26
|
+
<PortableText
|
|
27
|
+
value={firstColumn}
|
|
28
|
+
components={textComponentBlockStyling}
|
|
29
|
+
onMissingComponent={false} // Disabling warnings / handling unknown types
|
|
30
|
+
/>
|
|
31
|
+
</div>
|
|
32
|
+
)}
|
|
33
|
+
{secondColumn && (
|
|
34
|
+
<div className="px-3 mb-6 text-xs leading-relaxed text-justify text-gray-500 md:mb-0 lg:w-1/4 lg:text-base">
|
|
35
|
+
<PortableText
|
|
36
|
+
value={secondColumn}
|
|
37
|
+
components={textComponentBlockStyling}
|
|
38
|
+
onMissingComponent={false} // Disabling warnings / handling unknown types
|
|
39
|
+
/>
|
|
40
|
+
</div>
|
|
41
|
+
)}
|
|
42
|
+
{thirdColumn && (
|
|
43
|
+
<div className="px-3 mb-6 text-xs leading-relaxed text-justify text-gray-500 md:mb-0 lg:w-1/4 lg:text-base">
|
|
44
|
+
<PortableText
|
|
45
|
+
value={thirdColumn}
|
|
46
|
+
components={textComponentBlockStyling}
|
|
47
|
+
onMissingComponent={false} // Disabling warnings / handling unknown types
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
50
|
+
)}
|
|
51
|
+
</Flex>
|
|
52
|
+
</Container>
|
|
53
|
+
</Section>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { TextComponent_C };
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
import { PortableTextComponents } from "@portabletext/react";
|
|
2
|
+
import { PortableTextBlock } from "@portabletext/types";
|
|
3
|
+
|
|
4
|
+
export type StyleVariants<T extends string> = Record<T, string>;
|
|
5
|
+
|
|
6
|
+
export type Socials = "facebook" | "instagram" | "youtube" | "linkedin" | "twitter";
|
|
7
|
+
export interface MainImage {
|
|
8
|
+
image: string;
|
|
9
|
+
alt?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface LabeledRoute extends ConditionalLink {
|
|
13
|
+
ariaLabel?: string;
|
|
14
|
+
label?: string;
|
|
15
|
+
linkTarget?: string;
|
|
16
|
+
linkType?: string;
|
|
17
|
+
_type?: string;
|
|
18
|
+
linkInternal?: any;
|
|
19
|
+
}
|
|
20
|
+
export interface ConditionalLink {
|
|
21
|
+
type?: string;
|
|
22
|
+
internalLink?: string | null;
|
|
23
|
+
externalLink?: string | null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface StatItems {
|
|
27
|
+
label?: string;
|
|
28
|
+
mainImage?: MainImage;
|
|
29
|
+
value?: string;
|
|
30
|
+
_key?: string;
|
|
31
|
+
_type?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface Logo extends ConditionalLink {
|
|
35
|
+
alt?: string;
|
|
36
|
+
linkTarget?: string;
|
|
37
|
+
image?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface Images {
|
|
41
|
+
image?: string;
|
|
42
|
+
_key?: string;
|
|
43
|
+
_type?: string;
|
|
44
|
+
alt?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface ContactDetails {
|
|
48
|
+
addressInfo?: string;
|
|
49
|
+
contactInfo?: string;
|
|
50
|
+
emailInfo?: string;
|
|
51
|
+
_key?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface SocialLink {
|
|
55
|
+
socialMedia?: string | null;
|
|
56
|
+
socialMediaLink?: string | null;
|
|
57
|
+
_key?: string | null;
|
|
58
|
+
_type?: string | null;
|
|
59
|
+
socialMediaIcon?: {
|
|
60
|
+
alt?: string;
|
|
61
|
+
image?: string;
|
|
62
|
+
} | null;
|
|
63
|
+
socialMediaPlatform?: string | null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface LabeledRouteWithKey extends LabeledRoute {
|
|
67
|
+
_key?: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface ArrayOfImageTitleAndText {
|
|
71
|
+
mainImage?: {
|
|
72
|
+
alt?: string;
|
|
73
|
+
image?: string;
|
|
74
|
+
};
|
|
75
|
+
plainText?: string;
|
|
76
|
+
title?: string;
|
|
77
|
+
_key?: string;
|
|
78
|
+
_type?: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface FeaturedItem {
|
|
82
|
+
description?: string;
|
|
83
|
+
mainImage?: MainImage;
|
|
84
|
+
title?: string;
|
|
85
|
+
subtitle?: string;
|
|
86
|
+
_key?: string;
|
|
87
|
+
_type?: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface ArrayOfTitleAndText {
|
|
91
|
+
_key?: string;
|
|
92
|
+
plainText?: string;
|
|
93
|
+
title?: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface BlogPost extends SanityBody {
|
|
97
|
+
authors?: Author[] | null;
|
|
98
|
+
body?: any;
|
|
99
|
+
categories?: Category[] | null;
|
|
100
|
+
excerpt?: string | null;
|
|
101
|
+
link?: string | null;
|
|
102
|
+
mainImage?: string | null;
|
|
103
|
+
publishedAt?: string;
|
|
104
|
+
seo?: Seo | null;
|
|
105
|
+
slug?: SanitySlug | null;
|
|
106
|
+
title?: string;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface Seo {
|
|
110
|
+
_type?: string;
|
|
111
|
+
seoTitle?: string;
|
|
112
|
+
seoDescription?: string;
|
|
113
|
+
seoImage?: string;
|
|
114
|
+
seoKeywords?: string;
|
|
115
|
+
seoSynonyms?: string;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface SanitySlug {
|
|
119
|
+
current?: string;
|
|
120
|
+
_type?: "slug";
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface SanityBody {
|
|
124
|
+
_createdAt?: string;
|
|
125
|
+
_id?: string;
|
|
126
|
+
_rev?: string;
|
|
127
|
+
_type?: string;
|
|
128
|
+
_updatedAt?: string;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export interface Author extends SanityBody {
|
|
132
|
+
link?: string | null;
|
|
133
|
+
bio?: string | null;
|
|
134
|
+
name?: string | null;
|
|
135
|
+
slug?: SanitySlug | null;
|
|
136
|
+
image?: string | null;
|
|
137
|
+
profile?: {
|
|
138
|
+
alt: string;
|
|
139
|
+
image: string;
|
|
140
|
+
} | null;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export interface Category extends SanityBody {
|
|
144
|
+
title?: string;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export interface Form {
|
|
148
|
+
id?: string | null;
|
|
149
|
+
buttonLabel?: string | null;
|
|
150
|
+
name?: string | null;
|
|
151
|
+
subtitle?: string | null;
|
|
152
|
+
fields?: FormFields[] | null;
|
|
153
|
+
thankYouPage?: ThankYouPage | null;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export interface FormFields {
|
|
157
|
+
name?: string;
|
|
158
|
+
placeholder?: string;
|
|
159
|
+
pricingType?: string;
|
|
160
|
+
type?: FormTypes;
|
|
161
|
+
_key?: string;
|
|
162
|
+
_type?: string;
|
|
163
|
+
isRequired?: boolean;
|
|
164
|
+
label?: string;
|
|
165
|
+
items?: string[];
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export type FormTypes =
|
|
169
|
+
| "inputText"
|
|
170
|
+
| "inputEmail"
|
|
171
|
+
| "inputPassword"
|
|
172
|
+
| "inputNumber"
|
|
173
|
+
| "textarea"
|
|
174
|
+
| "inputFile"
|
|
175
|
+
| "inputRadio"
|
|
176
|
+
| "inputCheckbox"
|
|
177
|
+
| "inputSelect";
|
|
178
|
+
|
|
179
|
+
export interface ThankYouPage {
|
|
180
|
+
externalLink?: string | null;
|
|
181
|
+
internalLink?: string | null;
|
|
182
|
+
linkInternal?: any;
|
|
183
|
+
linkTarget?: string;
|
|
184
|
+
linkType?: string;
|
|
185
|
+
type?: string;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
//Used on different sections
|
|
189
|
+
export interface SectionsProps {
|
|
190
|
+
template?: Template;
|
|
191
|
+
data?: Sections;
|
|
192
|
+
variant?: string | null | undefined;
|
|
193
|
+
schema?: Variants;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export interface Sections extends SanityBody {
|
|
197
|
+
label?: string;
|
|
198
|
+
variant?: string;
|
|
199
|
+
variants?: Variants;
|
|
200
|
+
_key?: string;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
//*EDIT THIS SECTION WHEN CREATING/UPDATING SCHEMAS ON STUDIO */
|
|
204
|
+
export interface Variants {
|
|
205
|
+
template?: Template;
|
|
206
|
+
multipleMenus?: any;
|
|
207
|
+
arrayOfTitleAndText?: ArrayOfTitleAndText[] | null;
|
|
208
|
+
logo?: Logo | null;
|
|
209
|
+
primaryButton?: LabeledRoute | null;
|
|
210
|
+
secondaryButton?: LabeledRoute | null;
|
|
211
|
+
routes?: LabeledRouteWithKey[] | null;
|
|
212
|
+
menu?: LabeledRouteWithKey[] | null;
|
|
213
|
+
plans?: Plans[] | null;
|
|
214
|
+
formLinks?: LabeledRouteWithKey[] | null;
|
|
215
|
+
portfolios?: Portfolios[] | null;
|
|
216
|
+
portfoliosWithCategories?: PortfoliosWithCategories[] | null;
|
|
217
|
+
length?: number;
|
|
218
|
+
signInLink?: LabeledRoute | null;
|
|
219
|
+
signinLink?: LabeledRoute | null;
|
|
220
|
+
tags?: string[] | null;
|
|
221
|
+
posts?: BlogPost[] | null;
|
|
222
|
+
blogsPerPage?: number | null;
|
|
223
|
+
form?: Form | null;
|
|
224
|
+
collections?: Collection | null;
|
|
225
|
+
products?: CollectionProduct | null;
|
|
226
|
+
allProducts?: Collection[];
|
|
227
|
+
subtitle?: string | null;
|
|
228
|
+
caption?: string | null;
|
|
229
|
+
title?: string | null;
|
|
230
|
+
plainText?: string | null;
|
|
231
|
+
contactDescription?: string | null;
|
|
232
|
+
officeInformation?: string | null;
|
|
233
|
+
contactEmail?: string | null;
|
|
234
|
+
contactNumber?: string | null;
|
|
235
|
+
socialLinks?: SocialLink[] | null;
|
|
236
|
+
block?: any;
|
|
237
|
+
heading?: string | null;
|
|
238
|
+
acceptButtonLabel?: string | null;
|
|
239
|
+
declineButtonLabel?: string | null;
|
|
240
|
+
faqsWithCategories?: FaqsWithCategory[] | null;
|
|
241
|
+
faqs?: AskedQuestion[] | null;
|
|
242
|
+
arrayOfImageTitleAndText?: ArrayOfImageTitleAndText[] | null;
|
|
243
|
+
description?: string | null;
|
|
244
|
+
featuredItems?: FeaturedItem[] | null;
|
|
245
|
+
images?: Images[] | null;
|
|
246
|
+
contactDetails?: ContactDetails[] | null;
|
|
247
|
+
copyright?: string | null;
|
|
248
|
+
mainImage?: MainImage | null;
|
|
249
|
+
youtubeLink?: string | null;
|
|
250
|
+
banner?: any;
|
|
251
|
+
stats?: StatItems[] | null;
|
|
252
|
+
teams?: Team[] | null;
|
|
253
|
+
testimonials?: Testimonial[] | null;
|
|
254
|
+
firstColumn?: PortableTextBlock[];
|
|
255
|
+
secondColumn?: PortableTextBlock[];
|
|
256
|
+
thirdColumn?: PortableTextBlock[];
|
|
257
|
+
selectStripeAccount?: string;
|
|
258
|
+
annualBilling?: string;
|
|
259
|
+
monthlyBilling?: string;
|
|
260
|
+
productDetails?: ProductDetail[];
|
|
261
|
+
btnLabel?: string;
|
|
262
|
+
selectAccount?: string;
|
|
263
|
+
hashtags?: string[];
|
|
264
|
+
numberOfPosts?: number;
|
|
265
|
+
text?: string;
|
|
266
|
+
button?: LabeledRoute;
|
|
267
|
+
features?: string[];
|
|
268
|
+
config?: {
|
|
269
|
+
enableAnalytics: boolean;
|
|
270
|
+
cookiePolicy?: {
|
|
271
|
+
siteName: string;
|
|
272
|
+
cookiePolicyPage: Reference;
|
|
273
|
+
};
|
|
274
|
+
consentModalPosition?: string;
|
|
275
|
+
};
|
|
276
|
+
contactLink?: LabeledRoute;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export interface Template {
|
|
280
|
+
bg?: string;
|
|
281
|
+
color?: string;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export type Plans = {
|
|
285
|
+
_key?: string | null;
|
|
286
|
+
_type?: "planItems" | null;
|
|
287
|
+
checkoutButtonName?: string | null;
|
|
288
|
+
description?: string | null;
|
|
289
|
+
monthlyPrice?: string | null;
|
|
290
|
+
planType?: string | null;
|
|
291
|
+
yearlyPrice?: string | null;
|
|
292
|
+
planIncludes?: string[] | null;
|
|
293
|
+
primaryButton?: LabeledRoute | null;
|
|
294
|
+
} & Record<string, string>;
|
|
295
|
+
|
|
296
|
+
export interface Portfolios {
|
|
297
|
+
dateAdded?: string | null;
|
|
298
|
+
mainImage?: {
|
|
299
|
+
image?: string | null;
|
|
300
|
+
alt?: string | null;
|
|
301
|
+
} | null;
|
|
302
|
+
primaryButton?: LabeledRoute | null;
|
|
303
|
+
title?: string | null;
|
|
304
|
+
_key?: string | null;
|
|
305
|
+
_type?: string | null;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export interface PortfoliosWithCategories {
|
|
309
|
+
category?: string | null;
|
|
310
|
+
content?: Content[] | null;
|
|
311
|
+
primaryButton?: LabeledRoute | null;
|
|
312
|
+
_key?: string | null;
|
|
313
|
+
_type?: string | null;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
export interface Content extends Portfolios {
|
|
317
|
+
description?: string | null;
|
|
318
|
+
subtitle?: string | null;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export interface Collection extends SanityBody {
|
|
322
|
+
collectionInfoVariant?: {
|
|
323
|
+
variant?: string;
|
|
324
|
+
} | null;
|
|
325
|
+
name?: string | null;
|
|
326
|
+
products?: CollectionProduct[] | null;
|
|
327
|
+
sections?: any; //todo
|
|
328
|
+
seo?: Seo | null;
|
|
329
|
+
slug?: SanitySlug | null;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
export interface CollectionProduct extends SanityBody {
|
|
333
|
+
compareToPrice?: number | null;
|
|
334
|
+
description?: string | null;
|
|
335
|
+
ecwidProductId?: number | null;
|
|
336
|
+
name?: string | null;
|
|
337
|
+
price?: number | null;
|
|
338
|
+
productInfo?: ProductInfo | null;
|
|
339
|
+
productInfoVariant?: {
|
|
340
|
+
variant?: string;
|
|
341
|
+
} | null;
|
|
342
|
+
sections?: any; //todo
|
|
343
|
+
seo?: Seo | null;
|
|
344
|
+
slug?: SanitySlug | null;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
//TODO, RECHECK PRODUCT INFO DATA FROM SANITY
|
|
348
|
+
interface ProductInfo {
|
|
349
|
+
btnLabel?: string | null;
|
|
350
|
+
images?: ProductInfoImage[] | null;
|
|
351
|
+
productDetails?: ProductDetail[] | null;
|
|
352
|
+
socialLinks?: SocialLink[] | null;
|
|
353
|
+
subtitle?: string | null;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
//TODO, RECHECK PRODUCT INFO DATA FROM SANITY
|
|
357
|
+
export interface ProductDetail {
|
|
358
|
+
blockContent?: any;
|
|
359
|
+
contentType?: string;
|
|
360
|
+
tabName?: string;
|
|
361
|
+
_key?: string;
|
|
362
|
+
[key: string]: any;
|
|
363
|
+
}
|
|
364
|
+
interface ProductInfoImage {
|
|
365
|
+
alt?: string | null;
|
|
366
|
+
_key: string;
|
|
367
|
+
_type: string;
|
|
368
|
+
image?: string | null;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
export interface FaqsWithCategory {
|
|
372
|
+
askedQuestions?: AskedQuestion[] | null;
|
|
373
|
+
category?: string | null;
|
|
374
|
+
_key?: string;
|
|
375
|
+
_type?: string;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
export interface AskedQuestion {
|
|
379
|
+
answer?: string | null;
|
|
380
|
+
question?: string | null;
|
|
381
|
+
hidden?: boolean;
|
|
382
|
+
_key?: string;
|
|
383
|
+
_type?: string;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
export interface Team {
|
|
387
|
+
jobTitle?: string;
|
|
388
|
+
mainImage?: MainImage;
|
|
389
|
+
name?: string;
|
|
390
|
+
plainText?: string;
|
|
391
|
+
_key?: string;
|
|
392
|
+
_type?: string;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
export interface Testimonial {
|
|
396
|
+
jobTitle?: string;
|
|
397
|
+
mainImage?: MainImage;
|
|
398
|
+
name?: string;
|
|
399
|
+
rating?: string;
|
|
400
|
+
testimony?: string;
|
|
401
|
+
_key?: string;
|
|
402
|
+
_type?: string;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
export declare interface Reference {
|
|
406
|
+
_type: string;
|
|
407
|
+
_ref: string;
|
|
408
|
+
_key?: string;
|
|
409
|
+
_weak?: boolean;
|
|
410
|
+
_strengthenOnPublish?: {
|
|
411
|
+
type: string;
|
|
412
|
+
weak?: boolean;
|
|
413
|
+
template?: {
|
|
414
|
+
id: string;
|
|
415
|
+
params: Record<string, string | number | boolean>;
|
|
416
|
+
};
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
export type MyPortableTextComponents = PortableTextComponents & {
|
|
421
|
+
code?: ({ value }: { value: { language?: string; code?: string } }) => JSX.Element;
|
|
422
|
+
};
|