foundry-component-library 0.1.13 → 0.2.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.
- package/lib/components/OfficesTeaser/index.tsx +1 -1
- package/lib/components/case/Content/Numbers/styles.module.scss +1 -1
- package/lib/components/case/Content/ThreeColumns/Center.tsx +49 -0
- package/lib/components/case/Content/ThreeColumns/Left.tsx +48 -0
- package/lib/components/case/Content/ThreeColumns/Right.tsx +49 -0
- package/lib/components/case/Content/ThreeColumns/index.tsx +38 -0
- package/lib/components/case/Content/Video.tsx +8 -2
- package/lib/components/case/Content/index.tsx +10 -0
- package/lib/components/case/Content/styles.module.scss +9 -1
- package/lib/components/cases/Items/index.tsx +6 -1
- package/lib/components/single/Content/styles.module.scss +0 -1
- package/lib/queries/client.ts +15 -1
- package/lib/queries/getCaseById.ts +284 -0
- package/lib/queries/getCaseBySlug.ts +85 -0
- package/lib/queries/getCasesPage.ts +4 -0
- package/lib/queries/getHubBySlug.ts +1 -1
- package/lib/queries/index.ts +2 -0
- package/lib/types/index.ts +35 -3
- package/package.json +1 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import styles from "../styles.module.scss";
|
|
2
|
+
import Video from "../Video";
|
|
3
|
+
import { ColumnOption, NextImage } from "../../../../types";
|
|
4
|
+
|
|
5
|
+
const Center = ({
|
|
6
|
+
section,
|
|
7
|
+
Image,
|
|
8
|
+
}: {
|
|
9
|
+
section: ColumnOption;
|
|
10
|
+
Image: NextImage;
|
|
11
|
+
}) => {
|
|
12
|
+
if (!section) return null;
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div className={styles.columnContent}>
|
|
16
|
+
{/* case */}
|
|
17
|
+
{section.fieldGroupName ===
|
|
18
|
+
"Case_Case_Content_Threecolumns_Center_Text" && (
|
|
19
|
+
<div
|
|
20
|
+
className={styles.text}
|
|
21
|
+
dangerouslySetInnerHTML={{ __html: section.text }}
|
|
22
|
+
/>
|
|
23
|
+
)}
|
|
24
|
+
{section.fieldGroupName ===
|
|
25
|
+
"Case_Case_Content_Threecolumns_Center_Image" &&
|
|
26
|
+
section.image && (
|
|
27
|
+
<>
|
|
28
|
+
<Image
|
|
29
|
+
className={styles.image}
|
|
30
|
+
src={section.image.sourceUrl}
|
|
31
|
+
alt={section.caption ? section.caption : "foundry digital agency"}
|
|
32
|
+
layout="intrinsic"
|
|
33
|
+
width={600}
|
|
34
|
+
height={600}
|
|
35
|
+
/>
|
|
36
|
+
{section.caption && (
|
|
37
|
+
<div className={styles.caption}>{section.caption}</div>
|
|
38
|
+
)}
|
|
39
|
+
</>
|
|
40
|
+
)}
|
|
41
|
+
{section.fieldGroupName ===
|
|
42
|
+
"Case_Case_Content_Threecolumns_Center_Video" && (
|
|
43
|
+
<Video section={section} defaultRatio="150%" />
|
|
44
|
+
)}
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default Center;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import styles from "../styles.module.scss";
|
|
2
|
+
import Video from "../Video";
|
|
3
|
+
import { ColumnOption, NextImage } from "../../../../types";
|
|
4
|
+
|
|
5
|
+
const Left = ({
|
|
6
|
+
section,
|
|
7
|
+
Image,
|
|
8
|
+
}: {
|
|
9
|
+
section: ColumnOption;
|
|
10
|
+
Image: NextImage;
|
|
11
|
+
}) => {
|
|
12
|
+
if (!section) return null;
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div className={styles.columnContent}>
|
|
16
|
+
{/* case */}
|
|
17
|
+
{section.fieldGroupName ===
|
|
18
|
+
"Case_Case_Content_Threecolumns_Left_Text" && (
|
|
19
|
+
<div
|
|
20
|
+
className={styles.text}
|
|
21
|
+
dangerouslySetInnerHTML={{ __html: section.text }}
|
|
22
|
+
/>
|
|
23
|
+
)}
|
|
24
|
+
{section.fieldGroupName === "Case_Case_Content_Threecolumns_Left_Image" &&
|
|
25
|
+
section.image && (
|
|
26
|
+
<>
|
|
27
|
+
<Image
|
|
28
|
+
className={styles.image}
|
|
29
|
+
src={section.image.sourceUrl}
|
|
30
|
+
alt={section.caption ? section.caption : "foundry digital agency"}
|
|
31
|
+
layout="intrinsic"
|
|
32
|
+
width={600}
|
|
33
|
+
height={600}
|
|
34
|
+
/>
|
|
35
|
+
{section.caption && (
|
|
36
|
+
<div className={styles.caption}>{section.caption}</div>
|
|
37
|
+
)}
|
|
38
|
+
</>
|
|
39
|
+
)}
|
|
40
|
+
{section.fieldGroupName ===
|
|
41
|
+
"Case_Case_Content_Threecolumns_Left_Video" && (
|
|
42
|
+
<Video section={section} defaultRatio="150%" />
|
|
43
|
+
)}
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default Left;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import styles from "../styles.module.scss";
|
|
2
|
+
import Video from "../Video";
|
|
3
|
+
import { ColumnOption, NextImage } from "../../../../types";
|
|
4
|
+
|
|
5
|
+
const Right = ({
|
|
6
|
+
section,
|
|
7
|
+
Image,
|
|
8
|
+
}: {
|
|
9
|
+
section: ColumnOption;
|
|
10
|
+
Image: NextImage;
|
|
11
|
+
}) => {
|
|
12
|
+
if (!section) return null;
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div className={styles.columnContent}>
|
|
16
|
+
{/* case */}
|
|
17
|
+
{section.fieldGroupName ===
|
|
18
|
+
"Case_Case_Content_Threecolumns_Right_Text" && (
|
|
19
|
+
<div
|
|
20
|
+
className={`${styles.text}`}
|
|
21
|
+
dangerouslySetInnerHTML={{ __html: section.text }}
|
|
22
|
+
/>
|
|
23
|
+
)}
|
|
24
|
+
{section.fieldGroupName ===
|
|
25
|
+
"Case_Case_Content_Threecolumns_Right_Image" &&
|
|
26
|
+
section.image && (
|
|
27
|
+
<>
|
|
28
|
+
<Image
|
|
29
|
+
className={styles.image}
|
|
30
|
+
src={section.image.sourceUrl}
|
|
31
|
+
alt={section.caption ? section.caption : "foundry digital agency"}
|
|
32
|
+
layout="intrinsic"
|
|
33
|
+
width={600}
|
|
34
|
+
height={600}
|
|
35
|
+
/>
|
|
36
|
+
{section.caption && (
|
|
37
|
+
<div className={styles.caption}>{section.caption}</div>
|
|
38
|
+
)}
|
|
39
|
+
</>
|
|
40
|
+
)}
|
|
41
|
+
{section.fieldGroupName ===
|
|
42
|
+
"Case_Case_Content_Threecolumns_Right_Video" && (
|
|
43
|
+
<Video section={section} defaultRatio="150%" />
|
|
44
|
+
)}
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default Right;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import styles from "../styles.module.scss";
|
|
2
|
+
import Container from "../../../Container";
|
|
3
|
+
import { type ThreeColumns, NextImage } from "../../../../types";
|
|
4
|
+
import Left from "./Left";
|
|
5
|
+
import Center from "./Center";
|
|
6
|
+
import Right from "./Right";
|
|
7
|
+
|
|
8
|
+
function ThreeColumns({
|
|
9
|
+
section,
|
|
10
|
+
Image,
|
|
11
|
+
}: {
|
|
12
|
+
section: ThreeColumns;
|
|
13
|
+
Image: NextImage;
|
|
14
|
+
}) {
|
|
15
|
+
return (
|
|
16
|
+
<section className={styles.section}>
|
|
17
|
+
<Container>
|
|
18
|
+
<div className={styles.threeColumns}>
|
|
19
|
+
<div className={styles.column}>
|
|
20
|
+
{section.left && <Left section={section.left[0]} Image={Image} />}
|
|
21
|
+
</div>
|
|
22
|
+
<div className={styles.column}>
|
|
23
|
+
{section.center && (
|
|
24
|
+
<Center section={section.center[0]} Image={Image} />
|
|
25
|
+
)}
|
|
26
|
+
</div>
|
|
27
|
+
<div className={styles.column}>
|
|
28
|
+
{section.right && (
|
|
29
|
+
<Right section={section.right[0]} Image={Image} />
|
|
30
|
+
)}
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</Container>
|
|
34
|
+
</section>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default ThreeColumns;
|
|
@@ -5,7 +5,13 @@ import styles from "./styles.module.scss";
|
|
|
5
5
|
import { useOnScreen } from "../../../hooks/useOnScreen";
|
|
6
6
|
import { type Video } from "../../../types";
|
|
7
7
|
|
|
8
|
-
function Video({
|
|
8
|
+
function Video({
|
|
9
|
+
section,
|
|
10
|
+
defaultRatio = "56.25%",
|
|
11
|
+
}: {
|
|
12
|
+
section: Video;
|
|
13
|
+
defaultRatio?: string;
|
|
14
|
+
}) {
|
|
9
15
|
const sectionRef = useRef(null);
|
|
10
16
|
const onScreen = useOnScreen(sectionRef, "1000px");
|
|
11
17
|
const [playing, setPlaying] = useState(false);
|
|
@@ -50,7 +56,7 @@ function Video({ section }: { section: Video }) {
|
|
|
50
56
|
backgroundImage: section.poster
|
|
51
57
|
? `url(${section.poster.sourceUrl})`
|
|
52
58
|
: "none",
|
|
53
|
-
paddingTop: section.ratio ? section.ratio :
|
|
59
|
+
paddingTop: section.ratio ? section.ratio : defaultRatio,
|
|
54
60
|
}}
|
|
55
61
|
>
|
|
56
62
|
<div>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import FullWidthImage from "./FullWidthImage";
|
|
2
2
|
import CenterColumn from "./CenterColumn";
|
|
3
3
|
import TwoColumns from "./TwoColumns";
|
|
4
|
+
import ThreeColumns from "./ThreeColumns";
|
|
4
5
|
import Video from "./Video";
|
|
5
6
|
import Container from "../../Container";
|
|
6
7
|
import styles from "./styles.module.scss";
|
|
@@ -64,6 +65,15 @@ function CaseContent({
|
|
|
64
65
|
/>
|
|
65
66
|
);
|
|
66
67
|
}
|
|
68
|
+
if (section.fieldGroupName === "Case_Case_Content_Threecolumns") {
|
|
69
|
+
return (
|
|
70
|
+
<ThreeColumns
|
|
71
|
+
key={section.fieldGroupName + i}
|
|
72
|
+
section={section}
|
|
73
|
+
Image={Image}
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
67
77
|
if (section.fieldGroupName === "Case_Case_Content_Video") {
|
|
68
78
|
return (
|
|
69
79
|
<section
|
|
@@ -66,6 +66,15 @@
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
.threeColumns {
|
|
70
|
+
display: flex;
|
|
71
|
+
justify-content: space-between;
|
|
72
|
+
|
|
73
|
+
@media #{$QUERY-sm} {
|
|
74
|
+
display: block;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
69
78
|
.column {
|
|
70
79
|
width: 600px;
|
|
71
80
|
max-width: calc(50% - 20px);
|
|
@@ -93,7 +102,6 @@
|
|
|
93
102
|
max-width: 100%;
|
|
94
103
|
margin: 0 auto;
|
|
95
104
|
position: relative;
|
|
96
|
-
background-color: #eee;
|
|
97
105
|
background-position: center;
|
|
98
106
|
background-repeat: no-repeat;
|
|
99
107
|
|
|
@@ -83,7 +83,11 @@ function Cases({
|
|
|
83
83
|
|
|
84
84
|
return (
|
|
85
85
|
<div key={item.id} className={styles.case}>
|
|
86
|
-
<Link
|
|
86
|
+
<Link
|
|
87
|
+
href={`/cases/${
|
|
88
|
+
item.status !== "draft" ? item.slug : `preview/${item.id}`
|
|
89
|
+
}`}
|
|
90
|
+
>
|
|
87
91
|
{thumbnailVideo && (
|
|
88
92
|
<Video
|
|
89
93
|
url={thumbnailVideo.mediaItemUrl}
|
|
@@ -109,6 +113,7 @@ function Cases({
|
|
|
109
113
|
<div className={styles.texts}>
|
|
110
114
|
<div>
|
|
111
115
|
<h3 className={styles.title}>{item.title}</h3>
|
|
116
|
+
{item.status === "draft" && <div>DRAFT</div>}
|
|
112
117
|
<div className={styles.caption}>{item.case.caption}</div>
|
|
113
118
|
</div>
|
|
114
119
|
<div className={styles.arrowWrapper}>
|
package/lib/queries/client.ts
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import { GraphQLClient } from "graphql-request";
|
|
2
2
|
|
|
3
3
|
const baseUrl = process.env.WORDPRESS_URL || "https://data.foundry.ch";
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
const headers: Record<string, string> = {
|
|
6
|
+
"Content-Type": "application/json",
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
if (process.env.WP_PREVIEW_USER && process.env.WP_PREVIEW_PASS) {
|
|
10
|
+
const auth = Buffer.from(`admin:${process.env.WP_PREVIEW_PASS}`).toString(
|
|
11
|
+
"base64"
|
|
12
|
+
);
|
|
13
|
+
headers["Authorization"] = `Basic ${auth}`;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const graphqlClient = new GraphQLClient(`${baseUrl}/graphql`, {
|
|
17
|
+
headers,
|
|
18
|
+
});
|
|
5
19
|
|
|
6
20
|
export default graphqlClient;
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { gql } from "graphql-request";
|
|
2
|
+
import { Case } from "../../lib/types";
|
|
3
|
+
import client from "./client";
|
|
4
|
+
import { type ContactPage } from "./getContactPage";
|
|
5
|
+
|
|
6
|
+
type HomePage = {
|
|
7
|
+
customFieldsBerlin: {
|
|
8
|
+
awardsHeading?: string;
|
|
9
|
+
awards?: Array<{
|
|
10
|
+
image: {
|
|
11
|
+
sourceUrl: string;
|
|
12
|
+
};
|
|
13
|
+
heading: string;
|
|
14
|
+
text: string;
|
|
15
|
+
}>;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default async function getCaseBySlug({
|
|
20
|
+
id,
|
|
21
|
+
language,
|
|
22
|
+
}: {
|
|
23
|
+
id: string;
|
|
24
|
+
language: string;
|
|
25
|
+
}): Promise<{
|
|
26
|
+
case: Case;
|
|
27
|
+
contactPage: ContactPage;
|
|
28
|
+
homePage: HomePage;
|
|
29
|
+
}> {
|
|
30
|
+
const homePage = language === "DE" ? "home-berlin-de" : "home-berlin";
|
|
31
|
+
const contactPage = language === "DE" ? "contact-de" : "contact";
|
|
32
|
+
|
|
33
|
+
const query = gql`
|
|
34
|
+
query GetCaseBySlug($id: ID!) {
|
|
35
|
+
case(id: $id, idType: ID) {
|
|
36
|
+
id
|
|
37
|
+
title
|
|
38
|
+
status
|
|
39
|
+
case {
|
|
40
|
+
caption
|
|
41
|
+
mainImage {
|
|
42
|
+
sourceUrl
|
|
43
|
+
}
|
|
44
|
+
details {
|
|
45
|
+
heading
|
|
46
|
+
text
|
|
47
|
+
}
|
|
48
|
+
awards {
|
|
49
|
+
heading
|
|
50
|
+
text
|
|
51
|
+
image {
|
|
52
|
+
sourceUrl
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
relatedCases {
|
|
56
|
+
__typename
|
|
57
|
+
... on Case {
|
|
58
|
+
id
|
|
59
|
+
title
|
|
60
|
+
uri
|
|
61
|
+
case {
|
|
62
|
+
thumbnailImage{
|
|
63
|
+
sourceUrl
|
|
64
|
+
}
|
|
65
|
+
mainImage {
|
|
66
|
+
sourceUrl
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
content {
|
|
72
|
+
... on Case_Case_Content_Quote {
|
|
73
|
+
fieldGroupName
|
|
74
|
+
name
|
|
75
|
+
position
|
|
76
|
+
text
|
|
77
|
+
}
|
|
78
|
+
... on Case_Case_Content_Results {
|
|
79
|
+
fieldGroupName
|
|
80
|
+
context
|
|
81
|
+
approach
|
|
82
|
+
outcome
|
|
83
|
+
}
|
|
84
|
+
... on Case_Case_Content_Numbers {
|
|
85
|
+
fieldGroupName
|
|
86
|
+
number1
|
|
87
|
+
text1
|
|
88
|
+
number2
|
|
89
|
+
text2
|
|
90
|
+
number3
|
|
91
|
+
text3
|
|
92
|
+
}
|
|
93
|
+
... on Case_Case_Content_Video {
|
|
94
|
+
fieldGroupName
|
|
95
|
+
autoplay
|
|
96
|
+
poster {
|
|
97
|
+
sourceUrl
|
|
98
|
+
}
|
|
99
|
+
caption
|
|
100
|
+
video
|
|
101
|
+
ratio
|
|
102
|
+
}
|
|
103
|
+
... on Case_Case_Content_FullWidthImage {
|
|
104
|
+
fieldGroupName
|
|
105
|
+
fullWidth
|
|
106
|
+
image {
|
|
107
|
+
sourceUrl
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
... on Case_Case_Content_CenterColumn {
|
|
111
|
+
fieldGroupName
|
|
112
|
+
text
|
|
113
|
+
}
|
|
114
|
+
... on Case_Case_Content_Twocolumns {
|
|
115
|
+
fieldGroupName
|
|
116
|
+
left {
|
|
117
|
+
... on Case_Case_Content_Twocolumns_Left_Image {
|
|
118
|
+
fieldGroupName
|
|
119
|
+
image {
|
|
120
|
+
sourceUrl
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
... on Case_Case_Content_Twocolumns_Left_Text {
|
|
124
|
+
fieldGroupName
|
|
125
|
+
text
|
|
126
|
+
}
|
|
127
|
+
... on Case_Case_Content_Twocolumns_Left_Video {
|
|
128
|
+
fieldGroupName
|
|
129
|
+
autoplay
|
|
130
|
+
poster {
|
|
131
|
+
sourceUrl
|
|
132
|
+
}
|
|
133
|
+
caption
|
|
134
|
+
video
|
|
135
|
+
ratio
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
right {
|
|
139
|
+
... on Case_Case_Content_Twocolumns_Right_Image {
|
|
140
|
+
fieldGroupName
|
|
141
|
+
image {
|
|
142
|
+
sourceUrl
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
... on Case_Case_Content_Twocolumns_Right_Text {
|
|
146
|
+
fieldGroupName
|
|
147
|
+
text
|
|
148
|
+
}
|
|
149
|
+
... on Case_Case_Content_Twocolumns_Right_Video {
|
|
150
|
+
fieldGroupName
|
|
151
|
+
autoplay
|
|
152
|
+
poster {
|
|
153
|
+
sourceUrl
|
|
154
|
+
}
|
|
155
|
+
caption
|
|
156
|
+
video
|
|
157
|
+
ratio
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
... on Case_Case_Content_Threecolumns {
|
|
162
|
+
fieldGroupName
|
|
163
|
+
left {
|
|
164
|
+
... on Case_Case_Content_Threecolumns_Left_Image {
|
|
165
|
+
fieldGroupName
|
|
166
|
+
image {
|
|
167
|
+
sourceUrl
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
... on Case_Case_Content_Threecolumns_Left_Text {
|
|
171
|
+
fieldGroupName
|
|
172
|
+
text
|
|
173
|
+
}
|
|
174
|
+
... on Case_Case_Content_Threecolumns_Left_Video {
|
|
175
|
+
fieldGroupName
|
|
176
|
+
autoplay
|
|
177
|
+
poster {
|
|
178
|
+
sourceUrl
|
|
179
|
+
}
|
|
180
|
+
caption
|
|
181
|
+
video
|
|
182
|
+
ratio
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
center {
|
|
186
|
+
... on Case_Case_Content_Threecolumns_Center_Image {
|
|
187
|
+
fieldGroupName
|
|
188
|
+
image {
|
|
189
|
+
sourceUrl
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
... on Case_Case_Content_Threecolumns_Center_Text {
|
|
193
|
+
fieldGroupName
|
|
194
|
+
text
|
|
195
|
+
}
|
|
196
|
+
... on Case_Case_Content_Threecolumns_Center_Video {
|
|
197
|
+
fieldGroupName
|
|
198
|
+
autoplay
|
|
199
|
+
poster {
|
|
200
|
+
sourceUrl
|
|
201
|
+
}
|
|
202
|
+
caption
|
|
203
|
+
video
|
|
204
|
+
ratio
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
right {
|
|
208
|
+
... on Case_Case_Content_Threecolumns_Right_Image {
|
|
209
|
+
fieldGroupName
|
|
210
|
+
image {
|
|
211
|
+
sourceUrl
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
... on Case_Case_Content_Threecolumns_Right_Text {
|
|
215
|
+
fieldGroupName
|
|
216
|
+
text
|
|
217
|
+
}
|
|
218
|
+
... on Case_Case_Content_Threecolumns_Right_Video {
|
|
219
|
+
fieldGroupName
|
|
220
|
+
autoplay
|
|
221
|
+
poster {
|
|
222
|
+
sourceUrl
|
|
223
|
+
}
|
|
224
|
+
caption
|
|
225
|
+
video
|
|
226
|
+
ratio
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
contactPage: page(id: "${contactPage}", idType: URI) {
|
|
234
|
+
customFieldsContact {
|
|
235
|
+
berlinImage {
|
|
236
|
+
sourceUrl
|
|
237
|
+
}
|
|
238
|
+
berlinText
|
|
239
|
+
berlinEmail
|
|
240
|
+
berlinPhone
|
|
241
|
+
zurichImage {
|
|
242
|
+
sourceUrl
|
|
243
|
+
}
|
|
244
|
+
zurichText
|
|
245
|
+
zurichEmail
|
|
246
|
+
zurichPhone
|
|
247
|
+
newyorkImage {
|
|
248
|
+
sourceUrl
|
|
249
|
+
}
|
|
250
|
+
newyorkText
|
|
251
|
+
newyorkEmail
|
|
252
|
+
newyorkPhone
|
|
253
|
+
contactTeaserHeading
|
|
254
|
+
contactTeaserText
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
homePage: page(id: "${homePage}", idType: URI) {
|
|
258
|
+
customFieldsBerlin {
|
|
259
|
+
awardsHeading
|
|
260
|
+
awards {
|
|
261
|
+
image {
|
|
262
|
+
sourceUrl
|
|
263
|
+
}
|
|
264
|
+
heading
|
|
265
|
+
text
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
`;
|
|
271
|
+
|
|
272
|
+
const variables = { id };
|
|
273
|
+
const data: {
|
|
274
|
+
case: Case;
|
|
275
|
+
contactPage: ContactPage;
|
|
276
|
+
homePage: HomePage;
|
|
277
|
+
} = await client.request(query, variables);
|
|
278
|
+
|
|
279
|
+
return {
|
|
280
|
+
case: data.case,
|
|
281
|
+
contactPage: data.contactPage,
|
|
282
|
+
homePage: data.homePage,
|
|
283
|
+
};
|
|
284
|
+
}
|
|
@@ -51,6 +51,22 @@ export default async function getCaseBySlug({
|
|
|
51
51
|
sourceUrl
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
+
relatedCases {
|
|
55
|
+
__typename
|
|
56
|
+
... on Case {
|
|
57
|
+
id
|
|
58
|
+
title
|
|
59
|
+
uri
|
|
60
|
+
case {
|
|
61
|
+
thumbnailImage{
|
|
62
|
+
sourceUrl
|
|
63
|
+
}
|
|
64
|
+
mainImage {
|
|
65
|
+
sourceUrl
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
54
70
|
content {
|
|
55
71
|
... on Case_Case_Content_Quote {
|
|
56
72
|
fieldGroupName
|
|
@@ -141,6 +157,75 @@ export default async function getCaseBySlug({
|
|
|
141
157
|
}
|
|
142
158
|
}
|
|
143
159
|
}
|
|
160
|
+
... on Case_Case_Content_Threecolumns {
|
|
161
|
+
fieldGroupName
|
|
162
|
+
left {
|
|
163
|
+
... on Case_Case_Content_Threecolumns_Left_Image {
|
|
164
|
+
fieldGroupName
|
|
165
|
+
image {
|
|
166
|
+
sourceUrl
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
... on Case_Case_Content_Threecolumns_Left_Text {
|
|
170
|
+
fieldGroupName
|
|
171
|
+
text
|
|
172
|
+
}
|
|
173
|
+
... on Case_Case_Content_Threecolumns_Left_Video {
|
|
174
|
+
fieldGroupName
|
|
175
|
+
autoplay
|
|
176
|
+
poster {
|
|
177
|
+
sourceUrl
|
|
178
|
+
}
|
|
179
|
+
caption
|
|
180
|
+
video
|
|
181
|
+
ratio
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
center {
|
|
185
|
+
... on Case_Case_Content_Threecolumns_Center_Image {
|
|
186
|
+
fieldGroupName
|
|
187
|
+
image {
|
|
188
|
+
sourceUrl
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
... on Case_Case_Content_Threecolumns_Center_Text {
|
|
192
|
+
fieldGroupName
|
|
193
|
+
text
|
|
194
|
+
}
|
|
195
|
+
... on Case_Case_Content_Threecolumns_Center_Video {
|
|
196
|
+
fieldGroupName
|
|
197
|
+
autoplay
|
|
198
|
+
poster {
|
|
199
|
+
sourceUrl
|
|
200
|
+
}
|
|
201
|
+
caption
|
|
202
|
+
video
|
|
203
|
+
ratio
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
right {
|
|
207
|
+
... on Case_Case_Content_Threecolumns_Right_Image {
|
|
208
|
+
fieldGroupName
|
|
209
|
+
image {
|
|
210
|
+
sourceUrl
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
... on Case_Case_Content_Threecolumns_Right_Text {
|
|
214
|
+
fieldGroupName
|
|
215
|
+
text
|
|
216
|
+
}
|
|
217
|
+
... on Case_Case_Content_Threecolumns_Right_Video {
|
|
218
|
+
fieldGroupName
|
|
219
|
+
autoplay
|
|
220
|
+
poster {
|
|
221
|
+
sourceUrl
|
|
222
|
+
}
|
|
223
|
+
caption
|
|
224
|
+
video
|
|
225
|
+
ratio
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
144
229
|
}
|
|
145
230
|
}
|
|
146
231
|
}
|
|
@@ -38,6 +38,7 @@ type Params = {
|
|
|
38
38
|
page?: number;
|
|
39
39
|
service?: string;
|
|
40
40
|
industry?: string;
|
|
41
|
+
isPreview?: boolean;
|
|
41
42
|
};
|
|
42
43
|
|
|
43
44
|
export default async function getCasesPage({
|
|
@@ -50,6 +51,7 @@ export default async function getCasesPage({
|
|
|
50
51
|
page = 1,
|
|
51
52
|
service = "",
|
|
52
53
|
industry = "",
|
|
54
|
+
isPreview = false,
|
|
53
55
|
}: Params): Promise<{
|
|
54
56
|
casesPage: CasesPage;
|
|
55
57
|
cases: Case[];
|
|
@@ -88,6 +90,7 @@ export default async function getCasesPage({
|
|
|
88
90
|
|
|
89
91
|
// Where Clause
|
|
90
92
|
const whereConditions = [
|
|
93
|
+
isPreview ? "status: DRAFT" : "status: PUBLISH",
|
|
91
94
|
hasSearchTerm ? "search: $search" : "",
|
|
92
95
|
hasCategoryTerm ? "caseCategory: $categorySlug" : "",
|
|
93
96
|
exclude ? "notIn: $exclude" : "",
|
|
@@ -130,6 +133,7 @@ export default async function getCasesPage({
|
|
|
130
133
|
title
|
|
131
134
|
slug
|
|
132
135
|
uri
|
|
136
|
+
status
|
|
133
137
|
case {
|
|
134
138
|
featured
|
|
135
139
|
service
|
package/lib/queries/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ import getMetadataBySlug from "./getMetadataBySlug";
|
|
|
5
5
|
import getPageBySlug from "./getPageBySlug";
|
|
6
6
|
import getPostBySlug from "./getPostBySlug";
|
|
7
7
|
import getCaseBySlug from "./getCaseBySlug";
|
|
8
|
+
import getCaseById from "./getCaseById";
|
|
8
9
|
import getContactPage from "./getContactPage";
|
|
9
10
|
import getBrands from "./getBrands";
|
|
10
11
|
import getPeoplePage from "./getPeoplePage";
|
|
@@ -25,6 +26,7 @@ export {
|
|
|
25
26
|
getPageBySlug,
|
|
26
27
|
getPostBySlug,
|
|
27
28
|
getCaseBySlug,
|
|
29
|
+
getCaseById,
|
|
28
30
|
getContactPage,
|
|
29
31
|
getBrands,
|
|
30
32
|
getPeoplePage,
|
package/lib/types/index.ts
CHANGED
|
@@ -34,7 +34,10 @@ type ColumnImage = {
|
|
|
34
34
|
| "Post_Customfieldsposts_Content_Twocolumns_Left_Image"
|
|
35
35
|
| "Post_Customfieldsposts_Content_Twocolumns_Right_Image"
|
|
36
36
|
| "Case_Case_Content_Twocolumns_Left_Image"
|
|
37
|
-
| "Case_Case_Content_Twocolumns_Right_Image"
|
|
37
|
+
| "Case_Case_Content_Twocolumns_Right_Image"
|
|
38
|
+
| "Case_Case_Content_Threecolumns_Left_Image"
|
|
39
|
+
| "Case_Case_Content_Threecolumns_Center_Image"
|
|
40
|
+
| "Case_Case_Content_Threecolumns_Right_Image";
|
|
38
41
|
image: { sourceUrl: string };
|
|
39
42
|
caption?: string;
|
|
40
43
|
};
|
|
@@ -44,7 +47,10 @@ type ColumnText = {
|
|
|
44
47
|
| "Post_Customfieldsposts_Content_Twocolumns_Left_Text"
|
|
45
48
|
| "Post_Customfieldsposts_Content_Twocolumns_Right_Text"
|
|
46
49
|
| "Case_Case_Content_Twocolumns_Left_Text"
|
|
47
|
-
| "Case_Case_Content_Twocolumns_Right_Text"
|
|
50
|
+
| "Case_Case_Content_Twocolumns_Right_Text"
|
|
51
|
+
| "Case_Case_Content_Threecolumns_Left_Text"
|
|
52
|
+
| "Case_Case_Content_Threecolumns_Center_Text"
|
|
53
|
+
| "Case_Case_Content_Threecolumns_Right_Text";
|
|
48
54
|
text: string;
|
|
49
55
|
};
|
|
50
56
|
|
|
@@ -74,6 +80,13 @@ export type TwoColumns = {
|
|
|
74
80
|
right?: ColumnOption[];
|
|
75
81
|
};
|
|
76
82
|
|
|
83
|
+
export type ThreeColumns = {
|
|
84
|
+
fieldGroupName: "Case_Case_Content_Threecolumns";
|
|
85
|
+
left?: ColumnOption[];
|
|
86
|
+
center?: ColumnOption[];
|
|
87
|
+
right?: ColumnOption[];
|
|
88
|
+
};
|
|
89
|
+
|
|
77
90
|
export type Video = {
|
|
78
91
|
fieldGroupName:
|
|
79
92
|
| "Post_Customfieldsposts_Content_Video"
|
|
@@ -81,7 +94,10 @@ export type Video = {
|
|
|
81
94
|
| "Post_Customfieldsposts_Content_Twocolumns_Left_Video"
|
|
82
95
|
| "Post_Customfieldsposts_Content_Twocolumns_Right_Video"
|
|
83
96
|
| "Case_Case_Content_Twocolumns_Left_Video"
|
|
84
|
-
| "Case_Case_Content_Twocolumns_Right_Video"
|
|
97
|
+
| "Case_Case_Content_Twocolumns_Right_Video"
|
|
98
|
+
| "Case_Case_Content_Threecolumns_Left_Video"
|
|
99
|
+
| "Case_Case_Content_Threecolumns_Center_Video"
|
|
100
|
+
| "Case_Case_Content_Threecolumns_Right_Video";
|
|
85
101
|
autoplay: boolean;
|
|
86
102
|
poster: { sourceUrl: string };
|
|
87
103
|
caption: string;
|
|
@@ -124,6 +140,7 @@ export type Content = (
|
|
|
124
140
|
| FullWidthImage
|
|
125
141
|
| CenterColumn
|
|
126
142
|
| TwoColumns
|
|
143
|
+
| ThreeColumns
|
|
127
144
|
| Video
|
|
128
145
|
| Results
|
|
129
146
|
| Numbers
|
|
@@ -209,8 +226,10 @@ export type Case = {
|
|
|
209
226
|
title: string;
|
|
210
227
|
slug?: string;
|
|
211
228
|
uri: string;
|
|
229
|
+
link?: string;
|
|
212
230
|
date?: string;
|
|
213
231
|
content?: string;
|
|
232
|
+
status?: string;
|
|
214
233
|
author?: {
|
|
215
234
|
node: {
|
|
216
235
|
name: string;
|
|
@@ -227,6 +246,19 @@ export type Case = {
|
|
|
227
246
|
featured?: boolean;
|
|
228
247
|
service?: string[];
|
|
229
248
|
industry?: string[];
|
|
249
|
+
relatedCases?: {
|
|
250
|
+
id: string;
|
|
251
|
+
title: string;
|
|
252
|
+
uri: string;
|
|
253
|
+
case: {
|
|
254
|
+
thumbnailImage?: {
|
|
255
|
+
sourceUrl: string;
|
|
256
|
+
};
|
|
257
|
+
mainImage?: {
|
|
258
|
+
sourceUrl: string;
|
|
259
|
+
};
|
|
260
|
+
};
|
|
261
|
+
}[];
|
|
230
262
|
thumbnailVideo?: {
|
|
231
263
|
mediaItemUrl: string;
|
|
232
264
|
};
|