From a4221b487dbf448809f59298a6695e662a39ed2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Saugat=20Pachhai=20=28=E0=A4=B8=E0=A5=8C=E0=A4=97=E0=A4=BE?= =?UTF-8?q?=E0=A4=A4=29?= Date: Thu, 3 Sep 2026 17:19:45 +0545 Subject: [PATCH 1/3] feat: add dismissible webinar announcement Replace the scrolling header prompt with a fixed webinar announcement that stays aligned with the documentation navigation at every viewport size. Persist dismissals and restore them before hydration so direct fragment loads do not briefly show the announcement again. Fixes: https://github.com/treeverse/dvc.org/issues/5586 --- gatsby-ssr.js | 22 ++++ package.json | 1 - .../Documentation/Layout/styles.module.css | 5 +- .../Markdown/Tooltip/DesktopView/index.tsx | 2 +- .../Documentation/RightPanel/index.tsx | 28 ++--- .../RightPanel/styles.module.css | 4 +- src/components/LayoutHeader/Alert/content.tsx | 23 ++-- .../LayoutHeader/Alert/index.test.tsx | 33 ++++++ src/components/LayoutHeader/Alert/index.tsx | 48 ++++---- .../LayoutHeader/Alert/state.test.ts | 42 +++++++ src/components/LayoutHeader/Alert/state.ts | 12 ++ .../LayoutHeader/Alert/styles.module.css | 112 +++++++++++++++++- .../LayoutHeader/Nav/styles.module.css | 11 +- src/components/LayoutHeader/index.tsx | 32 ++--- src/components/LayoutHeader/styles.module.css | 31 +++-- src/components/MainLayout/index.tsx | 20 +--- src/gatsby/common.js | 7 +- src/templates/doc.tsx | 5 +- yarn.lock | 14 --- 19 files changed, 314 insertions(+), 138 deletions(-) create mode 100644 src/components/LayoutHeader/Alert/index.test.tsx create mode 100644 src/components/LayoutHeader/Alert/state.test.ts create mode 100644 src/components/LayoutHeader/Alert/state.ts diff --git a/gatsby-ssr.js b/gatsby-ssr.js index b38a8da620..73c48d08ea 100644 --- a/gatsby-ssr.js +++ b/gatsby-ssr.js @@ -1,4 +1,20 @@ import { wrapPageElement } from './gatsby-shared' +import { + ALERT_DISMISSED_ATTRIBUTE, + ALERT_DISMISSED_STORAGE_KEY +} from './src/components/LayoutHeader/Alert/state' + +const alertInitScript = ` +try { + if (localStorage.getItem(${JSON.stringify( + ALERT_DISMISSED_STORAGE_KEY + )}) === 'true') { + document.body.setAttribute(${JSON.stringify( + ALERT_DISMISSED_ATTRIBUTE + )}, ''); + } +} catch(e) {} +` const themeInitScript = ` void function() { @@ -67,6 +83,12 @@ export const onRenderBody = ({ setHeadComponents, setPreBodyComponents }) => { )) ) setPreBodyComponents([ +