Skip to content

Commit

Permalink
feat(starlight): add ContentPanel override, update stoplight elements
Browse files Browse the repository at this point in the history
  • Loading branch information
Indyandie committed Oct 23, 2024
1 parent 95535d3 commit 2bc6b7f
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 18 deletions.
7 changes: 5 additions & 2 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ export default defineConfig({
social: {
github: 'https://github.com/indyandie/lucero',
},
components: {
ContentPanel: './src/components/overrides/CustomContentPanel.astro'
},
plugins: [
// Generate the OpenAPI documentation pages.
starlightOpenAPI([
Expand All @@ -37,8 +40,8 @@ export default defineConfig({
items: openAPISidebarGroups,
},
{
label: 'Stoplight',
autogenerate: { directory: 'stoplight' },
label: 'Stoplight Elements',
autogenerate: { directory: 'stoplight-elements' },
},
],
}),
Expand Down
12 changes: 12 additions & 0 deletions src/components/StoplightElementsPokeapi.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<script src="/lucero/stoplight-elements/js/web-component.min.js"></script>
<link
rel="stylesheet"
href="/lucero/stoplight-elements/css/styles.min.css"
/>

<div class="not-content">
<elements-api
apiDescriptionUrl="https://raw.githubusercontent.com/PokeAPI/pokeapi/master/openapi.yml"
router="hash"
/>
</div>
22 changes: 22 additions & 0 deletions src/components/overrides/CustomContentPanel.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
import type { Props } from '@astrojs/starlight/props'
import Default from '@astrojs/starlight/components/ContentPanel.astro'
const pageSlug = Astro.props.slug
---
{
pageSlug === 'rapidoc/pokeapi' || pageSlug === 'stoplight-elements/pokeapi' ? (
<section>
<slot />
</section>
) : (
<Default {...Astro.props}>
<slot />
</Default>
)
}

<style>
section:first-child {
display: none;
}
</style>
12 changes: 12 additions & 0 deletions src/content/docs/stoplight-elements/pokeapi.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: PokeAPI (Stoplight Elements)
template: splash
prev: true
next: true
attrs:
target: _blank
---

import Poke from "../../../components/StoplightElementsPokeapi.html";

<Poke/>
16 changes: 0 additions & 16 deletions src/content/docs/stoplight/element.mdx

This file was deleted.

0 comments on commit 2bc6b7f

Please sign in to comment.