Skip to content

Commit a2e85a6

Browse files
authored
Merge pull request #16 from GTIF-Austria/update-pages-template
feat: update to pages theme package
2 parents c618867 + 1849b2e commit a2e85a6

File tree

18 files changed

+6285
-6098
lines changed

18 files changed

+6285
-6098
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
node_modules
22
dist
33
.vitepress/cache
4-
narratives
54
.DS_Store

.vitepress/components/Disclaimer.vue

Lines changed: 0 additions & 49 deletions
This file was deleted.
Lines changed: 70 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,85 @@
11
<script setup>
2-
import { data as narratives } from "../narratives.data.js";
2+
import { ref, onMounted } from "vue";
3+
import { withBase, useRouter } from "vitepress";
4+
// import { trackEvent } from "@eox/pages-theme-eox/src/helpers.js";
35
4-
const narrativesExcerpts = narratives.map((n) => {
5-
if (!import.meta.env.SSR) {
6-
const el = document.createElement("html");
7-
el.innerHTML = n.html;
8-
return (
9-
el.querySelector("h1")?.textContent ||
10-
n.url.replace("/narratives/", "").replace(".html", "")
6+
const router = useRouter();
7+
const items = ref([]);
8+
9+
const filterProps = [
10+
{
11+
keys: ["title", "subtitle", "domain", "tags"],
12+
title: "By keyword",
13+
type: "text",
14+
placeholder: "Search in title or tags",
15+
expanded: true,
16+
},
17+
{
18+
key: "domain",
19+
title: "By domain",
20+
expanded: true,
21+
},
22+
];
23+
24+
onMounted(async () => {
25+
try {
26+
const response = await fetch(
27+
"https://gtif-austria.github.io/public-narratives/narratives.json",
1128
);
29+
const results = await response.json();
30+
results.forEach((res) => {
31+
res.image =
32+
"https://gtif-austria.github.io/public-narratives/" + res.image;
33+
});
34+
items.value = results;
35+
} catch (error) {
36+
console.error("Error fetching JSON:", error);
1237
}
1338
});
39+
40+
// Click event handler
41+
const handleResultClick = (evt) => {
42+
const sections = evt.detail.file.split("/");
43+
const filename = sections[sections.length - 1].split(".")[0];
44+
// trackEvent(['narratives', 'select', filename]);
45+
router.go(withBase(`/narratives/${filename}`));
46+
};
1447
</script>
1548

1649
<template>
17-
<div class="gallery">
18-
<a
19-
v-for="(narrative, index) in narratives"
20-
class="narrative"
21-
:href="narrative.url"
50+
<client-only>
51+
<eox-itemfilter
52+
:items="items"
53+
titleProperty="title"
54+
imageProperty="cover-image"
55+
:filterProperties="filterProps"
56+
resultType="cards"
57+
@select="handleResultClick"
58+
style="--select-filter-max-items: 10"
59+
class="large-margin bottom-margin"
2260
>
23-
<img
24-
v-if="narrative?.frontmatter?.['cover-image']"
25-
:src="narrative.frontmatter['cover-image']"
26-
clas="background"
27-
/>
28-
<p>{{ narrativesExcerpts[index] }}</p>
29-
</a>
30-
</div>
61+
<h6 slot="filterstitle" class="small vertical-margin">
62+
Filter Narratives:
63+
</h6>
64+
<h6
65+
slot="resultstitle"
66+
class="large bottom-padding top-margin small-margin"
67+
>
68+
Narrative Gallery
69+
</h6>
70+
</eox-itemfilter>
71+
</client-only>
72+
73+
<div class="large-space"></div>
3174
</template>
3275

33-
<style scoped>
34-
.gallery {
35-
--columns: 1;
36-
}
37-
@media screen and (min-width: 480px) {
38-
.gallery {
39-
--columns: 2;
40-
}
76+
<style>
77+
eox-itemfilter {
78+
--form-flex-direction: row;
4179
}
42-
@media screen and (min-width: 768px) {
43-
.gallery {
44-
--columns: 3;
80+
@media (max-width: 768px) {
81+
eox-itemfilter {
82+
--form-flex-direction: column;
4583
}
4684
}
47-
.gallery {
48-
display: grid;
49-
grid-template-columns: repeat(var(--columns), 1fr);
50-
gap: 8px;
51-
margin: 64px 0;
52-
}
53-
.narrative {
54-
border-radius: 8px;
55-
border: 1px solid var(--vp-c-brand);
56-
text-decoration: none;
57-
text-align: center;
58-
transition: all 0.3s ease-in-out;
59-
overflow: hidden;
60-
display: flex;
61-
flex-direction: column;
62-
align-items: center;
63-
justify-content: center;
64-
}
65-
.narrative:hover {
66-
background: var(--vp-c-brand);
67-
color: white;
68-
}
69-
img {
70-
width: 100%;
71-
height: 200px;
72-
object-fit: cover;
73-
}
74-
p {
75-
padding: 8px 16px;
76-
}
7785
</style>

.vitepress/config.js

Lines changed: 23 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,38 @@
11
import { defineConfig } from "vitepress";
2-
// Import config from centralized repo
3-
import { config } from "https://hub-brands.eox.at/gtif-austria/config.mjs";
2+
import baseConfig from "@eox/pages-theme-eox/config";
43

54
export default defineConfig({
6-
appearance: false,
7-
// lastUpdated: true,
8-
cleanUrls: true,
9-
sitemap: {
10-
hostname: "https://gtif-austria.info",
11-
},
5+
extends: baseConfig("gtif-austria"),
6+
// Change the page config here
127
themeConfig: {
13-
siteTitle: false,
14-
primaryColor: config.theme.primary_color,
15-
logo: config.logo,
16-
externalLinkIcon: true,
178
nav: [
189
{ text: "Home", link: "/" },
1910
{ text: "Narratives", link: "/narratives", activeMatch: "/narratives/" },
2011
{ text: "Explore data", link: "/explore/" },
21-
{ text: "Log in", link: "https://dashboard.gtif-austria.gtif.eox.at" },
12+
{
13+
text: "Log in",
14+
link: "https://dashboard.gtif-austria.gtif.eox.at",
15+
action: "alt",
16+
},
2217
],
23-
footer: {
24-
message: `Powered by <img src="https://cockpit.hub.eox.at/storage/uploads/eoxhub/eoxhub_icon.svg" style="display: inline; height: 20px; transform: translateY(5px)" />`,
25-
copyright:
26-
'Copyright © 2014-present <a href="https://eox.at" target="_blank">EOX IT Services GmbH</a>',
27-
},
18+
newsBanner: `
19+
<i class="small">
20+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
21+
<path
22+
d="M13,2.03V2.05L13,4.05C17.39,4.59 20.5,8.58 19.96,12.97C19.5,16.61 16.64,19.5 13,19.93V21.93C18.5,21.38 22.5,16.5 21.95,11C21.5,6.25 17.73,2.5 13,2.03M11,2.06C9.05,2.25 7.19,3 5.67,4.26L7.1,5.74C8.22,4.84 9.57,4.26 11,4.06V2.06M4.26,5.67C3,7.19 2.25,9.04 2.05,11H4.05C4.24,9.58 4.8,8.23 5.69,7.1L4.26,5.67M2.06,13C2.26,14.96 3.03,16.81 4.27,18.33L5.69,16.9C4.81,15.77 4.24,14.42 4.06,13H2.06M7.1,18.37L5.67,19.74C7.18,21 9.04,21.79 11,22V20C9.58,19.82 8.23,19.25 7.1,18.37M16.82,15.19L12.71,11.08C13.12,10.04 12.89,8.82 12.03,7.97C11.13,7.06 9.78,6.88 8.69,7.38L10.63,9.32L9.28,10.68L7.29,8.73C6.75,9.82 7,11.17 7.88,12.08C8.74,12.94 9.96,13.16 11,12.76L15.11,16.86C15.29,17.05 15.56,17.05 15.74,16.86L16.78,15.83C17,15.65 17,15.33 16.82,15.19Z"
23+
/>
24+
</svg>
25+
</i>
26+
<span>This site is currently under development.</span>
27+
`,
2828
},
29-
transformPageData(pageData, { siteConfig }) {
30-
/**
31-
* Inject dashboard link
32-
*/
33-
const dashboardLink = pageData.frontmatter?.hero?.actions?.find(
34-
(a) => a.id === "dashboard",
35-
);
36-
if (dashboardLink) {
37-
dashboardLink.link = config.userArea.root;
38-
}
39-
/**
40-
* Inject brand logo
41-
*/
42-
const brandLogo =
43-
pageData.frontmatter?.hero?.image?.id === "logo" &&
44-
pageData.frontmatter.hero.image;
45-
if (brandLogo) {
46-
brandLogo.src = config.logo;
29+
async transformPageData(pageData) {
30+
// If page has no explicit title but has params.title set,
31+
// use that instead (e.g. for dynamic fetched routes)
32+
if (!pageData.title && pageData.params?.title) {
33+
pageData.title = pageData.params?.title;
4734
}
4835
},
49-
title: config.meta.title,
50-
description: config.meta.description,
51-
head: [["link", { rel: "icon", href: config.meta.favicon }]],
5236
vue: {
5337
template: {
5438
compilerOptions: {

.vitepress/narratives.data.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

.vitepress/theme/Layout.vue

Lines changed: 0 additions & 13 deletions
This file was deleted.

.vitepress/theme/Narrative.vue

Lines changed: 0 additions & 39 deletions
This file was deleted.

.vitepress/theme/custom.css

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,36 @@
11
@import "/fonts/poppins/poppins.css";
22

3-
body {
4-
opacity: 0;
5-
transition: opacity 0.3s ease-in-out;
6-
font-family: Poppins, sans-serif;
3+
* {
4+
font-family: Poppins, sans-serif !important;
75
}
86

9-
@media (min-width: 960px) {
10-
.main h1.name,
11-
.main p.text {
12-
font-size: 52px;
13-
}
14-
.main p.tagline {
15-
font-size: 21px;
7+
.top-nav {
8+
height: 60px;
9+
}
10+
.top-nav .logo {
11+
height: 24px;
12+
}
13+
.top-nav nav .button {
14+
color: var(--on-surface);
15+
}
16+
.top-nav .actions .button {
17+
display: inline-flex !important;
18+
}
19+
:root,
20+
:root:has(.top-nav.at-top) {
21+
--vp-nav-height: 60px !important;
22+
}
23+
24+
header {
25+
height: auto;
26+
}
27+
28+
@media (max-width: 1024px) {
29+
header {
30+
padding: 3rem 1.5rem !important;
1631
}
1732
}
33+
34+
.news-banner {
35+
top: calc(100dvh - 40px) !important;
36+
}

0 commit comments

Comments
 (0)