foundry-component-library 0.2.33 → 0.2.35

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.
@@ -8,7 +8,9 @@ import useDrag from "../../hooks/useDrag";
8
8
 
9
9
  const Tiles = ({
10
10
  tiles,
11
+ heading,
11
12
  }: {
13
+ heading: string;
12
14
  tiles: {
13
15
  heading?: string;
14
16
  hoverText?: string;
@@ -22,10 +24,7 @@ const Tiles = ({
22
24
 
23
25
  return (
24
26
  <Container>
25
- <TextSection
26
- caption="team & careers"
27
- heading="Agile global experts who would love to collaborate with you."
28
- />
27
+ <TextSection caption="team & careers" heading={heading} />
29
28
  <div
30
29
  ref={sectionRef}
31
30
  className={styles.tiles}
@@ -33,8 +32,7 @@ const Tiles = ({
33
32
  onMouseMove={handleMouseMove}
34
33
  onMouseUp={handleMouseUp}
35
34
  onMouseLeave={handleMouseUp}
36
- style={dragStyle as React.CSSProperties}
37
- >
35
+ style={dragStyle as React.CSSProperties}>
38
36
  {tiles.map((tile, i) => {
39
37
  let background: "pink" | "yellow" | "brown" = "pink";
40
38
  if (i % 3 === 1) background = "yellow";
@@ -1,3 +1,5 @@
1
+ import { Variables } from "../types";
2
+
1
3
  const baseUrl = process.env.WORDPRESS_URL || "https://data.foundry.ch";
2
4
 
3
5
  const headers: Record<string, string> = {
@@ -13,7 +15,7 @@ if (process.env.WP_PREVIEW_USER && process.env.WP_PREVIEW_PASS) {
13
15
 
14
16
  export async function request<T>(
15
17
  query: string,
16
- variables?: Record<string, unknown>,
18
+ variables?: Variables,
17
19
  ): Promise<T> {
18
20
  const response = await fetch(`${baseUrl}/graphql`, {
19
21
  method: "POST",
@@ -1,3 +1,4 @@
1
+ import { Variables } from "../types";
1
2
  import { request } from "./client";
2
3
 
3
4
  type AboutPage = {
@@ -201,9 +202,7 @@ export default async function getAboutPage({
201
202
  }
202
203
  `;
203
204
 
204
- const variables = { slug: slug };
205
-
206
- console.time("graphql");
205
+ const variables: Variables = { slug: slug, language: language };
207
206
 
208
207
  const data: {
209
208
  aboutPage: AboutPage["aboutPage"];
@@ -211,8 +210,6 @@ export default async function getAboutPage({
211
210
  contactPage: AboutPage["contactPage"];
212
211
  } = await request(query, variables);
213
212
 
214
- console.timeEnd("graphql");
215
-
216
213
  return {
217
214
  aboutPage: data.aboutPage,
218
215
  homePage: data.homePage,
@@ -1,4 +1,4 @@
1
- import { Page } from "../../lib/types";
1
+ import { Page, Variables } from "../../lib/types";
2
2
  import { request } from "./client";
3
3
 
4
4
  export default async function getBrands(): Promise<
@@ -19,7 +19,7 @@ export default async function getBrands(): Promise<
19
19
  }
20
20
  `;
21
21
 
22
- const variables = { slug: "home", language: "EN" };
22
+ const variables: Variables = { slug: "home", language: "EN" };
23
23
  const data: { page: Page } = await request(query, variables);
24
24
  return data.page.customFields.brands;
25
25
  }
@@ -1,4 +1,4 @@
1
- import { Case } from "../../lib/types";
1
+ import { Case, Variables } from "../../lib/types";
2
2
  import { request } from "./client";
3
3
  import { type ContactPage } from "./getContactPage";
4
4
 
@@ -271,7 +271,7 @@ export default async function getCaseBySlug({
271
271
  }
272
272
  `;
273
273
 
274
- const variables = { id };
274
+ const variables: Variables = { id, language };
275
275
  const data: {
276
276
  case: Case;
277
277
  contactPage: ContactPage;
@@ -1,4 +1,4 @@
1
- import { Case } from "../../lib/types";
1
+ import { Case, Variables } from "../../lib/types";
2
2
  import { request } from "./client";
3
3
  import { type ContactPage } from "./getContactPage";
4
4
 
@@ -272,7 +272,7 @@ export default async function getCaseBySlug({
272
272
  }
273
273
  `;
274
274
 
275
- const variables = { slug, language };
275
+ const variables: Variables = { slug, language };
276
276
  const data: {
277
277
  cases: {
278
278
  nodes: Case[];
@@ -1,3 +1,4 @@
1
+ import { Variables } from "../types";
1
2
  import { request } from "./client";
2
3
 
3
4
  export type ContactPage = {
@@ -51,8 +52,10 @@ export type ContactPage = {
51
52
 
52
53
  export default async function getContactPage({
53
54
  slug,
55
+ language,
54
56
  }: {
55
57
  slug: string;
58
+ language: string;
56
59
  }): Promise<ContactPage | null> {
57
60
  const query = `
58
61
  query GetPageBySlug($slug: ID!) {
@@ -105,7 +108,7 @@ export default async function getContactPage({
105
108
  }
106
109
  `;
107
110
 
108
- const variables = { slug: slug };
111
+ const variables: Variables = { slug: slug, language };
109
112
  const data: { page: ContactPage } = await request(query, variables);
110
113
  return data.page;
111
114
  }
@@ -1,5 +1,5 @@
1
1
  import { request } from "./client";
2
- import { Hub, PostPreview } from "../types";
2
+ import { Hub, PostPreview, Variables } from "../types";
3
3
  import { type ContactPage } from "./getContactPage";
4
4
 
5
5
  type HomePage = {
@@ -276,7 +276,7 @@ export default async function getHomePage({
276
276
  }
277
277
  `;
278
278
 
279
- const variables = { slug: slug };
279
+ const variables: Variables = { slug: slug, language };
280
280
  const data: {
281
281
  page: HomePage["homePage"];
282
282
  hubs: { nodes: Hub[] };
@@ -1,4 +1,4 @@
1
- import { Case, Hub } from "../../lib/types";
1
+ import { Case, Hub, Variables } from "../../lib/types";
2
2
  import { request } from "./client";
3
3
  import { type ContactPage } from "./getContactPage";
4
4
 
@@ -164,7 +164,7 @@ export default async function getHubBySlug({
164
164
  }
165
165
  `;
166
166
 
167
- const variables = { slug };
167
+ const variables: Variables = { slug, language };
168
168
  const data: {
169
169
  hub: Hub;
170
170
  contactPage: ContactPage;
@@ -1,10 +1,10 @@
1
- import { Page } from "../../lib/types";
1
+ import { Page, Variables } from "../../lib/types";
2
2
  import { request } from "./client";
3
3
  import { ContactPage } from "./getContactPage";
4
4
 
5
5
  export default async function getPageBySlug(
6
6
  slug: string,
7
- language: string
7
+ language: string,
8
8
  ): Promise<{ page: Page; contactPage: ContactPage }> {
9
9
  const contactPage = language === "DE" ? "contact-de" : "contact";
10
10
 
@@ -44,10 +44,10 @@ export default async function getPageBySlug(
44
44
  }
45
45
  `;
46
46
 
47
- const variables = { slug };
47
+ const variables: Variables = { slug, language };
48
48
  const data: { page: Page; contactPage: ContactPage } = await request(
49
49
  query,
50
- variables
50
+ variables,
51
51
  );
52
52
  return data;
53
53
  }
@@ -1,6 +1,6 @@
1
1
  import { request } from "./client";
2
2
  import { type ContactPage } from "./getContactPage";
3
- import { Person } from "../types";
3
+ import { Person, Variables } from "../types";
4
4
 
5
5
  type PeoplePage = {
6
6
  peoplePage: {
@@ -156,7 +156,7 @@ export default async function getContactPage({
156
156
  }
157
157
  `;
158
158
 
159
- const variables = { slug: slug };
159
+ const variables: Variables = { slug: slug, language };
160
160
  const data: {
161
161
  page: PeoplePage["peoplePage"];
162
162
  contactPage: ContactPage;
@@ -1,3 +1,4 @@
1
+ import { Variables } from "../types";
1
2
  import { request } from "./client";
2
3
 
3
4
  type PerformancePage = {
@@ -164,7 +165,7 @@ export default async function getPerformanceHubPage(): Promise<PerformancePage>
164
165
  }
165
166
  `;
166
167
 
167
- const variables = { slug: "performance-hub" };
168
+ const variables: Variables = { slug: "performance-hub", language: "EN" };
168
169
  const data: {
169
170
  homePage: PerformancePage["homePage"];
170
171
  performancePage: PerformancePage["performancePage"];
@@ -1,4 +1,4 @@
1
- import { Post } from "../../lib/types";
1
+ import { Post, Variables } from "../../lib/types";
2
2
  import { request } from "./client";
3
3
  import { ContactPage } from "./getContactPage";
4
4
 
@@ -131,10 +131,10 @@ export default async function getPostBySlug({
131
131
  }
132
132
  `;
133
133
 
134
- const variables = { slug };
134
+ const variables: Variables = { slug, language };
135
135
  const data: { post: Post; contactPage: ContactPage } = await request(
136
136
  query,
137
- variables
137
+ variables,
138
138
  );
139
139
 
140
140
  return {
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foundry-component-library",
3
- "version": "0.2.33",
3
+ "version": "0.2.35",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",