generated from ConductionNL/product-website-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
325 additions
and
32 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { TSendFunction } from "../apiService"; | ||
import { AxiosInstance } from "axios"; | ||
|
||
export default class FooterContent { | ||
private _instance: AxiosInstance; | ||
private _send: TSendFunction; | ||
|
||
constructor(_instance: AxiosInstance, send: TSendFunction) { | ||
this._instance = _instance; | ||
this._send = send; | ||
} | ||
|
||
public getContent = async (fileName: string): Promise<any> => { | ||
const { data } = await this._send(this._instance, "GET", fileName); | ||
|
||
return data; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import * as React from "react"; | ||
import { useQuery } from "react-query"; | ||
import APIService from "../apiService/apiService"; | ||
import APIContext from "../apiService/apiContext"; | ||
import { getFileNameFromUrl } from "../services/FileNameFromUrl"; | ||
import { DEFAULT_FOOTER_CONTENT_URL } from "../templates/templateParts/footer/FooterTemplate"; | ||
|
||
export const useFooterContent = () => { | ||
const API: APIService | null = React.useContext(APIContext); | ||
|
||
const fileName = getFileNameFromUrl( | ||
process.env.GATSBY_FOOTER_CONTENT !== undefined && process.env.GATSBY_FOOTER_CONTENT.length !== 0 | ||
? process.env.GATSBY_FOOTER_CONTENT | ||
: DEFAULT_FOOTER_CONTENT_URL, | ||
); | ||
|
||
const getContent = () => | ||
useQuery<any, Error>(["contents", fileName], () => API?.FooterContent.getContent(fileName), { | ||
onError: (error) => { | ||
console.warn(error.message); | ||
}, | ||
}); | ||
|
||
return { getContent }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export const getFileNameFromUrl = (url: string) => { | ||
const finalSlashIndex = url.lastIndexOf("/"); | ||
return url.substring(finalSlashIndex + 1); | ||
}; | ||
|
||
export const removeFileNameFromUrl = (url: string) => { | ||
const finalSlashIndex = url.lastIndexOf("/"); | ||
return url.replace(`/${url.substring(finalSlashIndex + 1)}`, ""); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[ | ||
{ | ||
"title": "Contact", | ||
"items": [ | ||
{ | ||
"ariaLabel": "Phone number", | ||
"value": "+31 (0)85 3036840", | ||
"link": "tel:+31 (0)85 3036840", | ||
"icon": { "prefix": "fas", "icon": "phone", "placement": "left" } | ||
}, | ||
{ | ||
"ariaLabel": "Email address", | ||
"value": "[email protected]", | ||
"link": "mailto:[email protected]", | ||
"icon": { "prefix": "fas", "icon": "envelope", "placement": "left" } | ||
}, | ||
{ | ||
"label": "Address", | ||
"ariaLabel": "Address", | ||
"value": "Lauriergracht 14h" | ||
} | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.