foundry-component-library 0.2.32 → 0.2.34

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.
@@ -10,6 +10,7 @@ function Footer({
10
10
  facebook,
11
11
  linkedin,
12
12
  instagram,
13
+ lang,
13
14
  }: {
14
15
  details: {
15
16
  berlinEmail: string;
@@ -20,6 +21,7 @@ function Footer({
20
21
  facebook: string;
21
22
  linkedin: string;
22
23
  instagram: string;
24
+ lang?: "DE" | "EN";
23
25
  }) {
24
26
  const { berlinEmail, zurichEmail, newyorkEmail } = details;
25
27
  const year = new Date().getFullYear();
@@ -38,7 +40,7 @@ function Footer({
38
40
  <div className={styles.offices}>
39
41
  {berlinEmail && (
40
42
  <div className={styles.office}>
41
- <div className={styles.city}>{translate("Berlin")}</div>
43
+ <div className={styles.city}>{translate("Berlin", lang)}</div>
42
44
  <div className={styles.email}>
43
45
  <a href={`mailto:${berlinEmail}`}>{berlinEmail}</a>
44
46
  </div>
@@ -46,7 +48,7 @@ function Footer({
46
48
  )}
47
49
  {zurichEmail && (
48
50
  <div className={styles.office}>
49
- <div className={styles.city}>{translate("Zurich")}</div>
51
+ <div className={styles.city}>{translate("Zurich", lang)}</div>
50
52
  <div className={styles.email}>
51
53
  <a href={`mailto:${zurichEmail}`}>{zurichEmail}</a>
52
54
  </div>
@@ -54,7 +56,9 @@ function Footer({
54
56
  )}
55
57
  {newyorkEmail && (
56
58
  <div className={styles.office}>
57
- <div className={styles.city}>{translate("New York")}</div>
59
+ <div className={styles.city}>
60
+ {translate("New York", lang)}
61
+ </div>
58
62
  <div className={styles.email}>
59
63
  <a href={`mailto:${newyorkEmail}`}>{newyorkEmail}</a>
60
64
  </div>
@@ -65,26 +69,28 @@ function Footer({
65
69
  <div className={styles.right}>
66
70
  <ul className={styles.menu}>
67
71
  <li className={styles.menuItem}>
68
- <Link href="/hubs">Service Hubs</Link>
72
+ <Link href="/hubs">{translate("Service Hubs", lang)}</Link>
69
73
  </li>
70
74
  <li className={styles.menuItem}>
71
- <Link href="/about-us">About Us</Link>
75
+ <Link href="/about-us">{translate("About Us", lang)}</Link>
72
76
  </li>
73
77
  <li className={styles.menuItem}>
74
- <Link href="/cases">Case Studies</Link>
78
+ <Link href="/cases">{translate("Case Studies", lang)}</Link>
75
79
  </li>
76
80
  {/* <li className={styles.menuItem}>
77
81
  <Link href="/team">Team & Careers</Link>
78
82
  </li> */}
79
83
  <li className={styles.menuItem}>
80
- <Link href="/news">News & Insights</Link>
84
+ <Link href="/news">{translate("News & Insights", lang)}</Link>
81
85
  </li>
82
86
  <li className={styles.menuItem}>
83
- <Link href="/contact">Contact</Link>
87
+ <Link href="/contact">{translate("Contact", lang)}</Link>
84
88
  </li>
85
89
  </ul>
86
90
  <div className={styles.social}>
87
- <div className={styles.socialHeading}>Follow Us</div>
91
+ <div className={styles.socialHeading}>
92
+ {translate("Follow Us", lang)}
93
+ </div>
88
94
  <ul className={styles.menuSocial}>
89
95
  <li className={styles.menuItem}>
90
96
  <Link href={instagram} target="_blank">
@@ -108,9 +114,11 @@ function Footer({
108
114
  <div className={styles.bottom}>
109
115
  <div>FOUNDRY © {year}</div>
110
116
  <div className={styles.bottomLinks}>
111
- <Link href="/imprint">{translate("Imprint")}</Link>
112
- <Link href="/terms">{translate("Terms")}</Link>
113
- <Link href="/privacy-policy">{translate("Privacy policy")}</Link>
117
+ <Link href="/imprint">{translate("Imprint", lang)}</Link>
118
+ <Link href="/terms">{translate("Terms", lang)}</Link>
119
+ <Link href="/privacy-policy">
120
+ {translate("Privacy policy", lang)}
121
+ </Link>
114
122
  </div>
115
123
  </div>
116
124
  </Container>
@@ -189,7 +189,7 @@
189
189
  gap: 24px;
190
190
  text-transform: none;
191
191
  font-size: 16px;
192
- width: 335px;
192
+ max-width: 370px;
193
193
  max-width: 100%;
194
194
 
195
195
  @media screen and (max-width: 1000px) {
@@ -34,17 +34,26 @@ function Menu({
34
34
  <div className={styles.menuWrapper}>
35
35
  <ul className={styles.menuList}>
36
36
  <li className={styles.menuListItem}>
37
- <Link href={`${langPrefix}/hubs`}>{translate("Service Hubs")}</Link>
37
+ <Link href={`${langPrefix}`}>{translate("Home", currentLang)}</Link>
38
38
  </li>
39
39
  <li className={styles.menuListItem}>
40
- <Link href={`${langPrefix}/cases`}>{translate("Cases")}</Link>
40
+ <Link href={`${langPrefix}/hubs`}>
41
+ {translate("Service Hubs", currentLang)}
42
+ </Link>
41
43
  </li>
42
44
  <li className={styles.menuListItem}>
43
- <Link href={`${langPrefix}/about-us`}>{translate("About Us")}</Link>
45
+ <Link href={`${langPrefix}/cases`}>
46
+ {translate("Cases", currentLang)}
47
+ </Link>
48
+ </li>
49
+ <li className={styles.menuListItem}>
50
+ <Link href={`${langPrefix}/about-us`}>
51
+ {translate("About Us", currentLang)}
52
+ </Link>
44
53
  </li>
45
54
  <li className={styles.menuListItem}>
46
55
  <Link href={`${langPrefix}/contact`}>
47
- {translate("Contact Us")}
56
+ {translate("Contact Us", currentLang)}
48
57
  </Link>
49
58
  </li>
50
59
  </ul>
@@ -67,13 +76,13 @@ function Menu({
67
76
  </li> */}
68
77
  <li className={styles.secondaryMenuItem}>
69
78
  <Link href={`${langPrefix}/team`}>
70
- {translate("Team & Careers")}
79
+ {translate("Team & Careers", currentLang)}
71
80
  <Arrow />
72
81
  </Link>
73
82
  </li>
74
83
  <li className={styles.secondaryMenuItem}>
75
84
  <Link href={`${langPrefix}/news`}>
76
- {translate("News & Insights")}
85
+ {translate("News & Insights", currentLang)}
77
86
  <Arrow />
78
87
  </Link>
79
88
  </li>
@@ -29,6 +29,14 @@ function Header({ Link }: { Link: NextLink }) {
29
29
  };
30
30
  }, [logo]);
31
31
 
32
+ useEffect(() => {
33
+ if (!isMenuOpen) return;
34
+
35
+ const onScroll = () => setMenuOpen(false);
36
+ window.addEventListener("scroll", onScroll, { once: true });
37
+ return () => window.removeEventListener("scroll", onScroll);
38
+ }, [isMenuOpen, setMenuOpen]);
39
+
32
40
  return (
33
41
  <>
34
42
  <header className={styles.header}>
@@ -176,18 +176,18 @@
176
176
 
177
177
  .langBtn {
178
178
  text-transform: uppercase;
179
- opacity: 0.6;
179
+ opacity: 1;
180
180
  }
181
181
  .divider {
182
182
  margin: 3px 1px;
183
183
  width: 2px;
184
184
  height: calc(100% - 6px);
185
185
  background-color: $color-text;
186
- opacity: 0.6;
186
+ opacity: 1;
187
187
  }
188
188
 
189
189
  .langBtn.active {
190
- opacity: 1;
190
+ opacity: 0.6;
191
191
  }
192
192
 
193
193
  .logo {
@@ -22,8 +22,14 @@ const ImageTitle = ({
22
22
  <div className={`${styles.imageTitle} ${inverseStyle}`}>
23
23
  <div className={styles.texts}>
24
24
  <div>
25
- <div className={styles.heading}>{heading}</div>
26
- <div className={styles.text}>{text}</div>
25
+ <div
26
+ className={styles.heading}
27
+ dangerouslySetInnerHTML={{ __html: heading || "" }}
28
+ />
29
+ <div
30
+ className={styles.text}
31
+ dangerouslySetInnerHTML={{ __html: text || "" }}
32
+ />
27
33
  </div>
28
34
  </div>
29
35
  {image && (
@@ -32,45 +32,47 @@ const QuoteSection = ({
32
32
  return (
33
33
  <div className={styles.quote}>
34
34
  <Container>
35
- {items.map((item, i) => {
36
- return (
37
- <div
38
- key={item?.name || i}
39
- className={`${styles.content} ${
40
- active === i ? styles.active : ""
41
- }`}>
42
- <div className={styles.person}>
43
- <div>
44
- <div className={styles.name}>{item.name}</div>
45
- <div className={styles.position}>{item.position}</div>
46
- </div>
47
- </div>
35
+ <div className={styles.quoteWrapper}>
36
+ {items.map((item, i) => {
37
+ return (
48
38
  <div
49
- className={styles.text}
50
- onMouseEnter={() => setPaused(true)}
51
- onMouseLeave={() => setPaused(false)}>
52
- {item.text}
39
+ key={item?.name || i}
40
+ className={`${styles.content} ${
41
+ active === i ? styles.active : ""
42
+ }`}>
43
+ <div className={styles.person}>
44
+ <div>
45
+ <div className={styles.name}>{item.name}</div>
46
+ <div className={styles.position}>{item.position}</div>
47
+ </div>
48
+ </div>
49
+ <div
50
+ className={styles.text}
51
+ onMouseEnter={() => setPaused(true)}
52
+ onMouseLeave={() => setPaused(false)}>
53
+ {item.text}
54
+ </div>
53
55
  </div>
56
+ );
57
+ })}
58
+ {items.length > 1 && (
59
+ <div className={`${styles.indicators} ${styles.desktop}}`}>
60
+ {items.map((el, i) => {
61
+ return (
62
+ <div
63
+ key={el.name}
64
+ className={`${styles.indicator} ${
65
+ active === i ? styles.active : ""
66
+ }`}
67
+ onClick={() => {
68
+ setActive(i);
69
+ }}
70
+ />
71
+ );
72
+ })}
54
73
  </div>
55
- );
56
- })}
57
- {items.length > 1 && (
58
- <div className={`${styles.indicators} ${styles.desktop}}`}>
59
- {items.map((el, i) => {
60
- return (
61
- <div
62
- key={el.name}
63
- className={`${styles.indicator} ${
64
- active === i ? styles.active : ""
65
- }`}
66
- onClick={() => {
67
- setActive(i);
68
- }}
69
- />
70
- );
71
- })}
72
- </div>
73
- )}
74
+ )}
75
+ </div>
74
76
  </Container>
75
77
  </div>
76
78
  );
@@ -10,6 +10,17 @@
10
10
  }
11
11
  }
12
12
 
13
+ .quoteWrapper {
14
+ display: flex;
15
+ flex-direction: column;
16
+ justify-content: space-between;
17
+ min-height: 432px;
18
+
19
+ @media #{$QUERY-sm} {
20
+ min-height: 350px;
21
+ }
22
+ }
23
+
13
24
  .logo {
14
25
  width: 180px;
15
26
  height: 64px;
@@ -89,6 +100,7 @@
89
100
  align-items: center;
90
101
  justify-content: flex-start;
91
102
  gap: 16px;
103
+ margin-top: auto;
92
104
 
93
105
  @media #{$QUERY-sm} {
94
106
  padding-top: 30px;
@@ -32,8 +32,18 @@ const TextSection = ({
32
32
  dangerouslySetInnerHTML={{ __html: heading }}
33
33
  />
34
34
  )}
35
- {subheading && <div className={styles.subheading}>{subheading}</div>}
36
- {text && <div className={styles.text}>{text}</div>}
35
+ {subheading && (
36
+ <div
37
+ className={styles.subheading}
38
+ dangerouslySetInnerHTML={{ __html: subheading }}
39
+ />
40
+ )}
41
+ {text && (
42
+ <div
43
+ className={styles.text}
44
+ dangerouslySetInnerHTML={{ __html: text }}
45
+ />
46
+ )}
37
47
  </div>
38
48
  </Container>
39
49
  );
@@ -1,4 +1,4 @@
1
- import { GraphQLClient } from "graphql-request";
1
+ import { Variables } from "../types";
2
2
 
3
3
  const baseUrl = process.env.WORDPRESS_URL || "https://data.foundry.ch";
4
4
 
@@ -13,9 +13,26 @@ if (process.env.WP_PREVIEW_USER && process.env.WP_PREVIEW_PASS) {
13
13
  headers["Authorization"] = `Basic ${auth}`;
14
14
  }
15
15
 
16
- const graphqlClient = new GraphQLClient(`${baseUrl}/graphql`, {
17
- headers,
18
- errorPolicy: "all",
19
- });
16
+ export async function request<T>(
17
+ query: string,
18
+ variables?: Variables,
19
+ ): Promise<T> {
20
+ const response = await fetch(`${baseUrl}/graphql`, {
21
+ method: "POST",
22
+ headers,
23
+ body: JSON.stringify({ query, variables }),
24
+ next: {
25
+ revalidate: 60 * 3,
26
+ },
27
+ } as RequestInit & { next?: { revalidate?: number } });
20
28
 
21
- export default graphqlClient;
29
+ if (!response.ok) {
30
+ throw new Error(`GraphQL request failed: ${response.statusText}`);
31
+ }
32
+
33
+ const json = await response.json();
34
+ if (json.errors) {
35
+ throw new Error(json.errors[0]?.message || "GraphQL error");
36
+ }
37
+ return json.data as T;
38
+ }
@@ -1,5 +1,5 @@
1
- import { gql } from "graphql-request";
2
- import client from "./client";
1
+ import { Variables } from "../types";
2
+ import { request } from "./client";
3
3
 
4
4
  type AboutPage = {
5
5
  aboutPage: {
@@ -104,7 +104,7 @@ export default async function getAboutPage({
104
104
  const homePage = language === "DE" ? "home-berlin-de" : "home-berlin";
105
105
  const contactPage = language === "DE" ? "contact-de" : "contact";
106
106
 
107
- const query = gql`
107
+ const query = `
108
108
  query GetPageBySlug($slug: ID!) {
109
109
  aboutPage: page(id: $slug, idType: URI) {
110
110
  customFieldsAboutBerlin {
@@ -202,12 +202,13 @@ export default async function getAboutPage({
202
202
  }
203
203
  `;
204
204
 
205
- const variables = { slug: slug };
205
+ const variables: Variables = { slug: slug, language: language };
206
+
206
207
  const data: {
207
208
  aboutPage: AboutPage["aboutPage"];
208
209
  homePage: AboutPage["homePage"];
209
210
  contactPage: AboutPage["contactPage"];
210
- } = await client.request(query, variables);
211
+ } = await request(query, variables);
211
212
 
212
213
  return {
213
214
  aboutPage: data.aboutPage,
@@ -1,11 +1,10 @@
1
- import { gql } from "graphql-request";
2
- import { Page } from "../../lib/types";
3
- import client from "./client";
1
+ import { Page, Variables } from "../../lib/types";
2
+ import { request } from "./client";
4
3
 
5
4
  export default async function getBrands(): Promise<
6
5
  Page["customFields"]["brands"] | null
7
6
  > {
8
- const query = gql`
7
+ const query = `
9
8
  query GetBrands($slug: ID!) {
10
9
  page(id: $slug, idType: URI) {
11
10
  customFields {
@@ -20,7 +19,7 @@ export default async function getBrands(): Promise<
20
19
  }
21
20
  `;
22
21
 
23
- const variables = { slug: "home", language: "EN" };
24
- const data: { page: Page } = await client.request(query, variables);
22
+ const variables: Variables = { slug: "home", language: "EN" };
23
+ const data: { page: Page } = await request(query, variables);
25
24
  return data.page.customFields.brands;
26
25
  }
@@ -1,6 +1,5 @@
1
- import { gql } from "graphql-request";
2
- import { Case } from "../../lib/types";
3
- import client from "./client";
1
+ import { Case, Variables } from "../../lib/types";
2
+ import { request } from "./client";
4
3
  import { type ContactPage } from "./getContactPage";
5
4
 
6
5
  type HomePage = {
@@ -30,7 +29,7 @@ export default async function getCaseBySlug({
30
29
  const homePage = language === "DE" ? "home-berlin-de" : "home-berlin";
31
30
  const contactPage = language === "DE" ? "contact-de" : "contact";
32
31
 
33
- const query = gql`
32
+ const query = `
34
33
  query GetCaseBySlug($id: ID!) {
35
34
  case(id: $id, idType: ID) {
36
35
  id
@@ -272,12 +271,12 @@ export default async function getCaseBySlug({
272
271
  }
273
272
  `;
274
273
 
275
- const variables = { id };
274
+ const variables: Variables = { id, language };
276
275
  const data: {
277
276
  case: Case;
278
277
  contactPage: ContactPage;
279
278
  homePage: HomePage;
280
- } = await client.request(query, variables);
279
+ } = await request(query, variables);
281
280
 
282
281
  return {
283
282
  case: data.case,
@@ -1,6 +1,5 @@
1
- import { gql } from "graphql-request";
2
- import { Case } from "../../lib/types";
3
- import client from "./client";
1
+ import { Case, Variables } from "../../lib/types";
2
+ import { request } from "./client";
4
3
  import { type ContactPage } from "./getContactPage";
5
4
 
6
5
  type HomePage = {
@@ -30,7 +29,7 @@ export default async function getCaseBySlug({
30
29
  const homePage = language === "DE" ? "home-berlin-de" : "home-berlin";
31
30
  const contactPage = language === "DE" ? "contact-de" : "contact";
32
31
 
33
- const query = gql`
32
+ const query = `
34
33
  query GetCaseBySlug($slug: String, $language: LanguageCodeFilterEnum!) {
35
34
  cases(where: { name: $slug, language: $language }) {
36
35
  nodes {
@@ -273,14 +272,14 @@ export default async function getCaseBySlug({
273
272
  }
274
273
  `;
275
274
 
276
- const variables = { slug, language };
275
+ const variables: Variables = { slug, language };
277
276
  const data: {
278
277
  cases: {
279
278
  nodes: Case[];
280
279
  };
281
280
  contactPage: ContactPage;
282
281
  homePage: HomePage;
283
- } = await client.request(query, variables);
282
+ } = await request(query, variables);
284
283
 
285
284
  return {
286
285
  case: data?.cases.nodes[0],
@@ -1,6 +1,5 @@
1
- import { gql } from "graphql-request";
2
1
  import { Case, Variables } from "../../lib/types";
3
- import client from "./client";
2
+ import { request } from "./client";
4
3
 
5
4
  type Params = {
6
5
  perPage?: number;
@@ -55,7 +54,7 @@ export default async function getCases({
55
54
  const whereClause =
56
55
  whereConditions.length > 0 ? `where: { ${whereConditions.join(", ")}}` : "";
57
56
 
58
- const query = gql`
57
+ const query = `
59
58
  query GetCases(${variableDefinitions}) {
60
59
  cases(
61
60
  ${isPrevious ? "last: $perPage" : "first: $perPage"},
@@ -117,7 +116,7 @@ export default async function getCases({
117
116
  hasPreviousPage: boolean;
118
117
  };
119
118
  };
120
- } = await client.request(query, variables);
119
+ } = await request(query, variables);
121
120
 
122
121
  return {
123
122
  cases: data.cases.nodes,
@@ -1,6 +1,5 @@
1
- import { gql } from "graphql-request";
2
1
  import { Case, Variables } from "../../lib/types";
3
- import client from "./client";
2
+ import { request } from "./client";
4
3
  import { type ContactPage } from "./getContactPage";
5
4
 
6
5
  export const casesPerPage = 10;
@@ -113,7 +112,7 @@ export default async function getCasesPage({
113
112
  const whereClause =
114
113
  whereConditions.length > 0 ? `where: { ${whereConditions.join(", ")}}` : "";
115
114
 
116
- const query = gql`
115
+ const query = `
117
116
  query GetCasesPage(${variableDefinitions}) {
118
117
  casesPage: page(id: "${casesPage}", idType: DATABASE_ID) {
119
118
  customFieldsCases {
@@ -241,7 +240,7 @@ export default async function getCasesPage({
241
240
  };
242
241
  contactPage: ContactPage;
243
242
  homePage: HomePage;
244
- } = await client.request(query, variables);
243
+ } = await request(query, variables);
245
244
 
246
245
  return {
247
246
  casesPage: data.casesPage,
@@ -1,9 +1,8 @@
1
- import { gql } from "graphql-request";
2
1
  import { Category } from "../../lib/types";
3
- import client from "./client";
2
+ import { request } from "./client";
4
3
 
5
4
  export default async function getCategories(): Promise<Category[]> {
6
- const query = gql`
5
+ const query = `
7
6
  query getCategories {
8
7
  caseCategories(where: { language: EN }) {
9
8
  nodes {
@@ -16,7 +15,7 @@ export default async function getCategories(): Promise<Category[]> {
16
15
  }
17
16
  `;
18
17
 
19
- const data: { caseCategories: { nodes: Category[] } } = await client.request(
18
+ const data: { caseCategories: { nodes: Category[] } } = await request(
20
19
  query
21
20
  );
22
21
  return data.caseCategories.nodes;
@@ -1,5 +1,5 @@
1
- import { gql } from "graphql-request";
2
- import client from "./client";
1
+ import { Variables } from "../types";
2
+ import { request } from "./client";
3
3
 
4
4
  export type ContactPage = {
5
5
  title: string;
@@ -52,10 +52,12 @@ export type ContactPage = {
52
52
 
53
53
  export default async function getContactPage({
54
54
  slug,
55
+ language,
55
56
  }: {
56
57
  slug: string;
58
+ language: string;
57
59
  }): Promise<ContactPage | null> {
58
- const query = gql`
60
+ const query = `
59
61
  query GetPageBySlug($slug: ID!) {
60
62
  page(id: $slug, idType: URI) {
61
63
  title
@@ -106,7 +108,7 @@ export default async function getContactPage({
106
108
  }
107
109
  `;
108
110
 
109
- const variables = { slug: slug };
110
- const data: { page: ContactPage } = await client.request(query, variables);
111
+ const variables: Variables = { slug: slug, language };
112
+ const data: { page: ContactPage } = await request(query, variables);
111
113
  return data.page;
112
114
  }
@@ -1,6 +1,5 @@
1
- import { gql } from "graphql-request";
2
- import client from "./client";
3
- import { Hub, PostPreview } from "../types";
1
+ import { request } from "./client";
2
+ import { Hub, PostPreview, Variables } from "../types";
4
3
  import { type ContactPage } from "./getContactPage";
5
4
 
6
5
  type HomePage = {
@@ -133,7 +132,7 @@ export default async function getHomePage({
133
132
  const contactPage = language === "EN" ? "contact" : "contact-de";
134
133
  const aboutPage = language === "EN" ? "about-berlin" : "about-berlin-de";
135
134
 
136
- const query = gql`
135
+ const query = `
137
136
  query GetPageBySlug($slug: ID!) {
138
137
  page(id: $slug, idType: URI) {
139
138
  title
@@ -277,14 +276,14 @@ export default async function getHomePage({
277
276
  }
278
277
  `;
279
278
 
280
- const variables = { slug: slug };
279
+ const variables: Variables = { slug: slug, language };
281
280
  const data: {
282
281
  page: HomePage["homePage"];
283
282
  hubs: { nodes: Hub[] };
284
283
  posts: { nodes: PostPreview[] };
285
284
  contactPage: ContactPage;
286
285
  aboutPage: HomePage["aboutPage"];
287
- } = await client.request(query, variables);
286
+ } = await request(query, variables);
288
287
 
289
288
  return {
290
289
  homePage: data.page,
@@ -1,6 +1,5 @@
1
- import { gql } from "graphql-request";
2
- import { Case, Hub } from "../../lib/types";
3
- import client from "./client";
1
+ import { Case, Hub, Variables } from "../../lib/types";
2
+ import { request } from "./client";
4
3
  import { type ContactPage } from "./getContactPage";
5
4
 
6
5
  type HomePage = {
@@ -33,7 +32,7 @@ export default async function getHubBySlug({
33
32
  const homePage = language === "DE" ? "home-berlin-de" : "home-berlin";
34
33
  const contactPage = language === "DE" ? "contact-de" : "contact";
35
34
 
36
- const query = gql`
35
+ const query = `
37
36
  query GetHubBySlug($slug: ID!) {
38
37
  hub(id: $slug, idType: SLUG) {
39
38
  id
@@ -165,13 +164,13 @@ export default async function getHubBySlug({
165
164
  }
166
165
  `;
167
166
 
168
- const variables = { slug };
167
+ const variables: Variables = { slug, language };
169
168
  const data: {
170
169
  hub: Hub;
171
170
  contactPage: ContactPage;
172
171
  cases: { nodes: Case[] };
173
172
  homePage: HomePage;
174
- } = await client.request(query, variables);
173
+ } = await request(query, variables);
175
174
 
176
175
  return {
177
176
  hub: data.hub,
@@ -1,6 +1,5 @@
1
- import { gql } from "graphql-request";
2
1
  import { Hub } from "../../lib/types";
3
- import client from "./client";
2
+ import { request } from "./client";
4
3
 
5
4
  export default async function getCases(): Promise<{
6
5
  hubs: Hub[];
@@ -33,7 +32,7 @@ export default async function getCases(): Promise<{
33
32
  };
34
33
  };
35
34
  }> {
36
- const query = gql`
35
+ const query = `
37
36
  query GetHubs {
38
37
  hubs(where: { language: EN }) {
39
38
  nodes {
@@ -127,7 +126,7 @@ export default async function getCases(): Promise<{
127
126
  }>;
128
127
  };
129
128
  };
130
- } = await client.request(query);
129
+ } = await request(query);
131
130
 
132
131
  return {
133
132
  hubs: data.hubs.nodes,
@@ -1,6 +1,5 @@
1
- import { gql } from "graphql-request";
2
1
  import { Variables, Hub } from "../../lib/types";
3
- import client from "./client";
2
+ import { request } from "./client";
4
3
  import { type ContactPage } from "./getContactPage";
5
4
 
6
5
  type HomePage = {
@@ -111,7 +110,7 @@ export default async function getCasesPage(
111
110
  const whereClause =
112
111
  whereConditions.length > 0 ? `where: { ${whereConditions.join(", ")}}` : "";
113
112
 
114
- const query = gql`
113
+ const query = `
115
114
  query GetNewsPage(${variableDefinitions}) {
116
115
  hubsPage: page(id: $slug, idType: URI) {
117
116
  title
@@ -256,7 +255,7 @@ export default async function getCasesPage(
256
255
  contactPage: ContactPage;
257
256
  homePage: HomePage;
258
257
  aboutPage: AboutPage;
259
- } = await client.request(query, variables);
258
+ } = await request(query, variables);
260
259
 
261
260
  return {
262
261
  hubsPage: data.hubsPage,
@@ -1,12 +1,11 @@
1
- import { gql } from "graphql-request";
2
1
  import { Metadata, Variables } from "../../lib/types";
3
- import client from "./client";
2
+ import { request } from "./client";
4
3
 
5
4
  export default async function getMetadataBySlug(
6
5
  slug: string,
7
6
  language: string = "EN"
8
7
  ) {
9
- const query = gql`
8
+ const query = `
10
9
  query getMetadata($slug: String, $language: LanguageCodeFilterEnum) {
11
10
  pages(where: { name: $slug, language: $language }) {
12
11
  nodes {
@@ -40,7 +39,7 @@ export default async function getMetadataBySlug(
40
39
  };
41
40
 
42
41
  const data: { pages: { nodes: Metadata[] }; posts: { nodes: Metadata[] } } =
43
- await client.request(query, variables);
42
+ await request(query, variables);
44
43
  const pages = data.pages.nodes;
45
44
  const posts = data.posts.nodes;
46
45
 
@@ -1,6 +1,5 @@
1
- import { gql } from "graphql-request";
2
1
  import { Variables, Post } from "../../lib/types";
3
- import client from "./client";
2
+ import { request } from "./client";
4
3
  import { type ContactPage } from "./getContactPage";
5
4
 
6
5
  type NewsPage = {
@@ -73,7 +72,7 @@ export default async function getNewsPage(options: Params): Promise<{
73
72
  const whereClause =
74
73
  whereConditions.length > 0 ? `where: { ${whereConditions.join(", ")}}` : "";
75
74
 
76
- const query = gql`
75
+ const query = `
77
76
  query GetNewsPage(${variableDefinitions}) {
78
77
  newsPage: page(id: $slug, idType: URI) {
79
78
  title
@@ -178,7 +177,7 @@ export default async function getNewsPage(options: Params): Promise<{
178
177
  };
179
178
  };
180
179
  contactPage: ContactPage;
181
- } = await client.request(query, variables);
180
+ } = await request(query, variables);
182
181
 
183
182
  return {
184
183
  newsPage: data.newsPage,
@@ -1,15 +1,14 @@
1
- import { gql } from "graphql-request";
2
- import { Page } from "../../lib/types";
3
- import client from "./client";
1
+ import { Page, Variables } from "../../lib/types";
2
+ import { request } from "./client";
4
3
  import { ContactPage } from "./getContactPage";
5
4
 
6
5
  export default async function getPageBySlug(
7
6
  slug: string,
8
- language: string
7
+ language: string,
9
8
  ): Promise<{ page: Page; contactPage: ContactPage }> {
10
9
  const contactPage = language === "DE" ? "contact-de" : "contact";
11
10
 
12
- const query = gql`
11
+ const query = `
13
12
  query GetPageBySlug($slug: ID!) {
14
13
  page(id: $slug, idType: URI) {
15
14
  title
@@ -45,10 +44,10 @@ export default async function getPageBySlug(
45
44
  }
46
45
  `;
47
46
 
48
- const variables = { slug };
49
- const data: { page: Page; contactPage: ContactPage } = await client.request(
47
+ const variables: Variables = { slug, language };
48
+ const data: { page: Page; contactPage: ContactPage } = await request(
50
49
  query,
51
- variables
50
+ variables,
52
51
  );
53
52
  return data;
54
53
  }
@@ -1,7 +1,6 @@
1
- import { gql } from "graphql-request";
2
- import client from "./client";
1
+ import { request } from "./client";
3
2
  import { type ContactPage } from "./getContactPage";
4
- import { Person } from "../types";
3
+ import { Person, Variables } from "../types";
5
4
 
6
5
  type PeoplePage = {
7
6
  peoplePage: {
@@ -79,7 +78,7 @@ export default async function getContactPage({
79
78
  }): Promise<PeoplePage> {
80
79
  const contactPage = language === "DE" ? "contact-de" : "contact";
81
80
 
82
- const query = gql`
81
+ const query = `
83
82
  query GetPageBySlug($slug: ID!) {
84
83
  page(id: $slug, idType: URI) {
85
84
  title
@@ -157,11 +156,11 @@ export default async function getContactPage({
157
156
  }
158
157
  `;
159
158
 
160
- const variables = { slug: slug };
159
+ const variables: Variables = { slug: slug, language };
161
160
  const data: {
162
161
  page: PeoplePage["peoplePage"];
163
162
  contactPage: ContactPage;
164
- } = await client.request(query, variables);
163
+ } = await request(query, variables);
165
164
 
166
165
  return {
167
166
  peoplePage: data.page,
@@ -1,5 +1,5 @@
1
- import { gql } from "graphql-request";
2
- import client from "./client";
1
+ import { Variables } from "../types";
2
+ import { request } from "./client";
3
3
 
4
4
  type PerformancePage = {
5
5
  homePage: {
@@ -81,7 +81,7 @@ type PerformancePage = {
81
81
  };
82
82
 
83
83
  export default async function getPerformanceHubPage(): Promise<PerformancePage> {
84
- const query = gql`
84
+ const query = `
85
85
  query GetPageBySlug($slug: ID!) {
86
86
  homePage: page(id: "home-berlin", idType: URI) {
87
87
  customFieldsBerlin {
@@ -165,12 +165,12 @@ export default async function getPerformanceHubPage(): Promise<PerformancePage>
165
165
  }
166
166
  `;
167
167
 
168
- const variables = { slug: "performance-hub" };
168
+ const variables: Variables = { slug: "performance-hub", language: "EN" };
169
169
  const data: {
170
170
  homePage: PerformancePage["homePage"];
171
171
  performancePage: PerformancePage["performancePage"];
172
172
  contactPage: PerformancePage["contactPage"];
173
- } = await client.request(query, variables);
173
+ } = await request(query, variables);
174
174
 
175
175
  return {
176
176
  homePage: data.homePage,
@@ -1,6 +1,5 @@
1
- import { gql } from "graphql-request";
2
- import { Post } from "../../lib/types";
3
- import client from "./client";
1
+ import { Post, Variables } from "../../lib/types";
2
+ import { request } from "./client";
4
3
  import { ContactPage } from "./getContactPage";
5
4
 
6
5
  export default async function getPostBySlug({
@@ -15,7 +14,7 @@ export default async function getPostBySlug({
15
14
  }> {
16
15
  const contactPage = language === "DE" ? "contact-de" : "contact";
17
16
 
18
- const query = gql`
17
+ const query = `
19
18
  query GetPostBySlug($slug: ID!) {
20
19
  post(id: $slug, idType: SLUG) {
21
20
  id
@@ -132,10 +131,10 @@ export default async function getPostBySlug({
132
131
  }
133
132
  `;
134
133
 
135
- const variables = { slug };
136
- const data: { post: Post; contactPage: ContactPage } = await client.request(
134
+ const variables: Variables = { slug, language };
135
+ const data: { post: Post; contactPage: ContactPage } = await request(
137
136
  query,
138
- variables
137
+ variables,
139
138
  );
140
139
 
141
140
  return {
@@ -1,6 +1,5 @@
1
- import { gql } from "graphql-request";
2
1
  import { Post, Variables } from "../../lib/types";
3
- import client from "./client";
2
+ import { request } from "./client";
4
3
 
5
4
  interface Params {
6
5
  searchTerm?: string;
@@ -55,7 +54,7 @@ export default async function getPosts(
55
54
  const whereClause =
56
55
  whereConditions.length > 0 ? `where: { ${whereConditions.join(", ")}}` : "";
57
56
 
58
- const query = gql`
57
+ const query = `
59
58
  query GetPosts(${variableDefinitions}) {
60
59
  posts(
61
60
  ${isPrevious ? "last: $perPage" : "first: $perPage"},
@@ -116,7 +115,7 @@ export default async function getPosts(
116
115
  hasPreviousPage: boolean;
117
116
  };
118
117
  };
119
- } = await client.request(query, variables);
118
+ } = await request(query, variables);
120
119
 
121
120
  return {
122
121
  posts: data.posts.nodes,
@@ -9,7 +9,8 @@ export type NextRouter = AppRouterInstance;
9
9
  export type NextSearchParams = ReadonlyURLSearchParams;
10
10
 
11
11
  export interface Variables {
12
- perPage: number;
12
+ id?: string;
13
+ perPage?: number;
13
14
  before?: string | null;
14
15
  after?: string | null;
15
16
  search?: string;
package/lib/utils.ts CHANGED
@@ -1,29 +1,76 @@
1
- export const translate = (text: string, lang: string = "EN") => {
2
- if (lang === "EN") return text;
3
-
4
- if (text === "Get in touch") {
5
- return "Kontakt aufnehmen";
6
- }
7
-
8
- if (text === "Tell us about your brand and discover how we can help.") {
9
- return "Erzählen Sie uns von Ihrer Marke und entdecken Sie, wie wir Ihnen helfen können.";
10
- }
1
+ type Translations = Record<string, { DE?: string; EN?: string }>;
11
2
 
12
- if (text === "Success stories.\nWith proven results.") {
13
- return "Erfolgsgeschichten.\nMit messbaren Ergebnissen.";
14
- }
3
+ const strings: Translations = {
4
+ "Get in touch": {
5
+ DE: "Kontakt aufnehmen",
6
+ },
7
+ "Tell us about your brand and discover how we can help.": {
8
+ DE: "Erzählen Sie uns von Ihrer Marke und entdecken Sie, wie wir Ihnen helfen können.",
9
+ },
10
+ "Success stories.\nWith proven results.": {
11
+ DE: "Erfolgsgeschichten.\nMit messbaren Ergebnissen.",
12
+ },
13
+ Berlin: {
14
+ DE: "Berlin",
15
+ },
16
+ Zurich: {
17
+ DE: "Zürich",
18
+ },
19
+ "Service Hubs": {
20
+ DE: "Hubs",
21
+ },
22
+ "About Us": {
23
+ DE: "Über uns",
24
+ },
25
+ "Case Studies": {
26
+ DE: "Cases",
27
+ },
28
+ Contact: {
29
+ DE: "Kontakt",
30
+ },
31
+ "Contact Us": {
32
+ DE: "Kontakt",
33
+ },
34
+ "Follow Us": {
35
+ DE: "Folge uns",
36
+ },
37
+ Imprint: {
38
+ DE: "Impressum",
39
+ },
40
+ Terms: {
41
+ DE: "Terms & Conditions",
42
+ },
43
+ "Privacy policy": {
44
+ DE: "Datenschutz",
45
+ },
46
+ "Team & Careers": {
47
+ DE: "Team & Karriere",
48
+ },
49
+ "News & Insights": {
50
+ DE: "News & Insights",
51
+ },
52
+ "": {
53
+ DE: "",
54
+ },
55
+ "": {
56
+ DE: "",
57
+ },
58
+ "": {
59
+ DE: "",
60
+ },
61
+ };
15
62
 
16
- if (text === "") {
17
- return "";
18
- }
63
+ export const translate = (text: string, lang: "DE" | "EN" = "EN") => {
64
+ if (lang === "EN") return text;
19
65
 
20
- if (text === "") {
21
- return "";
22
- }
66
+ let trans: string | undefined = "";
23
67
 
24
- if (text === "") {
25
- return "";
26
- }
68
+ Object.keys(strings).forEach((key: string) => {
69
+ if (key === text) {
70
+ trans = strings[key][lang];
71
+ return;
72
+ }
73
+ });
27
74
 
28
- return text;
75
+ return trans || text;
29
76
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foundry-component-library",
3
- "version": "0.2.32",
3
+ "version": "0.2.34",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -67,7 +67,6 @@
67
67
  "@react-three/drei": "^10.7.7",
68
68
  "@react-three/fiber": "^9.4.2",
69
69
  "@react-three/postprocessing": "^3.0.4",
70
- "graphql-request": "^7.1.2",
71
70
  "three": "^0.182.0"
72
71
  }
73
72
  }