Skip to content

Commit

Permalink
Fix announcement bar
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeSCahill committed Dec 3, 2024
1 parent 6a8d3c6 commit 2ba78c1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/partials/head.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@
document.documentElement.setAttribute('data-theme', initialTheme);
document.addEventListener('DOMContentLoaded', function() {
handleBanner('announcement-bar', 'announcementClosed');
handleBanner('announcement', 'announcementClosed');
handleBanner('bloblang-banner', 'bloblangBannerDismissed');
});
// This script and the styles must be in the head to avoid flashing when the default white background changes to dark https://github.com/redpanda-data/docs-ui/pull/174
window.addEventListener('DOMContentLoaded', function() {
const switchButton = document.getElementById('switch-theme');
const announcementBar = document.querySelector('.announcement-bar');
const announcementBar = document.getElementById('announcement');
if (switchButton) {
setTheme(initialTheme); // Apply initial theme on load
switchButton.addEventListener('click', function() {
Expand All @@ -52,6 +52,7 @@
});
}
if (!announcementBar) return;
const hasSeenAnnouncement = window.sessionStorage.getItem('announcementClosed') || window.localStorage.getItem('announcementClosed') || false;
if (!hasSeenAnnouncement) {
document.documentElement.style.setProperty('--announcement-bar-height', '50px');
document.documentElement.style.setProperty('--announcement-bar-height--desktop', '30px');
Expand Down

0 comments on commit 2ba78c1

Please sign in to comment.