Skip to content

Commit

Permalink
Add new sidebar component
Browse files Browse the repository at this point in the history
To support adding a persistent link to the sidebar, we need to maintain our own component.

This commit takes the original component from the Starlight codebase and appends our link.
  • Loading branch information
Sporiff committed Feb 2, 2024
1 parent 0e5ca70 commit bfb6e63
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
3 changes: 3 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export default defineConfig({
integrations: [
starlight({
title: "Open Podcast API",
components: {
Sidebar: "./src/components/Sidebar.astro",
},
favicon: "favicon.ico",
social: {
github: "https://github.com/OpenPodcastApi/api-specs",
Expand Down
42 changes: 42 additions & 0 deletions src/components/Sidebar.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
import type { Props } from '@astrojs/starlight/props';
import MobileMenuFooter from '@astrojs/starlight/components/MobileMenuFooter.astro';
import SidebarSublist from '@astrojs/starlight/components/SidebarSublist.astro';
const { sidebar } = Astro.props;
---

<>
<SidebarSublist sublist={sidebar} />
<div class="md:sl-hidden">
<MobileMenuFooter {...Astro.props} />
</div>
<div class="bottom-links">
<a class="netlify-link" href="https://netlify.com">
<span>This site is powered by Netlify</span>
</a>
</div>
</>

<style>

.netlify-link {
font-size: var(--sl-text-lg);
font-weight: 600;
color: var(--sl-color-white);
text-decoration: none;
}

.bottom-links {
bottom: 2rem;
text-align: center;
margin: auto;
width: 100%;
@media (min-width: 50rem) {
text-align: unset;
position: absolute;
}
}

</style>

0 comments on commit bfb6e63

Please sign in to comment.