Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: setup base templates #4

Merged
merged 14 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ dist-ssr
*.njsproj
*.sln
*.sw?

+.css
20 changes: 20 additions & 0 deletions public/assets/odk-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions src/js/darkmode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
function updateDarkmodeIcons() {
const isDarkmode = document.documentElement.hasAttribute('data-bs-theme')

document.querySelectorAll('[toggle-dark-mode] i').forEach((icon) => {
const remove = isDarkmode ? 'bi-moon-fill' : 'bi-sun-fill'
const add = isDarkmode ? 'bi-sun-fill' : 'bi-moon-fill'

icon.classList.remove(remove)
icon.classList.add(add)
})
}

function removeDarkmode() {
document.documentElement.removeAttribute('data-bs-theme')
localStorage.removeItem('theme')
updateDarkmodeIcons()
}

function setDarkmode() {
document.documentElement.setAttribute('data-bs-theme', 'dark')
localStorage.setItem('theme', 'dark')
updateDarkmodeIcons()
}

function toggleDarkmode() {
if (document.documentElement.hasAttribute('data-bs-theme')) {
removeDarkmode()
} else {
setDarkmode()
}
}

function loadTheme() {
const theme = localStorage.getItem('theme')

if (theme) {
setDarkmode()
} else {
removeDarkmode()
}
}

document.addEventListener('DOMContentLoaded', () => {
updateDarkmodeIcons()
document.querySelectorAll('[toggle-dark-mode]').forEach((button) => {
button.addEventListener('click', toggleDarkmode)
})
})

loadTheme()
2 changes: 2 additions & 0 deletions src/js/scripts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import 'bootstrap'
import './darkmode.js'
19 changes: 15 additions & 4 deletions src/layouts/base.twig
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
<!doctype html>
<html lang='de'>
<head>
<title>Stadt Koeln - Open Data</title>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<title>Offene Daten Köln</title>

<link rel='stylesheet' href='/src/styles/styles.scss'>
{% set theme = theme is defined ? theme : 'light' %}
{#
https://github.com/twbs/icons/issues/1381
Due to an issue of vite compiler, the bootstrap-icons needs to be directly imported
using the cdn url.
#}
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css'>

{% set theme = theme is defined ? theme : 'default' %}
<link rel='stylesheet' href='/src/styles/themes/{{ theme }}.css'>

<script type='module' src='/src/js/scripts.js' defer></script>
</head>
<body class='min-vh-100 d-flex flex-column'>
{% include 'partials::header.twig' %}
{% include 'partials::base/b_header.twig' %}

<main class='container flex-grow-1'>
{% block content %}{% endblock %}
</main>

{% include 'partials::footer.twig' %}
{% include 'partials::base/b_footer.twig' %}
</body>
</html>
158 changes: 158 additions & 0 deletions src/pages/apps.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
{% extends 'layouts::base.twig' %}
{% set theme = 'default' %}

{% block content %}
<nav aria-label='breadcrumb'>
<ol class='breadcrumb'>
<li class='breadcrumb-item'><a href='./'>Startseite</a></li>
<li class='breadcrumb-item active' aria-current='page'>Apps</li>
</ol>
</nav>

<section class='row py-4'>
<div class='col-8'>
<h1 class='mb-3'>Apps und Anwendungsbeispiele</h1>
<p>
Lorem ipsum Einleitungstext zum Thema Apps, der kurz beschreibt, wie und warum man offene Daten nutzt und der
Öffentlichkeit zum Ausprobieren zur Verfügung stellt.
</p>
</div>
</section>

<section class='row pb-5'>
<article class='col-12 mb-5'>
<div class='row'>
<div class='col-12 '>
<div class='ratio ratio-21x9 mb-3'>
<img src='https://picsum.photos/960/540' alt='Virtual Identity AG'>
</div>
</div>
<div class='col-10'>
<h2 class='h3'>App name lorem</h2>
<p>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et
dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet
clita kasd gubergren, no sea takimata sanctus.
</p>
</div>
<div class='col-12 d-flex justify-content-end'>
{%
include 'partials::icon-link.twig' with {
href: '#',
text: 'Zur Anwendung',
icon: 'chevron-right'
}
%}
</div>
</div>
</article>
<article class='col-6 mb-5'>
<div class='row'>
<div class='col-12 '>
<div class='ratio ratio-21x9 mb-3'>
<img src='https://picsum.photos/960/540' alt='Virtual Identity AG'>
</div>
</div>
<div class='col-10'>
<div class='d-flex gap-3 align-items-center mb-2'>
<h2 class='h3 m-0'>App name lorem</h2>
<span class='badge text-bg-danger text-uppercase'>NOT AVAILABLE</span>
</div>

<p>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et
dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet
clita kasd gubergren, no sea takimata sanctus.
</p>
</div>
<div class='col-12 d-flex justify-content-end'>
{%
include 'partials::icon-link.twig' with {
href: '#',
text: 'Zur Anwendung',
icon: 'chevron-right'
}
%}
</div>
</div>
</article>
<article class='col-6 mb-5'>
<div class='row'>
<div class='col-12 '>
<div class='ratio ratio-21x9 mb-3'>
<img src='https://picsum.photos/960/540' alt='Virtual Identity AG'>
</div>
</div>
<div class='col-10'>
<h2 class='h3'>App name lorem</h2>
<p>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et
dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet
clita kasd gubergren, no sea takimata sanctus.
</p>
</div>
<div class='col-12 d-flex justify-content-end'>
{%
include 'partials::icon-link.twig' with {
href: '#',
text: 'Zur Anwendung',
icon: 'chevron-right'
}
%}
</div>
</div>
</article>
<article class='col-6 mb-5'>
<div class='row'>
<div class='col-12 '>
<div class='ratio ratio-21x9 mb-3'>
<img src='https://picsum.photos/960/540' alt='Virtual Identity AG'>
</div>
</div>
<div class='col-10'>
<h2 class='h3'>App name lorem</h2>
<p>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et
dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet
clita kasd gubergren, no sea takimata sanctus.
</p>
</div>
<div class='col-12 d-flex justify-content-end'>
{%
include 'partials::icon-link.twig' with {
href: '#',
text: 'Zur Anwendung',
icon: 'chevron-right'
}
%}
</div>
</div>
</article>
<article class='col-6 mb-5'>
<div class='row'>
<div class='col-12 '>
<div class='ratio ratio-21x9 mb-3'>
<img src='https://picsum.photos/960/540' alt='Virtual Identity AG'>
</div>
</div>
<div class='col-10'>
<h2 class='h3'>App name lorem</h2>
<p>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et
dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet
clita kasd gubergren, no sea takimata sanctus.
</p>
</div>
<div class='col-12 d-flex justify-content-end'>
{%
include 'partials::icon-link.twig' with {
href: '#',
text: 'Zur Anwendung',
icon: 'chevron-right'
}
%}
</div>
</div>
</article>
</section>
{% endblock %}
7 changes: 0 additions & 7 deletions src/pages/dark.twig

This file was deleted.

Loading
Loading