Repository navigation
Compact mobile chrome for the docs pages #1357
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
+838
−307
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cf3aa0c
Compact mobile chrome for the docs shell
tmashara 4008b15
Align the phone bar icons to the content gutter
tmashara b869fe1
Let the phone breadcrumb divider flow inline
tmashara 476fa94
remove home icon / change bottom sheet -> dropdown / other styles fixes
tmashara 44432d8
upd styles
tmashara 584e0f1
shuffle styles
tmashara 6b7cf1a
split right sidebar and mobile toc components
tmashara ca481f2
fix what's new color / return focus to the toggle in the popover fall…
tmashara 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
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
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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 |
|---|---|---|
| @@ -1,74 +1,135 @@ | ||
| --- | ||
| import { getCategoryUrl } from "@/lib/docs/nav"; | ||
| import { baseCtx } from "@/lib/liquid/liquidRenderer"; | ||
|
|
||
| type Props = { | ||
| page: { | ||
| version?: string; | ||
| url: string; | ||
| title?: string; | ||
| category?: string; | ||
| has_magic_breadcrumbs?: boolean; | ||
| show_category_breadcrumb?: boolean; | ||
| }; | ||
| variant: "top-bar" | "inline"; | ||
| }; | ||
|
|
||
| const { page } = Astro.props; | ||
| const { site } = baseCtx; | ||
| type Crumb = { label: string; href?: string }; | ||
|
|
||
| const latestOrExplicitVersion = | ||
| site.docs_version === page.version && page.url.includes("/docs/latest/") | ||
| ? "latest" | ||
| : (page.version ?? ""); | ||
| const { page, variant } = Astro.props; | ||
|
|
||
| const getFallbackCategoryUrl = (version: string, url: string) => { | ||
| // page.url is /docs/<version>/<category-slug>/... | ||
| const categorySlug = url.split("/")[3] ?? ""; | ||
| const legacyMapping: Record<string, string> = { | ||
| api: "api-documentation", | ||
| "troubleshooting-guide": "troubleshooting-guide/", | ||
| }; | ||
| const fallbackCategoryPath = | ||
| legacyMapping[categorySlug] ?? `${categorySlug}/start`; | ||
| return `/docs/${version}/${fallbackCategoryPath}`; | ||
| // page.url is /docs/<version>/<category-slug>/... | ||
| const getFallbackCategoryPath = (url: string) => { | ||
| const slug = url.split("/")[3] ?? ""; | ||
| if (slug === "api") return "api-documentation"; | ||
| if (slug === "troubleshooting-guide") return `${slug}/`; | ||
| return `${slug}/start`; | ||
| }; | ||
|
|
||
| const categoryUrl = | ||
| getCategoryUrl(latestOrExplicitVersion, page.category ?? "") ?? | ||
| getFallbackCategoryUrl(latestOrExplicitVersion, page.url); | ||
| const getCrumbs = (page: Props["page"]): Crumb[] => { | ||
| if (!page.has_magic_breadcrumbs) return [{ label: page.title ?? "" }]; | ||
|
|
||
| const version = page.url.split("/")[2]; | ||
| const root = `/docs/${version}/`; | ||
| const crumbs: Crumb[] = [{ label: "Home", href: root }]; | ||
| if (page.show_category_breadcrumb && page.category) { | ||
| crumbs.push({ | ||
| label: page.category, | ||
| href: | ||
| getCategoryUrl(version, page.category) ?? | ||
| root + getFallbackCategoryPath(page.url), | ||
| }); | ||
| } | ||
| return crumbs; | ||
| }; | ||
| --- | ||
|
|
||
| <div class="bootstrap"> | ||
| <nav | ||
| style="--bs-breadcrumb-divider: url('/images/chevron_blue_right.svg')" | ||
| aria-label="breadcrumb" | ||
| > | ||
| <ol class="breadcrumb"> | ||
| {page.has_magic_breadcrumbs ? ( | ||
| <> | ||
| <li class="breadcrumb-item"> | ||
| <a href={`/docs/${latestOrExplicitVersion}/`}>Home</a> | ||
| </li> | ||
|
|
||
| {page.title === "README" ? ( | ||
| <li class="breadcrumb-item"> | ||
| <p class="neutral-40">{page.category}</p> | ||
| </li> | ||
| ) : ( | ||
| page.show_category_breadcrumb && ( | ||
| <li class="breadcrumb-item"> | ||
| <a class="blue-60" href={categoryUrl}> | ||
| {page.category} | ||
| </a> | ||
| </li> | ||
| ) | ||
| )} | ||
| </> | ||
| ) : ( | ||
| <li class="breadcrumb-item"> | ||
| <span class="neutral-40">{page.title}</span> | ||
| </li> | ||
| )} | ||
| </ol> | ||
| </nav> | ||
| </div> | ||
| <nav class:list={["trail", variant]} aria-label="breadcrumb"> | ||
| <ol> | ||
| {getCrumbs(page).map(({ label, href }) => ( | ||
| <li>{href ? <a href={href}>{label}</a> : <span>{label}</span>}</li> | ||
| ))} | ||
| </ol> | ||
| </nav> | ||
|
|
||
| <style> | ||
| /* Doubled to outrank the legacy `.bootstrap .learn__post a` / `li` rules, which load later. */ | ||
| .trail.trail { | ||
| ol { | ||
| align-items: center; | ||
| display: flex; | ||
| list-style: none; | ||
| margin: 0; | ||
| padding: 0; | ||
| } | ||
|
|
||
| li { | ||
| align-items: baseline; | ||
| display: flex; | ||
| margin: 0; | ||
| position: relative; | ||
| white-space: nowrap; | ||
| } | ||
|
|
||
| a { | ||
| color: #509ee3; | ||
| } | ||
|
|
||
| span { | ||
| color: #5a6072; | ||
| } | ||
|
|
||
| &.top-bar { | ||
| li { | ||
| font-size: 18px; | ||
| line-height: 30px; | ||
| } | ||
|
|
||
| a { | ||
| font-size: 16px; | ||
| font-weight: 700; | ||
| } | ||
|
|
||
| li + li { | ||
| padding-left: 23px; | ||
|
|
||
| &::before { | ||
| content: url("/images/chevron_blue_right.svg"); | ||
| left: 7px; | ||
| position: absolute; | ||
| top: 50%; | ||
| transform: translateY(calc(-50% + 3px)); | ||
| } | ||
| } | ||
|
|
||
| @media (max-width: 991.98px) { | ||
| display: none; | ||
| } | ||
| } | ||
|
|
||
| &.inline { | ||
| display: none; | ||
|
|
||
| @media (max-width: 991.98px) { | ||
| display: block; | ||
|
|
||
| ol { | ||
| margin: 16px 0; | ||
| } | ||
|
|
||
| li, | ||
| a, | ||
| span { | ||
| color: #5a6072; | ||
| font-size: 14px; | ||
| font-weight: 400; | ||
| line-height: 20px; | ||
| } | ||
|
|
||
| li + li::before { | ||
| color: #c6c9d2; | ||
| content: "/"; | ||
| padding: 0 6px; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| </style> |
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,44 @@ | ||
| <a id="get-started-btn" href="https://store.metabase.com/checkout"> | ||
| Get started | ||
| </a> | ||
|
|
||
| <style> | ||
| #get-started-btn { | ||
| align-items: center; | ||
| background-color: #509ee3; | ||
| border: 1px solid #509ee3; | ||
| border-radius: 12px; | ||
| color: #fff; | ||
| display: inline-flex; | ||
| flex-shrink: 0; | ||
| font-size: 14px; | ||
| font-weight: 700; | ||
| height: 42px; | ||
| line-height: 20px; | ||
| padding: 0 18px; | ||
| text-decoration: none; | ||
| transition: background-color 0.3s ease; | ||
| white-space: nowrap; | ||
|
|
||
| &:hover { | ||
| background-color: #1c6bb0; | ||
| color: #fff; | ||
| } | ||
|
|
||
| &:focus-visible { | ||
| outline: 2px solid #509ee3; | ||
| outline-offset: 2px; | ||
| } | ||
|
|
||
| @media (min-width: 992px) { | ||
| margin-left: 8px; | ||
| } | ||
| } | ||
|
|
||
| @media (max-width: 991.98px) { | ||
| :global(header.hide-on-scroll) #get-started-btn { | ||
| border-radius: 8px; | ||
| height: 36px; | ||
| } | ||
| } | ||
| </style> |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to allow
--section-bar-top: 0px