Skip to content
Draft
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
29 changes: 29 additions & 0 deletions assets/js/cityRotator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
(function() {
function initializeCityRotator() {
const rotatorElement = document.querySelector('.o-footer__city-rotator');
if (!rotatorElement) return;

const cities = JSON.parse(rotatorElement.getAttribute('data-cities'));
if (!cities || cities.length <= 1) return;

let currentIndex = 0;

function cycleCities() {
rotatorElement.style.opacity = '0';

setTimeout(() => {
currentIndex = (currentIndex + 1) % cities.length;
rotatorElement.textContent = cities[currentIndex];
rotatorElement.style.opacity = '1';
}, 300);
}

setInterval(cycleCities, 3000);
}

if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', initializeCityRotator);
} else {
initializeCityRotator();
}
})();
1 change: 1 addition & 0 deletions assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ import './resizeObserver.js';
import './mediaqueries.js';
import './highlightHeadline.js';
import './anchorlinks.js';
import './cityRotator.js';
6 changes: 6 additions & 0 deletions assets/sass/footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,9 @@
justify-content: space-between;
flex-wrap: wrap;
}

.o-footer__city-rotator {
display: inline-block;
transition: opacity 0.3s ease;
min-width: 1ch;
}
6 changes: 5 additions & 1 deletion i18n/de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ countryselection: Länderauswahl
editPage: Seite bearbeiten
footer-love:
aria-label: Made with love in Frankfurt & Köln
text: Made with ♥️ in Frankfurt & Köln
cities:
'0': Frankfurt
'1': Köln
'2': Aachen
text: Made with ♥️ in
general: Übergreifendes
highlight:
important: Wichtige Information
Expand Down
6 changes: 5 additions & 1 deletion i18n/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ countryselection: choose country
editPage: Edit page
footer-love:
aria-label: Made with love in Frankfurt & Cologne
text: Made with ♥️ in Frankfurt & Cologne
cities:
'0': Frankfurt
'1': Cologne
'2': Aachen
text: Made with ♥️ in
general: general
highlight:
important: Important Information
Expand Down
12 changes: 12 additions & 0 deletions layouts/partials/footer-love.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{ $cities := slice }}
{{ $i := 0 }}
{{ range seq 10 }}
{{ $city := T (printf "footer-love.cities.%d" $i) }}
{{ if ne $city "" }}
{{ $cities = $cities | append $city }}
{{ end }}
{{ $i = add $i 1 }}
{{ end }}
<div aria-label='{{ T "footer-love.aria-label"}}'>
{{ T "footer-love.text"}} <span class="o-footer__city-rotator" data-cities='{{ $cities | jsonify }}'>{{ index $cities 0 }}</span>
</div>
6 changes: 2 additions & 4 deletions layouts/partials/footer.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<div class="o-footer o-container">
<div class="o-footer__firstline">
<div class="col-12 col-lg-6" aria-label='{{ T "footer-love.aria-label"}}'>
{{ T "footer-love.text"}}
</div>
<div class="col-12 col-lg-6 o-footer__links">
{{ partial "footer-love" . }}
<div class="o-footer__links">
{{ $contactPage := site.GetPage "contact" }}
{{ if $contactPage }}
<a class="o-footer__link" href="{{ $contactPage.RelPermalink }}">{{ $contactPage.Title }}</a>
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/teaser.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{{ $dateMachine := $page.Date | time.Format "2006-01-02T15:04:05-07:00" }}
{{ $dateHuman := $page.Date | time.Format ":date_long" }}
<div class="m-teaser{{ if $listview }} m-teaser--listview{{ else }} col-lg-4 col-md-6{{ end }} col-12">
<div class="m-teaser{{ if $listview }} m-teaser--listview{{ end }}">
<a href="{{ $page.RelPermalink }}" class="m-teaser__wrapper">
{{ $image := (partial "helper/contentImage" $page ) }}
{{ if $image }}
Expand Down
Loading