Skip to content

Commit d913880

Browse files
committed
Merge branch '29-footer-links' into dev
2 parents f3985e9 + c4fb0a9 commit d913880

File tree

8 files changed

+91
-19
lines changed

8 files changed

+91
-19
lines changed

config.default.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,17 @@ ui:
3737
font_style: "normal"
3838
font_weight: 700
3939
name: "ubuntu-v20-latin-700"
40+
footer:
41+
links:
42+
- title: "Impressum"
43+
url: "https://www.hbz-nrw.de/impressum"
44+
target: "_blank"
45+
rel: "noopener noreferrer"
46+
- title: "Datenschutz"
47+
url: "https://www.hbz-nrw.de/datenschutz"
48+
target: "_blank"
49+
rel: "noopener noreferrer"
50+
- title: "© SkoHub"
51+
url: "https://skohub.io"
52+
target: "_blank"
53+
rel: "noopener noreferrer"

gatsby-config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module.exports = {
1212
colors: config.colors,
1313
logo: config.logo,
1414
fonts: config.fonts,
15+
footer: config.footer,
1516
searchableAttributes: config.searchableAttributes,
1617
customDomain: config.customDomain,
1718
failOnValidation: config.failOnValidation,

src/common.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ function loadConfig(configFile, defaultFile) {
139139
tokenizer: userConfig.tokenizer || defaults.tokenizer,
140140
colors: userConfig.ui.colors || defaults.ui.colors,
141141
fonts: userConfig.ui.fonts || defaults.ui.fonts,
142+
footer: userConfig.ui.footer || defaults.ui.footer,
142143
searchableAttributes:
143144
userConfig.searchableAttributes || defaults.searchableAttributes,
144145
customDomain: userConfig.custom_domain || "",

src/components/footer.jsx

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { getConfigAndConceptSchemes } from "../hooks/configAndConceptSchemes"
77
const Footer = () => {
88
const { config } = getConfigAndConceptSchemes()
99

10+
//console.log("CONFIG:", config)
11+
1012
const style = css`
1113
background: ${config.colors.skoHubMiddleColor};
1214
color: ${config.colors.skoHubWhite};
@@ -46,6 +48,10 @@ const Footer = () => {
4648
}
4749
}
4850
`
51+
52+
// Get links from config.yaml, if available
53+
const links = config?.footer?.links || []
54+
4955
return (
5056
<footer css={style}>
5157
<div className="footerContent">
@@ -61,25 +67,17 @@ const Footer = () => {
6167
</a>
6268
</li>
6369
)}
64-
<li className="push-right">
65-
<a
66-
href="https://www.hbz-nrw.de/impressum"
67-
target="_blank"
68-
rel="noopener noreferrer"
69-
>
70-
Impressum
71-
</a>
72-
</li>
73-
<li>
74-
&copy;{" "}
75-
<a
76-
href="https://skohub.io"
77-
target="_blank"
78-
rel="noopener noreferrer"
79-
>
80-
SkoHub
81-
</a>
82-
</li>
70+
{links.map((link, idx) => (
71+
<li key={idx} className={idx === 0 ? "push-right" : ""}>
72+
<a
73+
href={link.url}
74+
target={link.target || undefined}
75+
rel={link.rel || undefined}
76+
>
77+
{link.title}
78+
</a>
79+
</li>
80+
))}
8381
</ul>
8482
</div>
8583
</footer>

src/hooks/configAndConceptSchemes.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ export const getConfigAndConceptSchemes = () => {
7474
name
7575
}
7676
}
77+
footer {
78+
links {
79+
title
80+
url
81+
target
82+
rel
83+
}
84+
}
7785
searchableAttributes
7886
customDomain
7987
failOnValidation

test/config.test.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,28 @@ describe("Config Parsing", () => {
4141
name: "alegreya-sans-v24-latin-700",
4242
},
4343
},
44+
footer: {
45+
links: [
46+
{
47+
title: "Impressum",
48+
url: "https://www.hbz-nrw.de/impressum",
49+
target: "_blank",
50+
rel: "noopener noreferrer",
51+
},
52+
{
53+
title: "Datenschutz",
54+
url: "https://www.hbz-nrw.de/datenschutz",
55+
target: "_blank",
56+
rel: "noopener noreferrer",
57+
},
58+
{
59+
title: "© SkoHub",
60+
url: "https://skohub.io",
61+
target: "_blank",
62+
rel: "noopener noreferrer",
63+
},
64+
],
65+
},
4466
})
4567
})
4668

test/data/config/config.default.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,17 @@ ui:
3030
font_style: "normal"
3131
font_weight: 700
3232
name: "ubuntu-v20-latin-700"
33+
footer:
34+
links:
35+
- title: "Impressum"
36+
url: "https://www.hbz-nrw.de/impressum"
37+
target: "_blank"
38+
rel: "noopener noreferrer"
39+
- title: "Datenschutz"
40+
url: "https://www.hbz-nrw.de/datenschutz"
41+
target: "_blank"
42+
rel: "noopener noreferrer"
43+
- title: "© SkoHub"
44+
url: "https://skohub.io"
45+
target: "_blank"
46+
rel: "noopener noreferrer"

test/data/config/config.test.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,17 @@ ui:
2626
font_style: "normal"
2727
font_weight: 700
2828
name: "alegreya-sans-v24-latin-700"
29+
footer:
30+
links:
31+
- title: "Impressum"
32+
url: "https://www.hbz-nrw.de/impressum"
33+
target: "_blank"
34+
rel: "noopener noreferrer"
35+
- title: "Datenschutz"
36+
url: "https://www.hbz-nrw.de/datenschutz"
37+
target: "_blank"
38+
rel: "noopener noreferrer"
39+
- title: "© SkoHub"
40+
url: "https://skohub.io"
41+
target: "_blank"
42+
rel: "noopener noreferrer"

0 commit comments

Comments
 (0)