foundry-component-library 0.2.20 → 0.2.21

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.
@@ -19,8 +19,6 @@ function Menu({
19
19
  const path = usePathname();
20
20
  const currentLang = path.startsWith("/de") ? "DE" : "EN";
21
21
 
22
- console.log(path);
23
-
24
22
  const langPrefix =
25
23
  currentLang === "EN" ? "" : `/${currentLang.toLowerCase()}`;
26
24
 
@@ -6,6 +6,7 @@ import styles from "./styles.module.scss";
6
6
  import Arrow from "../../../assets/svg/arrow.svg";
7
7
  import { Case, NextImage, NextLink, NextRouter } from "../../../types";
8
8
  import Top from "../Top";
9
+ import { usePathname } from "next/navigation";
9
10
 
10
11
  function Cases({
11
12
  cases,
@@ -42,6 +43,13 @@ function Cases({
42
43
  }
43
44
 
44
45
  const [selected, setSelected] = useState(defaultValue);
46
+
47
+ const path = usePathname();
48
+ const currentLang = path.startsWith("/de") ? "DE" : "EN";
49
+
50
+ const langPrefix =
51
+ currentLang === "EN" ? "" : `/${currentLang.toLowerCase()}`;
52
+
45
53
  const services = [
46
54
  "Brand Identity",
47
55
  "Advertising & Campaigning",
@@ -84,10 +92,9 @@ function Cases({
84
92
  return (
85
93
  <div key={item.id} className={styles.case}>
86
94
  <Link
87
- href={`/cases/${
95
+ href={`${langPrefix}/cases/${
88
96
  item.status !== "draft" ? item.slug : `preview/${item.id}`
89
- }`}
90
- >
97
+ }`}>
91
98
  {thumbnailVideo && (
92
99
  <Video
93
100
  url={thumbnailVideo.mediaItemUrl}
@@ -18,7 +18,7 @@ type HomePage = {
18
18
 
19
19
  export default async function getCaseBySlug({
20
20
  slug,
21
- language,
21
+ language = "EN",
22
22
  }: {
23
23
  slug: string;
24
24
  language: string;
@@ -31,8 +31,9 @@ export default async function getCaseBySlug({
31
31
  const contactPage = language === "DE" ? "contact-de" : "contact";
32
32
 
33
33
  const query = gql`
34
- query GetCaseBySlug($slug: ID!) {
35
- case(id: $slug, idType: SLUG) {
34
+ query GetCaseBySlug($slug: String, $language: LanguageCodeFilterEnum!) {
35
+ cases(where: { name: $slug, language: $language }) {
36
+ nodes {
36
37
  id
37
38
  title
38
39
  case {
@@ -229,58 +230,61 @@ export default async function getCaseBySlug({
229
230
  }
230
231
  }
231
232
  }
232
- contactPage: page(id: "${contactPage}", idType: URI) {
233
- customFieldsContact {
234
- facebook
235
- instagram
236
- linkedin
237
- berlinImage {
238
- sourceUrl
239
- }
240
- berlinText
241
- berlinEmail
242
- berlinPhone
243
- zurichImage {
244
- sourceUrl
245
- }
246
- zurichText
247
- zurichEmail
248
- zurichPhone
249
- newyorkImage {
250
- sourceUrl
251
- }
252
- newyorkText
253
- newyorkEmail
254
- newyorkPhone
255
- contactTeaserHeading
256
- contactTeaserText
233
+ }
234
+ contactPage: page(id: "${contactPage}", idType: URI) {
235
+ customFieldsContact {
236
+ facebook
237
+ instagram
238
+ linkedin
239
+ berlinImage {
240
+ sourceUrl
241
+ }
242
+ berlinText
243
+ berlinEmail
244
+ berlinPhone
245
+ zurichImage {
246
+ sourceUrl
247
+ }
248
+ zurichText
249
+ zurichEmail
250
+ zurichPhone
251
+ newyorkImage {
252
+ sourceUrl
257
253
  }
254
+ newyorkText
255
+ newyorkEmail
256
+ newyorkPhone
257
+ contactTeaserHeading
258
+ contactTeaserText
258
259
  }
259
- homePage: page(id: "${homePage}", idType: URI) {
260
- customFieldsBerlin {
261
- awardsHeading
262
- awards {
263
- image {
264
- sourceUrl
265
- }
266
- heading
267
- text
260
+ }
261
+ homePage: page(id: "${homePage}", idType: URI) {
262
+ customFieldsBerlin {
263
+ awardsHeading
264
+ awards {
265
+ image {
266
+ sourceUrl
268
267
  }
268
+ heading
269
+ text
269
270
  }
270
271
  }
271
272
  }
272
- `;
273
+ }
274
+ `;
273
275
 
274
- const variables = { slug };
276
+ const variables = { slug, language };
275
277
  const data: {
276
- case: Case;
278
+ cases: {
279
+ nodes: Case[];
280
+ };
277
281
  contactPage: ContactPage;
278
282
  homePage: HomePage;
279
283
  } = await client.request(query, variables);
280
284
 
281
285
  return {
282
- case: data.case,
283
- contactPage: data.contactPage,
284
- homePage: data.homePage,
286
+ case: data?.cases.nodes[0],
287
+ contactPage: data?.contactPage,
288
+ homePage: data?.homePage,
285
289
  };
286
290
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foundry-component-library",
3
- "version": "0.2.20",
3
+ "version": "0.2.21",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",