-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
3b00dbc
commit 31b89bf
Showing
22 changed files
with
443 additions
and
371 deletions.
There are no files selected for viewing
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { FC } from "react"; | ||
import { Carousel } from "./Carousel"; | ||
import { BlurImage } from "dak-components"; | ||
|
||
interface CarouselComponentProps { | ||
item: string; | ||
objectFit?: string; | ||
layout?: string; | ||
height?: number; | ||
width?: number; | ||
} | ||
|
||
const CarouselComponent: FC<CarouselComponentProps> = ({ | ||
item, | ||
objectFit, | ||
layout, | ||
height, | ||
width, | ||
}) => { | ||
return ( | ||
<div className="container"> | ||
<BlurImage | ||
className="carousel-image" | ||
fadeIn | ||
image={item} | ||
objectFit={objectFit || "contain"} | ||
width={!layout ? 500 : width} | ||
height={!layout ? 350 : height} | ||
layout={layout || "responsive"} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
interface GallerySectionProps { | ||
gallery: { directus_files_id: string }[]; | ||
objectFit?: string; | ||
layout?: string; | ||
width?: number; | ||
height?: number; | ||
} | ||
|
||
const GallerySection: FC<GallerySectionProps> = ({ | ||
gallery, | ||
objectFit, | ||
layout, | ||
width, | ||
height, | ||
}) => { | ||
const images = gallery | ||
?.filter((x) => x.directus_files_id) | ||
?.map((x) => x.directus_files_id); | ||
if (images.length === 1) { | ||
return ( | ||
<CarouselComponent | ||
layout={layout} | ||
width={width} | ||
height={height} | ||
objectFit={objectFit} | ||
item={images[0]} | ||
/> | ||
); | ||
} | ||
|
||
return ( | ||
<Carousel | ||
carouselItems={gallery | ||
?.filter((x) => x.directus_files_id) | ||
?.map((x) => x.directus_files_id)} | ||
component={CarouselComponent} | ||
/> | ||
); | ||
}; | ||
|
||
export default GallerySection; |
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import Snippet from "./Snippet"; | ||
|
||
interface SnippetSectionProps { | ||
title: string; | ||
code: string; | ||
} | ||
|
||
const SnippetSection: React.FC<SnippetSectionProps> = ({ title, code }) => { | ||
return <Snippet snippet={{ title, code }} />; | ||
}; | ||
|
||
export default SnippetSection; |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { ExternalContent } from "dak-components"; | ||
|
||
interface TextSectionProps { | ||
text: string; | ||
} | ||
|
||
const TextSection: React.FC<TextSectionProps> = ({ text }) => { | ||
return <ExternalContent html={text} />; | ||
}; | ||
|
||
export default TextSection; |
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Custom404 } from "dak-components"; | ||
import fetchLayoutData from "dak-components/lib/cms/layout"; | ||
import { getTranslationsData } from "dak-components/lib/components/TranslatedField"; | ||
import { GetStaticProps } from "next"; | ||
|
||
export const getStaticProps: GetStaticProps = async (context) => { | ||
const layout = await fetchLayoutData(context.locale); | ||
|
||
return { | ||
props: { | ||
translations: await getTranslationsData(context.locale, [ | ||
"go-back", | ||
"404-title", | ||
"404-subtitle", | ||
"404-text", | ||
]), | ||
layout: layout, | ||
}, | ||
revalidate: 60 * 60 * 4, // Hver 4. time | ||
}; | ||
}; | ||
|
||
export default Custom404; |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import fetchLayoutData from "dak-components/lib/cms/layout"; | ||
import queryAllPageSlugs, { | ||
queryPageBySlug, | ||
} from "dak-components/lib/cms/queries/page"; | ||
import { getTranslationsData } from "dak-components/lib/components/TranslatedField"; | ||
import Page from "../components/Page"; | ||
import { GetStaticPaths, GetStaticProps } from "next"; | ||
|
||
export const getStaticPaths: GetStaticPaths = async () => { | ||
const slugs = await queryAllPageSlugs(); | ||
const paths = slugs.map((x) => ({ params: { id: x.slug } })); | ||
|
||
return { | ||
paths, | ||
fallback: "blocking", | ||
}; | ||
}; | ||
|
||
export const getStaticProps: GetStaticProps = async ({ locale, params }) => { | ||
const layout = await fetchLayoutData(locale); | ||
let page = await queryPageBySlug(locale, params.id); | ||
|
||
if (!page) { | ||
return { | ||
props: {}, | ||
notFound: true, | ||
revalidate: 1, | ||
}; | ||
} | ||
|
||
page = { ...page, ...page.translations[0] }; | ||
|
||
return { | ||
props: { | ||
translations: await getTranslationsData(locale, []), | ||
layout: layout, | ||
data: page, | ||
}, | ||
revalidate: 60 * 60, // Every hour | ||
}; | ||
}; | ||
|
||
export default Page; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.