diff --git a/astro.config.mjs b/astro.config.mjs index 713e38265..e9885358d 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -44,6 +44,7 @@ export default defineConfig({ Head: './src/components/Head.astro', PageTitle: './src/components/PageTitle.astro', Footer: './src/components/Footer.astro', + EditLink: './src/components/EditLink.astro', }, pagination: true, editLink: { diff --git a/src/components/EditLink.astro b/src/components/EditLink.astro new file mode 100644 index 000000000..72732c819 --- /dev/null +++ b/src/components/EditLink.astro @@ -0,0 +1,14 @@ +--- +const { editUrl } = Astro.locals.starlightRoute; +const tooltip = 'Want to improve this page? Submit a pull request on GitHub. We review all suggestions within 48 hours.'; +--- +{editUrl && ( +
+ + + Suggest an Edit + +
+)} diff --git a/src/styles/custom.css b/src/styles/custom.css index febb0a597..544ba7019 100644 --- a/src/styles/custom.css +++ b/src/styles/custom.css @@ -1758,3 +1758,45 @@ nav.sidebar { #ask-kai-drawer .ak-shell { width: 100vw; } #ak-fab { bottom: 20px; right: 16px; } } + +/* ───────── Suggest an Edit button + tooltip ───────── */ +.suggest-edit-wrapper { + position: relative; + display: inline-flex; +} + +.suggest-edit-link { + align-items: center; + gap: 0.5em; + color: var(--sl-color-text-accent); + text-decoration: none; + font-size: var(--sl-text-sm); +} + +.suggest-edit-link:hover { + color: var(--sl-color-white); +} + +.suggest-edit-wrapper::after { + content: attr(data-tooltip); + position: absolute; + bottom: calc(100% + 0.5rem); + left: 50%; + transform: translateX(-50%); + background: var(--sl-color-gray-1); + color: var(--sl-color-gray-7); + font-size: var(--sl-text-xs); + padding: 0.4rem 0.65rem; + border-radius: 0.3rem; + white-space: normal; + width: 220px; + text-align: center; + pointer-events: none; + opacity: 0; + transition: opacity 0.15s ease; + z-index: 10; +} + +.suggest-edit-wrapper:hover::after { + opacity: 1; +}