diff --git a/content/site/partials/header.html b/content/site/partials/header.html index 2c9cf3df5..c262b3087 100644 --- a/content/site/partials/header.html +++ b/content/site/partials/header.html @@ -7,9 +7,8 @@
diff --git a/public/cheatsheet.html b/public/cheatsheet.html index 242709274..c05a43d63 100644 --- a/public/cheatsheet.html +++ b/public/cheatsheet.html @@ -174,9 +174,8 @@
diff --git a/public/css/sub-pages.css b/public/css/sub-pages.css index 7c0406064..5c43a00fc 100644 --- a/public/css/sub-pages.css +++ b/public/css/sub-pages.css @@ -1312,8 +1312,16 @@ main#main { color: var(--color-ink); } -.prose .code-block { +.prose .code-block-wrap { + position: relative; margin: 1.25em 0; +} + +.prose .code-block-wrap .code-block { + margin: 0; +} + +.prose .code-block { padding: var(--spacing-md); background: oklch(12% 0.005 350); color: oklch(92% 0.005 350); @@ -1325,6 +1333,55 @@ main#main { border: 1px solid oklch(20% 0.005 350); } +.code-block-copy { + position: absolute; + top: 10px; + right: 10px; + padding: 4px 10px; + background: oklch(20% 0.005 350); + border: 1px solid oklch(30% 0.005 350); + color: oklch(78% 0.005 350); + border-radius: 4px; + font-family: var(--font-mono); + font-size: 0.6875rem; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 0.08em; + cursor: pointer; + opacity: 0; + transition: + opacity var(--duration-fast) var(--ease-out), + background var(--duration-fast) var(--ease-out), + color var(--duration-fast) var(--ease-out), + border-color var(--duration-fast) var(--ease-out); +} + +.code-block-wrap:hover .code-block-copy, +.code-block-copy:focus-visible { + opacity: 1; +} + +.code-block-copy::before { + content: "Copy"; +} + +.code-block-copy:hover { + background: oklch(30% 0.005 350); + color: oklch(92% 0.005 350); + border-color: oklch(40% 0.005 350); +} + +.code-block-copy.is-copied { + opacity: 1; + background: var(--color-accent); + color: var(--color-paper); + border-color: var(--color-accent); +} + +.code-block-copy.is-copied::before { + content: "Copied"; +} + .prose .code-block code { background: transparent; border: none; diff --git a/public/gallery.html b/public/gallery.html index 95eb8f83f..9b694f896 100644 --- a/public/gallery.html +++ b/public/gallery.html @@ -196,9 +196,8 @@
diff --git a/public/index.html b/public/index.html index 7bb523925..61c1f7152 100644 --- a/public/index.html +++ b/public/index.html @@ -57,9 +57,8 @@
diff --git a/public/privacy.html b/public/privacy.html index b9ac8e840..bd76cfca2 100644 --- a/public/privacy.html +++ b/public/privacy.html @@ -32,9 +32,8 @@
diff --git a/scripts/build-sub-pages.js b/scripts/build-sub-pages.js index 697a0fe37..48be736a3 100644 --- a/scripts/build-sub-pages.js +++ b/scripts/build-sub-pages.js @@ -110,15 +110,19 @@ ${bodyHtml} } /** - * Render the left sidebar used across the /skills section. - * Shows every skill grouped by category. Pass the current skill id to - * mark it with aria-current="page". + * Render the unified Docs sidebar used across /skills and /tutorials. + * Shows every skill grouped by category, then tutorials as a final + * group. Pass the current page identifier so we can mark it: + * + * { kind: 'skill', id: 'polish' } + * { kind: 'tutorial', slug: 'getting-started' } + * null (no current page) */ -function renderSkillsSidebar(skillsByCategory, currentSkillId = null) { +function renderDocsSidebar(skillsByCategory, tutorials, current = null) { let html = ` -