Skip to content

Commit 0947c70

Browse files
committed
wip
1 parent 7449a5a commit 0947c70

File tree

9 files changed

+129
-168
lines changed

9 files changed

+129
-168
lines changed

site/data/sidebar.yml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
- title: JavaScript
1414
- title: Accessibility
1515
# - title: Community
16-
- title: Examples
17-
href: examples/
18-
- title: Migration
19-
href: migration/
2016

2117
- title: Guides
2218
section: Guides
@@ -222,13 +218,16 @@
222218
- title: Opacity
223219
- title: Shadows
224220

225-
- title: About
226-
section: About
227-
icon: globe2
228-
icon_color: indigo
229-
pages:
230-
- title: Overview
231-
- title: Team
232-
- title: Brand
233-
- title: License
234-
- title: Translations
221+
# - title: About
222+
# section: About
223+
# icon: globe2
224+
# icon_color: indigo
225+
# pages:
226+
# - title: Overview
227+
# - title: Team
228+
# - title: Brand
229+
# - title: License
230+
# - title: Translations
231+
232+
- title: Migration
233+
href: migration/

site/src/components/PageMeta.astro

Lines changed: 76 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
---
22
import type { CollectionEntry } from 'astro:content'
3+
import { getConfig } from '@libs/config'
34
import { getVersionedDocsPath } from '@libs/path'
45
import { getSlug } from '@libs/utils'
6+
import GitHubIcon from '@components/icons/GitHubIcon.astro'
7+
import MdnIcon from '@components/icons/MdnIcon.astro'
8+
import CssTricksIcon from '@components/icons/CssTricksIcon.astro'
59
610
interface Props {
711
frontmatter: CollectionEntry<'docs'>['data']
12+
id: CollectionEntry<'docs'>['id']
813
parentDirectory: string
914
}
1015
11-
const { frontmatter, parentDirectory } = Astro.props
16+
const { frontmatter, id, parentDirectory } = Astro.props
1217
1318
const layerLabels: Record<string, string> = {
1419
reboot: 'Reboot',
@@ -34,75 +39,74 @@ const deps = frontmatter.deps ?? []
3439
const depsCount = deps.length
3540
---
3641

37-
{frontmatter.js === 'required' && (
38-
<span
39-
class="bd-badge theme-warning"
40-
data-bs-toggle="tooltip"
41-
data-bs-placement="top"
42-
data-bs-custom-class="bd-meta-tooltip"
43-
title="Requires JavaScript to function"
44-
>
45-
<svg class="bi" aria-hidden="true"><use href="#filetype-js" /></svg>
46-
Required
47-
</span>
48-
)}
49-
50-
{frontmatter.js === 'optional' && (
51-
<span
52-
class="bd-badge theme-warning"
53-
data-bs-toggle="tooltip"
54-
data-bs-placement="top"
55-
data-bs-custom-class="bd-meta-tooltip"
56-
title="Some features require JavaScript"
57-
>
58-
<svg class="bi" aria-hidden="true"><use href="#filetype-js" /></svg>
59-
Optional
60-
</span>
61-
)}
62-
63-
{frontmatter.css_layer && (
64-
<span
65-
class="bd-badge theme-accent"
66-
data-bs-toggle="tooltip"
67-
data-bs-placement="top"
68-
data-bs-custom-class="bd-meta-tooltip"
69-
title={layerTooltips[frontmatter.css_layer]}
70-
>
71-
<svg class="bi" aria-hidden="true"><use href="#layers" /></svg>
72-
{layerLabels[frontmatter.css_layer]}
73-
</span>
74-
)}
75-
76-
{depsCount > 0 && (
77-
<Fragment>
78-
<button
79-
class="btn-subtle btn-sm theme-secondary"
80-
type="button"
81-
data-bs-toggle="menu"
82-
aria-expanded="false"
83-
data-bs-custom-class="bd-meta-tooltip"
84-
>
85-
<svg class="bi" aria-hidden="true"><use href="#box-seam" /></svg>
86-
{depsCount}
87-
<span>{depsCount === 1 ? 'dependency' : 'dependencies'}</span>
88-
<svg class="bi bi-sm" aria-hidden="true"><use href="#chevron-expand" /></svg>
89-
</button>
90-
<div class="menu">
91-
{deps.map((dep) => (
92-
dep.url?.startsWith('http') ? (
93-
<a class="menu-item" href={dep.url} target="_blank" rel="noopener">
94-
{dep.title}
95-
</a>
96-
) : dep.url ? (
97-
<a class="menu-item" href={dep.url}>
98-
{dep.title}
99-
</a>
100-
) : (
101-
<a class="menu-item" href={getVersionedDocsPath(`components/${getSlug(dep.title)}/`)}>
102-
{dep.title}
103-
</a>
104-
)
105-
))}
42+
<div class="bd-page-meta d-flex flex-wrap gap-5 row-gap-2 px-4 py-3 bg-1 fg-2 fs-sm rounded-3">
43+
{frontmatter.js === 'required' && (
44+
<div class="d-flex align-items-center gap-2">
45+
<svg class="bi fg-warning" aria-hidden="true"><use href="#filetype-js" /></svg>
46+
Requires JavaScript
47+
</div>
48+
)}
49+
{frontmatter.js === 'optional' && (
50+
<div class="d-flex align-items-center gap-2">
51+
<svg class="bi fg-warning opacity-50" aria-hidden="true"><use href="#filetype-js" /></svg>
52+
Optional JavaScript-based features
53+
</div>
54+
)}
55+
{frontmatter.css_layer && (
56+
<div class="d-flex align-items-center gap-2">
57+
<svg class="bi fg-accent" aria-hidden="true"><use href="#layers" /></svg>
58+
<span>In <code class="fg-body">{frontmatter.css_layer}</code> CSS layer</span>
59+
</div>
60+
)}
61+
{depsCount > 0 && (
62+
<div class="d-flex align-items-center gap-2">
63+
<svg class="bi fg-2" aria-hidden="true"><use href="#box-seam" /></svg>
64+
<div>
65+
Depends on
66+
{deps.map((dep, i) => (
67+
<Fragment>
68+
{i > 0 && ', '}
69+
{dep.url?.startsWith('http') ? (
70+
<a class="fg-2 text-decoration-none" href={dep.url} target="_blank" rel="noopener">
71+
{dep.title}
72+
</a>
73+
) : dep.url ? (
74+
<a class="fg-2 text-decoration-none" href={dep.url}>
75+
{dep.title}
76+
</a>
77+
) : (
78+
<a class="fg-2 text-decoration-none" href={getVersionedDocsPath(`components/${getSlug(dep.title)}/`)}>
79+
{dep.title}
80+
</a>
81+
)}
82+
</Fragment>
83+
))}
84+
</div>
85+
</div>
86+
)}
87+
{frontmatter.added &&
88+
((frontmatter.added.show_badge === undefined || frontmatter.added.show_badge === true)) && (
89+
<div class="hstack align-items-center gap-2">
90+
<svg class="bi fg-success" aria-hidden="true"><use href="#plus" /></svg>
91+
Added in v{frontmatter.added.version}
92+
</div>
93+
)}
94+
{frontmatter.mdn && (
95+
<div class="hstack align-items-center gap-2">
96+
<MdnIcon height={16} width={16} class="bi fg-2" />
97+
<a class="fg-2 text-decoration-none" href={frontmatter.mdn} target="_blank" rel="noopener">MDN</a>
98+
</div>
99+
)}
100+
{frontmatter.csstricks && (
101+
<div class="hstack align-items-center gap-2">
102+
<CssTricksIcon height={16} width={16} class="bi fg-2" />
103+
<a class="fg-2 text-decoration-none" href={typeof frontmatter.csstricks === 'string' ? frontmatter.csstricks : frontmatter.csstricks.url} target="_blank" rel="noopener">
104+
{typeof frontmatter.csstricks === 'string' ? 'CSS-Tricks' : (frontmatter.csstricks.label || 'CSS-Tricks')}
105+
</a>
106106
</div>
107-
</Fragment>
108-
)}
107+
)}
108+
<div class="hstack align-items-center gap-2">
109+
<svg class="bi fg-2" aria-hidden="true"><use href="#github" /></svg>
110+
<a class="fg-2 text-decoration-none" href={`${getConfig().repo}/blob/v${getConfig().current_version}/site/src/content/docs/${id}`} target="_blank" rel="noopener">Source</a>
111+
</div>
112+
</div>

site/src/components/icons/Symbols.astro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@
8080
d="M4.5 12.5A.5.5 0 0 1 5 12h3a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zm0-2A.5.5 0 0 1 5 10h6a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zm1.639-3.708 1.33.886 1.854-1.855a.25.25 0 0 1 .289-.047l1.888.974V8.5a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V8s1.54-1.274 1.639-1.208zM6.25 6a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5z"
8181
></path>
8282
</symbol>
83+
<symbol id="github" viewBox="0 0 16 16">
84+
<path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8"/>
85+
</symbol>
8386
<symbol id="globe2" viewBox="0 0 16 16">
8487
<path
8588
d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8zm7.5-6.923c-.67.204-1.335.82-1.887 1.855-.143.268-.276.56-.395.872.705.157 1.472.257 2.282.287V1.077zM4.249 3.539c.142-.384.304-.744.481-1.078a6.7 6.7 0 0 1 .597-.933A7.01 7.01 0 0 0 3.051 3.05c.362.184.763.349 1.198.49zM3.509 7.5c.036-1.07.188-2.087.436-3.008a9.124 9.124 0 0 1-1.565-.667A6.964 6.964 0 0 0 1.018 7.5h2.49zm1.4-2.741a12.344 12.344 0 0 0-.4 2.741H7.5V5.091c-.91-.03-1.783-.145-2.591-.332zM8.5 5.09V7.5h2.99a12.342 12.342 0 0 0-.399-2.741c-.808.187-1.681.301-2.591.332zM4.51 8.5c.035.987.176 1.914.399 2.741A13.612 13.612 0 0 1 7.5 10.91V8.5H4.51zm3.99 0v2.409c.91.03 1.783.145 2.591.332.223-.827.364-1.754.4-2.741H8.5zm-3.282 3.696c.12.312.252.604.395.872.552 1.035 1.218 1.65 1.887 1.855V11.91c-.81.03-1.577.13-2.282.287zm.11 2.276a6.696 6.696 0 0 1-.598-.933 8.853 8.853 0 0 1-.481-1.079 8.38 8.38 0 0 0-1.198.49 7.01 7.01 0 0 0 2.276 1.522zm-1.383-2.964A13.36 13.36 0 0 1 3.508 8.5h-2.49a6.963 6.963 0 0 0 1.362 3.675c.47-.258.995-.482 1.565-.667zm6.728 2.964a7.009 7.009 0 0 0 2.275-1.521 8.376 8.376 0 0 0-1.197-.49 8.853 8.853 0 0 1-.481 1.078 6.688 6.688 0 0 1-.597.933zM8.5 11.909v3.014c.67-.204 1.335-.82 1.887-1.855.143-.268.276-.56.395-.872A12.63 12.63 0 0 0 8.5 11.91zm3.555-.401c.57.185 1.095.409 1.565.667A6.963 6.963 0 0 0 14.982 8.5h-2.49a13.36 13.36 0 0 1-.437 3.008zM14.982 7.5a6.963 6.963 0 0 0-1.362-3.675c-.47.258-.995.482-1.565.667.248.92.4 1.938.437 3.008h2.49zM11.27 2.461c.177.334.339.694.482 1.078a8.368 8.368 0 0 0 1.196-.49 7.01 7.01 0 0 0-2.275-1.52c.218.283.418.597.597.932zm-.488 1.343a7.765 7.765 0 0 0-.395-.872C9.835 1.897 9.17 1.282 8.5 1.077V4.09c.81-.03 1.577-.13 2.282-.287z"

site/src/content/docs/components/menu.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Menu
3-
description: Toggle contextual menus and custom overlays for lists of links, forms, and more with the Bootstrap menu plugin. Powered by [Floating UI](https://floating-ui.com/).
3+
description: Toggle contextual menus and custom overlays for lists of buttons, links, forms, and other custom content.
44
toc: true
55
aliases:
66
- /docs/[[config:docs_version]]/components/menus/
@@ -15,7 +15,7 @@ deps:
1515

1616
Toggle menus with buttons whenever possible. Here's an example using a Bootstrap button:
1717

18-
<Example code={`<button class="btn-solid theme-secondary" type="button" data-bs-toggle="menu" aria-expanded="false">
18+
<Example code={`<button class="btn-solid theme-primary" type="button" data-bs-toggle="menu" aria-expanded="false">
1919
Toggle menu
2020
</button>
2121
<div class="menu">

site/src/layouts/DocsLayout.astro

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ import ReferenceTable from '@components/ReferenceTable.astro'
1313
import UtilityReferenceTable from '@components/UtilityReferenceTable.astro'
1414
import HelperReferenceTable from '@components/HelperReferenceTable.astro'
1515
import { getData } from '@libs/data'
16-
import GitHubIcon from '@components/icons/GitHubIcon.astro'
17-
import MdnIcon from '@components/icons/MdnIcon.astro'
18-
import CssTricksIcon from '@components/icons/CssTricksIcon.astro'
1916
import CloseButton from '@components/shortcodes/CloseButton.astro'
2017
import PageMeta from '@components/PageMeta.astro'
2118
@@ -111,58 +108,10 @@ if (currentPageIndex < allPages.length - 1) {
111108
{frontmatter.description && <Fragment set:html={processMarkdownToHtml(frontmatter.description)} />}
112109
</div>
113110
<div class="mb-3 md:mb-0 d-flex gap-2 text-nowrap">
114-
{
115-
frontmatter.added &&
116-
((frontmatter.added.show_badge !== undefined && frontmatter.added.show_badge === true) ||
117-
frontmatter.added.show_badge === undefined) && (
118-
<small class="d-inline-flex px-2 py-1 fw-semibold text-success-emphasis bg-success-subtle border border-success-subtle rounded-2 me-2">
119-
Added in v{frontmatter.added.version}
120-
</small>
121-
)
122-
}
123-
<a
124-
class="btn-subtle btn-sm theme-secondary me-auto"
125-
href={`${getConfig().repo}/blob/v${getConfig().current_version}/site/src/content/docs/${id}`}
126-
title="View and edit this file on GitHub"
127-
target="_blank"
128-
rel="noopener"
129-
>
130-
<GitHubIcon height={16} width={16} class="bi" />
131-
Edit
132-
</a>
133-
{
134-
frontmatter.mdn && (
135-
<a
136-
class="btn-subtle btn-sm theme-secondary"
137-
href={frontmatter.mdn}
138-
title="View on MDN"
139-
target="_blank"
140-
rel="noopener"
141-
>
142-
<MdnIcon height={16} width={16} class="bi" />
143-
MDN
144-
</a>
145-
)
146-
}
147-
{
148-
frontmatter.csstricks && (
149-
<a
150-
class="btn-secondary-text btn-sm"
151-
href={typeof frontmatter.csstricks === 'string' ? frontmatter.csstricks : frontmatter.csstricks.url}
152-
title="View on CSS-Tricks"
153-
target="_blank"
154-
rel="noopener"
155-
>
156-
<CssTricksIcon height={16} width={16} class="bi" />
157-
{typeof frontmatter.csstricks === 'string' ? 'CSS-Tricks' : (frontmatter.csstricks.label || 'CSS-Tricks')}
158-
</a>
159-
)
160-
}
161-
<PageMeta frontmatter={frontmatter} parentDirectory={parentDirectory} />
111+
<PageMeta frontmatter={frontmatter} id={id} parentDirectory={parentDirectory} />
162112
</div>
163113
</div>
164114

165-
166115
<div class="vstack bd-toc mt-3 mb-5 lg:my-0 lg:mb-5 sm:px-1 fg-3">
167116
<div class="overflow-y-auto">
168117
{

site/src/scss/_badge.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
@use "../../../scss/mixins/border-radius" as *;
2-
@use "variables" as *;
32

43
//
54
// Callouts

site/src/scss/_layout.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,13 @@
6565
min-width: 1px; // Fix width when bd-content contains a `<pre>` https://github.com/twbs/bootstrap/issues/25410
6666
max-width: 100%;
6767
}
68+
69+
.bd-page-meta {
70+
> :not(:last-child)::after {
71+
display: block;
72+
margin-inline-start: .25rem;
73+
margin-inline-end: -.375rem;
74+
content: "";
75+
}
76+
}
6877
}

site/src/scss/_navbar.scss

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
@use "../../../scss/mixins" as *;
22
@use "../../../scss/layout/breakpoints" as *;
33

4-
:root {
5-
--bs-font-sans-serif: "Geist", sans-serif;
6-
--bs-font-monospace: "Geist Mono", monospace;
4+
@layer custom {
5+
:root {
6+
--bd-navbar-offset: 6rem;
7+
}
78

8-
--bd-navbar-offset: 8.75rem;
9-
}
9+
body {
10+
font-family: Geist, var(--bs-body-font-family);
11+
-webkit-font-smoothing: antialiased;
12+
}
13+
14+
code,
15+
pre {
16+
font-family: "Geist Mono", var(--bs-font-mono);
17+
}
1018

11-
@layer custom {
1219
.bd-sticky-navbar.is-stuck {
1320
box-shadow: 0 .125rem .5rem rgb(0 0 0 / .05);
1421
}

0 commit comments

Comments
 (0)