-
Notifications
You must be signed in to change notification settings - Fork 12
docs: apply DoubleZero branding to whole documentation #196
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
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
67f17d7
Apply DoubleZero brand identity to the docs theme.
Jotatavo bb38f67
Polish DoubleZero docs chrome and mobile language UX.
Jotatavo 2754558
Fix CI: drop navigation.instant (incompatible with i18n strict builds).
Jotatavo b69288a
Restore navigation.instant with path-aware language switching.
Jotatavo cfed636
Use the doublezero.xyz favicon for the docs site.
Jotatavo d3b0e1e
chore: auto-translate docs
github-actions[bot] 804e53d
Address PR review: instant-nav theme toggle, light-mode toolbar, i18n…
Jotatavo cbb61f5
chore: auto-translate docs
github-actions[bot] 22c6352
Address remaining PR nits: orphan assets, favicon, deep-link locales.
Jotatavo b9f0c9b
chore: auto-translate docs
github-actions[bot] 97a5354
chore: empty commit to trigger push-event CI (vercel preview)
Jared-dz cb08783
chore: auto-translate docs
github-actions[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,147 @@ | ||
| // Keep theme palette in the header (instant nav replaces the drawer container). | ||
| // On mobile, a drawer button clicks the header toggle instead of relocating the form. | ||
| (function () { | ||
| 'use strict'; | ||
|
|
||
| var MOBILE_MQ = '(max-width: 40em)'; | ||
|
|
||
| function syncPaletteIcon(form) { | ||
| if (!form) { | ||
| form = document.querySelector('[data-md-component="palette"]'); | ||
| } | ||
| if (!form) return; | ||
|
|
||
| // Compact theme button owns the visible UI — keep Material labels hidden. | ||
| if (form.querySelector('.dz2-theme-btn') || form.querySelector('.dz2-mode-switch')) { | ||
| var allLabels = form.querySelectorAll('label.md-header__button'); | ||
| for (var k = 0; k < allLabels.length; k++) { | ||
| allLabels[k].setAttribute('hidden', ''); | ||
| } | ||
| return; | ||
| } | ||
|
|
||
| var inputs = form.querySelectorAll('.md-option'); | ||
| if (!inputs.length) return; | ||
|
|
||
| var checked = form.querySelector('.md-option:checked'); | ||
| if (!checked) { | ||
| var scheme = document.body.getAttribute('data-md-color-scheme') || 'slate'; | ||
| for (var i = 0; i < inputs.length; i++) { | ||
| if (inputs[i].getAttribute('data-md-color-scheme') === scheme) { | ||
| checked = inputs[i]; | ||
| inputs[i].checked = true; | ||
| break; | ||
| } | ||
| } | ||
| if (!checked) { | ||
| checked = inputs[0]; | ||
| checked.checked = true; | ||
| } | ||
| } | ||
|
|
||
| for (var j = 0; j < inputs.length; j++) { | ||
| var input = inputs[j]; | ||
| var label = input.nextElementSibling; | ||
| while (label && label.tagName !== 'LABEL') { | ||
| label = label.nextElementSibling; | ||
| } | ||
| if (!label) continue; | ||
| var shouldHide = input !== checked; | ||
| var isHidden = label.hasAttribute('hidden'); | ||
| if (shouldHide && !isHidden) { | ||
| label.setAttribute('hidden', ''); | ||
| } else if (!shouldHide && isHidden) { | ||
| label.removeAttribute('hidden'); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| function placePalette() { | ||
| var palette = document.querySelector('[data-md-component="palette"]'); | ||
| var header = document.querySelector('.md-header__inner'); | ||
| if (!palette || !header) return; | ||
| // Always keep the form in the header so instant navigation cannot destroy it. | ||
| if (palette.parentElement !== header || header.lastElementChild !== palette) { | ||
| header.appendChild(palette); | ||
| } | ||
| } | ||
|
|
||
| function syncDrawerThemeBtn() { | ||
| var drawerBtn = document.getElementById('drawer-theme-btn'); | ||
| var real = document.querySelector('.dz2-theme-btn'); | ||
| if (!drawerBtn || !real) return; | ||
| drawerBtn.setAttribute('aria-label', real.getAttribute('aria-label') || 'Toggle theme'); | ||
| drawerBtn.setAttribute('data-next-mode', real.getAttribute('data-next-mode') || ''); | ||
| var icon = real.querySelector('svg'); | ||
| if (icon) { | ||
| drawerBtn.innerHTML = icon.outerHTML; | ||
| } | ||
| } | ||
|
|
||
| function refresh() { | ||
| placePalette(); | ||
| syncPaletteIcon(); | ||
| syncDrawerThemeBtn(); | ||
| } | ||
|
|
||
| function boot() { | ||
| refresh(); | ||
| var form = document.querySelector('[data-md-component="palette"]'); | ||
| if (form && !form.dataset.paletteSyncBound) { | ||
| form.dataset.paletteSyncBound = '1'; | ||
| form.addEventListener('change', function () { | ||
| syncPaletteIcon(form); | ||
| syncDrawerThemeBtn(); | ||
| }); | ||
| } | ||
|
|
||
| if (!window.__dzPaletteMqBound) { | ||
| window.__dzPaletteMqBound = true; | ||
| window.matchMedia(MOBILE_MQ).addEventListener('change', refresh); | ||
|
|
||
| // Opening search from the drawer should close the drawer first | ||
| document.addEventListener('click', function (event) { | ||
| var trigger = event.target.closest && event.target.closest('label[for="__search"]'); | ||
| if (!trigger || !trigger.closest('.mobile-drawer-controls')) return; | ||
| var drawer = document.getElementById('__drawer'); | ||
| if (drawer) drawer.checked = false; | ||
| }); | ||
|
|
||
| // Drawer theme control proxies the header toggle (form stays in header). | ||
| document.addEventListener('click', function (event) { | ||
| var drawerBtn = event.target.closest && event.target.closest('#drawer-theme-btn'); | ||
| if (!drawerBtn) return; | ||
| event.preventDefault(); | ||
| var real = document.querySelector('.dz2-theme-btn'); | ||
| if (real) real.click(); | ||
| }); | ||
| } | ||
|
|
||
| var header = document.querySelector('.md-header'); | ||
| if (header && !header.dataset.paletteOrderBound) { | ||
| header.dataset.paletteOrderBound = '1'; | ||
| new MutationObserver(function () { | ||
| refresh(); | ||
| }).observe(header, { childList: true, subtree: true }); | ||
| } | ||
|
|
||
| new MutationObserver(syncDrawerThemeBtn).observe(document.body, { | ||
| attributes: true, | ||
| attributeFilter: ['data-md-color-scheme', 'data-md-color-primary'] | ||
| }); | ||
| } | ||
|
|
||
| function onReady(fn) { | ||
| if (typeof document$ !== 'undefined' && document$.subscribe) { | ||
| document$.subscribe(fn); | ||
| return; | ||
| } | ||
| if (document.readyState === 'loading') { | ||
| document.addEventListener('DOMContentLoaded', fn); | ||
| } else { | ||
| fn(); | ||
| } | ||
| } | ||
|
|
||
| onReady(boot); | ||
| })(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| // Accordion primary nav: opening a nested section closes sibling sections | ||
| // at the same level (so Solana + Other tenants can't both stay expanded). | ||
| (function() { | ||
| 'use strict'; | ||
|
|
||
| function siblingToggles(toggle) { | ||
| var item = toggle.closest('.md-nav__item--nested'); | ||
| if (!item) return []; | ||
| var list = item.parentElement; | ||
| if (!list || !list.classList.contains('md-nav__list')) return []; | ||
| var result = []; | ||
| var children = list.children; | ||
| for (var i = 0; i < children.length; i++) { | ||
| var child = children[i]; | ||
| if (!child.classList || !child.classList.contains('md-nav__item--nested')) continue; | ||
| var kids = child.children; | ||
| for (var j = 0; j < kids.length; j++) { | ||
| if (kids[j].classList && kids[j].classList.contains('md-nav__toggle') && kids[j] !== toggle) { | ||
| result.push(kids[j]); | ||
| break; | ||
| } | ||
| } | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| function closeSiblings(toggle) { | ||
| siblingToggles(toggle).forEach(function(other) { | ||
| other.checked = false; | ||
| other.classList.remove('md-toggle--indeterminate'); | ||
| // Material uses indeterminate for "contains active page"; clear it so | ||
| // the section visually collapses when another section is opened. | ||
| try { other.indeterminate = false; } catch (e) {} | ||
| }); | ||
| } | ||
|
|
||
| function onToggleChange(e) { | ||
| var toggle = e.target; | ||
| if (!toggle || !toggle.classList || !toggle.classList.contains('md-nav__toggle')) return; | ||
| if (!toggle.checked) return; | ||
| closeSiblings(toggle); | ||
| } | ||
|
|
||
| function bind(root) { | ||
| if (!root || root.getAttribute('data-nav-accordion') === '1') return; | ||
| root.setAttribute('data-nav-accordion', '1'); | ||
| root.addEventListener('change', onToggleChange); | ||
| } | ||
|
|
||
| function init() { | ||
| document.querySelectorAll('.md-sidebar--primary').forEach(bind); | ||
| } | ||
|
|
||
| function onReady(fn) { | ||
|
Jotatavo marked this conversation as resolved.
|
||
| if (typeof document$ !== 'undefined' && document$.subscribe) { | ||
| document$.subscribe(fn); | ||
| return; | ||
| } | ||
| if (document.readyState === 'loading') { | ||
| document.addEventListener('DOMContentLoaded', fn); | ||
| } else { | ||
| fn(); | ||
| } | ||
| } | ||
|
|
||
| onReady(init); | ||
| })(); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.