Skip to content

Commit

Permalink
added all pages
Browse files Browse the repository at this point in the history
  • Loading branch information
essi1 committed Oct 12, 2022
1 parent 404092f commit fab1cf1
Show file tree
Hide file tree
Showing 12 changed files with 225 additions and 23 deletions.
2 changes: 1 addition & 1 deletion components/Navbar/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const Navbar = ({ locale }) => {
<MenuIcon />
</IconButton>
<Box sx={{ cursor: "pointer" }}>
<Link href={"/"}>
<Link href={"#"}>
<Image src={vinkLogoWhite} alt="Vink logo" height={100} width={195} />
</Link>
</Box>
Expand Down
12 changes: 5 additions & 7 deletions components/Navbar/Navbar.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@
border-radius: 5px;
}

.link:hover {
background-color: #fff;
}

.link:after {
/* .link:after {
position: absolute;
content: '';
display: block;
Expand All @@ -25,18 +28,13 @@
background-color: transparent;
}
.link:hover {
background-color: #fff;

}

.activeLink {
background-color: #fff;
}
.activeLink:after {
color: black
}
} */

.linkContainer {
display: flex;
Expand Down
26 changes: 26 additions & 0 deletions pageComponents/Educations.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import DynamicComponent from "../components/DynamicComponent/dynamicComponent";
import Head from "next/head";

const Educations = ({ locale, elements }) => {
return (
<>
<Head>
<title>{titles[locale]}</title>
</Head>
<div>
{elements?.map((element, index) => (
<DynamicComponent
key={index}
component={element?.acf_fc_layout}
props={element}
locale={locale}
/>
))}
</div>
</>
)
}

const titles = { fi: "Koulutukset", sv: "Träning", en: "Educations" }

export default Educations
26 changes: 26 additions & 0 deletions pageComponents/Events.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import DynamicComponent from "../components/DynamicComponent/dynamicComponent";
import Head from "next/head";

const Events = ({ locale, elements }) => {
return (
<>
<Head>
<title>{titles[locale]}</title>
</Head>
<div>
{elements?.map((element, index) => (
<DynamicComponent
key={index}
component={element?.acf_fc_layout}
props={element}
locale={locale}
/>
))}
</div>
</>
)
}

const titles = { fi: "Tapahtumat", sv: "Evenemang", en: "Events" }

export default Events
16 changes: 7 additions & 9 deletions pages/educations.jsx → pages/educations.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
import Layout from "../components/Layout/Layout";
import IndexPage from "../pageComponents/Index";
import Layout from "../components/Layout/Layout"
import Educations from "../pageComponents/Educations"

const Educations = ({ locale, elements }) => {
const EducationsPage = ({ elements }) => {
return (
<Layout>
<IndexPage locale={"fi"} elements={elements} />
<Educations locale={"fi"} elements={elements} />
</Layout>
)

}

export const getStaticProps = async () => {

const res = await fetch(process.env.NEXT_PUBLIC_WP_URL + "/wp-json/wp/v2/pages?slug=educations&acf_format=standard").then(r => r.json())
const elements = res[0]?.acf?.elements

console.log(elements);
return {
props: {
elements: elements
}

}

}

export default Educations

export default EducationsPage
26 changes: 26 additions & 0 deletions pages/en/educations.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import Layout from "../../components/Layout/Layout";
import Educations from "../../pageComponents/Educations";

const EducationsPage = ({ elements }) => {
return (
<Layout locale={"en"}>
<Educations locale={"en"} elements={elements} />
</Layout>
)
}

export const getStaticProps = async () => {

const res = await fetch(process.env.NEXT_PUBLIC_WP_URL + "/wp-json/wp/v2/pages?slug=educations-en&acf_format=standard").then(r => r.json())
const elements = res[0]?.acf?.elements

return {
props: {
elements: elements
}

}

}

export default EducationsPage
26 changes: 26 additions & 0 deletions pages/en/events.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import Layout from "../../components/Layout/Layout";
import Events from "../../pageComponents/Events";

const EventsPage = ({ elements }) => {
return (
<Layout locale={"en"}>
<Events locale={"en"} elements={elements} />
</Layout>
)
}

export const getStaticProps = async () => {

const res = await fetch(process.env.NEXT_PUBLIC_WP_URL + "/wp-json/wp/v2/pages?slug=events-en&acf_format=standard").then(r => r.json())
const elements = res[0]?.acf?.elements

return {
props: {
elements: elements
}

}

}

export default EventsPage
25 changes: 25 additions & 0 deletions pages/events.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Layout from "../components/Layout/Layout"
import Events from "../pageComponents/Events"

const EventsPage = ({ elements }) => {
return (
<Layout>
<Events locale={"fi"} elements={elements} />
</Layout>
)
}

export const getStaticProps = async () => {

const res = await fetch(process.env.NEXT_PUBLIC_WP_URL + "/wp-json/wp/v2/pages?slug=events&acf_format=standard").then(r => r.json())
const elements = res[0]?.acf?.elements
console.log(elements);
return {
props: {
elements: elements
}
}
}


export default EventsPage
26 changes: 26 additions & 0 deletions pages/fi/koulutukset.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import Layout from "../../components/Layout/Layout";
import Educations from "../../pageComponents/Educations";

const EducationPage = ({ elements }) => {
return (
<Layout locale={"fi"}>
<Educations locale={"fi"} elements={elements} />
</Layout>
)
}

export const getStaticProps = async () => {

const res = await fetch(process.env.NEXT_PUBLIC_WP_URL + "/wp-json/wp/v2/pages?slug=educations&acf_format=standard").then(r => r.json())
const elements = res[0]?.acf?.elements

return {
props: {
elements: elements
}

}

}

export default EducationPage
11 changes: 5 additions & 6 deletions pages/events.jsx → pages/fi/tapahtumat.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import Layout from "../components/Layout/Layout";
import IndexPage from "../pageComponents/Index";
import Link from 'next/link'
import Layout from "../../components/Layout/Layout";
import Events from "../../pageComponents/Events";

const Events = ({ locale, elements }) => {
const EventsPage = ({ elements }) => {
return (
<Layout locale={"fi"}>
<IndexPage locale={"fi"} elements={elements} />
<Events locale={"fi"} elements={elements} />
</Layout>
)
}
Expand All @@ -24,4 +23,4 @@ export const getStaticProps = async () => {

}

export default Events
export default EventsPage
26 changes: 26 additions & 0 deletions pages/sv/evenemang.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import Layout from "../../components/Layout/Layout";
import Events from "../../pageComponents/Events";

const EventsPage = ({ elements }) => {
return (
<Layout locale={"sv"}>
<Events locale={"sv"} elements={elements} />
</Layout>
)
}

export const getStaticProps = async () => {

const res = await fetch(process.env.NEXT_PUBLIC_WP_URL + "/wp-json/wp/v2/pages?slug=events-sv&acf_format=standard").then(r => r.json())
const elements = res[0]?.acf?.elements

return {
props: {
elements: elements,
}

}

}

export default EventsPage
26 changes: 26 additions & 0 deletions pages/sv/traning.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import Layout from "../../components/Layout/Layout";
import Educations from "../../pageComponents/Educations";

const EducationsPage = ({ elements }) => {
return (
<Layout locale={"sv"}>
<Educations locale={"sv"} elements={elements} />
</Layout>
)
}

export const getStaticProps = async () => {

const res = await fetch(process.env.NEXT_PUBLIC_WP_URL + "/wp-json/wp/v2/pages?slug=educations-sv&acf_format=standard").then(r => r.json())
const elements = res[0]?.acf?.elements

return {
props: {
elements: elements,
}

}

}

export default EducationsPage

0 comments on commit fab1cf1

Please sign in to comment.