From e4cfdb39cf5475b3350e8f5ef5f930ef48f20066 Mon Sep 17 00:00:00 2001 From: Anthony Whitford Date: Sat, 26 Apr 2025 13:55:01 -0700 Subject: [PATCH 1/5] Removed the Hero component because it did not seem to deviate from the built-in version. --- packages/docs/astro.config.mjs | 1 - packages/docs/src/components/Hero.astro | 140 ------------------------ 2 files changed, 141 deletions(-) delete mode 100644 packages/docs/src/components/Hero.astro diff --git a/packages/docs/astro.config.mjs b/packages/docs/astro.config.mjs index 6d5ebdb17..f33cd11e7 100644 --- a/packages/docs/astro.config.mjs +++ b/packages/docs/astro.config.mjs @@ -49,7 +49,6 @@ export default defineConfig({ Header: './src/components/Header.astro', Footer: './src/components/Footer.astro', Search: './src/components/Search.astro', - Hero: "./src/components/Hero.astro", Head: './src/components/Head.astro', TableOfContents: './src/components/TableOfContents.astro', }, diff --git a/packages/docs/src/components/Hero.astro b/packages/docs/src/components/Hero.astro deleted file mode 100644 index 5033fdb8d..000000000 --- a/packages/docs/src/components/Hero.astro +++ /dev/null @@ -1,140 +0,0 @@ ---- -import { Image } from 'astro:assets'; -import type { Props } from '@astrojs/starlight/props' -import { LinkButton } from '@astrojs/starlight/components' - -const { data } = Astro.props.entry -const { title = data.title, tagline, image, actions = [] } = data.hero || {}; - -const imageAttrs = { - loading: 'eager' as const, - decoding: 'async' as const, - width: 400, - height: 400, - alt: image?.alt || '', -}; - -let darkImage: any = undefined; -let lightImage: any = undefined; - -if (image) { - if ('dark' in image && 'light' in image) { - darkImage = image.dark; - lightImage = image.light; - } else if ('file' in image) { - darkImage = image.file; - lightImage = image.file; - } -} ---- - -
- { - darkImage && ( - - ) - } - {lightImage && } - -
-
-

- {tagline &&
} -
- { - actions.length > 0 && ( -
- {actions.map( - ({ attrs: { class: className, ...attrs } = {}, icon, link: href, text, variant }) => ( - - {text} - {icon?.html && } - - ) - )} -
- ) - } -

-
- - \ No newline at end of file From 4721981d92e8f1b2071568886ba31b9ea3265c81 Mon Sep 17 00:00:00 2001 From: Anthony Whitford Date: Sat, 26 Apr 2025 14:50:11 -0700 Subject: [PATCH 2/5] Revised Footer to use built-in component. --- packages/docs/src/components/Footer.astro | 77 +++++++++-------------- 1 file changed, 30 insertions(+), 47 deletions(-) diff --git a/packages/docs/src/components/Footer.astro b/packages/docs/src/components/Footer.astro index a15c4261f..0f700ca90 100644 --- a/packages/docs/src/components/Footer.astro +++ b/packages/docs/src/components/Footer.astro @@ -1,52 +1,35 @@ --- -import type { Props } from '@astrojs/starlight/props'; - -import EditLink from '@astrojs/starlight/components/EditLink.astro'; -import LastUpdated from '@astrojs/starlight/components/LastUpdated.astro'; -import Pagination from '@astrojs/starlight/components/Pagination.astro'; +import type { Props } from '@astrojs/starlight/props' +import Default from "@astrojs/starlight/components/Footer.astro" --- -
-
- - -
- -
- Show your support! Star us on GitHub ⭐️ - Star -
-
+ +
+ Show your support! Star us on GitHub ⭐️ + Star +
\ No newline at end of file + .github { + align-items: center; + justify-content: center; + gap: 0.5em; + margin: 2rem auto; + font-size: var(--sl-text-sm); + text-decoration: none; + display: flex; + flex-direction: column; + } + .github span { + font-size: var(--sl-text-sm); + cursor: default; + } + From 9045c1a35def1f9049199be81257ffd91dc89d66 Mon Sep 17 00:00:00 2001 From: Anthony Whitford Date: Sat, 26 Apr 2025 18:18:13 -0700 Subject: [PATCH 3/5] Replaced custom Sidebar with a version that leverages the built-in component. Able to remove redundant SidebarSublist component. --- packages/docs/src/components/Sidebar.astro | 28 +-- .../docs/src/components/SidebarSublist.astro | 197 ------------------ 2 files changed, 2 insertions(+), 223 deletions(-) delete mode 100644 packages/docs/src/components/SidebarSublist.astro diff --git a/packages/docs/src/components/Sidebar.astro b/packages/docs/src/components/Sidebar.astro index 967ef561c..b9166be3e 100644 --- a/packages/docs/src/components/Sidebar.astro +++ b/packages/docs/src/components/Sidebar.astro @@ -1,8 +1,6 @@ --- import type { Props } from '@astrojs/starlight/props' - -import MobileMenuFooter from "@astrojs/starlight/components/MobileMenuFooter.astro"; -import SidebarSublist from "./SidebarSublist.astro"; +import Default from "@astrojs/starlight/components/Sidebar.astro" const sidebar = ( Astro.props.sidebar.filter((k) => @@ -12,26 +10,4 @@ const sidebar = ( --- - - -
- -
- - + diff --git a/packages/docs/src/components/SidebarSublist.astro b/packages/docs/src/components/SidebarSublist.astro deleted file mode 100644 index 2fddfa764..000000000 --- a/packages/docs/src/components/SidebarSublist.astro +++ /dev/null @@ -1,197 +0,0 @@ ---- -import {Icon, Badge} from '@astrojs/starlight/components'; - -export interface Link { - type: 'link'; - label: string; - href: string; - isCurrent: boolean; - badge: any | undefined; - attrs: any; - isNested?: boolean; -} - -interface Group { - type: 'group'; - label: string; - entries: (Link | Group)[]; - collapsed: boolean; - badge: any | undefined; - isNested?: boolean; -} - -type SidebarEntry = Link | Group; - -interface Props { - sublist: SidebarEntry[]; - nested?: boolean; -} - -const { sublist, nested } = Astro.props; - -function flattenSidebar(sidebar, isNested = true) { - return sidebar.flatMap(entry => { - // Add the isNested property to the entry - entry.isNested = isNested; - - // Maintain the existing logic - if (entry.type === 'group') { - return flattenSidebar(entry.entries, false); - } else { - return entry; - } - }); -} - ---- - -
    - { - sublist.map((entry) => ( -
  • - {entry.type === 'link' ? ( - - {entry.label} - {entry.badge && ( - - )} - - ) : (entry?.isNested ? ( -
    -
    - {entry.label} - {entry.badge && ( - - )} -
    - -
    - ) : ( -
    i.isCurrent) || !entry.collapsed} - > - -
    - {entry.label} - {entry.badge && ( - - )} -
    - -
    - -
    - ))} -
  • - )) - } -
- - From f1631d852ddf85bd6b8140a4ffabea8e1312a5cc Mon Sep 17 00:00:00 2001 From: Anthony Whitford Date: Sun, 27 Apr 2025 20:56:30 -0700 Subject: [PATCH 4/5] Deprecated Header override, and limited Search override to just the Search component. --- packages/docs/astro.config.mjs | 1 - packages/docs/src/components/Header.astro | 54 ----------------------- packages/docs/src/components/Search.astro | 21 +++++++++ 3 files changed, 21 insertions(+), 55 deletions(-) delete mode 100644 packages/docs/src/components/Header.astro create mode 100644 packages/docs/src/components/Search.astro diff --git a/packages/docs/astro.config.mjs b/packages/docs/astro.config.mjs index f33cd11e7..779bdb688 100644 --- a/packages/docs/astro.config.mjs +++ b/packages/docs/astro.config.mjs @@ -46,7 +46,6 @@ export default defineConfig({ }, components: { Sidebar: './src/components/Sidebar.astro', - Header: './src/components/Header.astro', Footer: './src/components/Footer.astro', Search: './src/components/Search.astro', Head: './src/components/Head.astro', diff --git a/packages/docs/src/components/Header.astro b/packages/docs/src/components/Header.astro deleted file mode 100644 index c4bf784c4..000000000 --- a/packages/docs/src/components/Header.astro +++ /dev/null @@ -1,54 +0,0 @@ ---- -import type { Props } from '@astrojs/starlight/props' - -import LanguageSelect from '@astrojs/starlight/components/LanguageSelect.astro' -import SiteTitle from '@astrojs/starlight/components/SiteTitle.astro' -import SocialIcons from '@astrojs/starlight/components/SocialIcons.astro' -import ThemeSelect from '@astrojs/starlight/components/ThemeSelect.astro' -import { Search } from './Search' ---- - -
-
-
- -
-
- -
-
- -
- - \ No newline at end of file diff --git a/packages/docs/src/components/Search.astro b/packages/docs/src/components/Search.astro new file mode 100644 index 000000000..624ac7596 --- /dev/null +++ b/packages/docs/src/components/Search.astro @@ -0,0 +1,21 @@ +--- +import { Search } from './Search' +--- + + + + From 6fbb0be1036b9987200b11e9be83923a10001ee2 Mon Sep 17 00:00:00 2001 From: Anthony Whitford Date: Mon, 28 Apr 2025 00:06:10 -0700 Subject: [PATCH 5/5] Revised the TableOfContents component to use the built-in component. --- .../docs/src/components/TableOfContents.astro | 27 +++---- .../TableOfContents/TableOfContentsList.astro | 81 ------------------- 2 files changed, 12 insertions(+), 96 deletions(-) delete mode 100644 packages/docs/src/components/TableOfContents/TableOfContentsList.astro diff --git a/packages/docs/src/components/TableOfContents.astro b/packages/docs/src/components/TableOfContents.astro index 81fc21dbc..dd407c3dc 100644 --- a/packages/docs/src/components/TableOfContents.astro +++ b/packages/docs/src/components/TableOfContents.astro @@ -1,28 +1,25 @@ --- import type { Props } from '@astrojs/starlight/props'; -import TableOfContentsList from './TableOfContents/TableOfContentsList.astro'; +import Default from "@astrojs/starlight/components/TableOfContents.astro" import { Icon } from '@astrojs/starlight/components'; -const { labels, toc } = Astro.props; +const { toc } = Astro.props; const showMiniBanner = Astro.props.slug.startsWith("open-source"); --- + { toc && ( - - + ) } diff --git a/packages/docs/src/components/TableOfContents/TableOfContentsList.astro b/packages/docs/src/components/TableOfContents/TableOfContentsList.astro deleted file mode 100644 index 5f70e3d0e..000000000 --- a/packages/docs/src/components/TableOfContents/TableOfContentsList.astro +++ /dev/null @@ -1,81 +0,0 @@ ---- -import type { MarkdownHeading } from 'astro'; - -interface TocItem extends MarkdownHeading { - children: TocItem[]; -} - -interface Props { - toc: TocItem[]; - depth?: number; - isMobile?: boolean; -} - -const { toc, isMobile = false, depth = 0 } = Astro.props; ---- - -
    - { - toc.map((heading) => ( -
  • - - {heading.text} - - {heading.children.length > 0 && ( - - )} -
  • - )) - } -
- - \ No newline at end of file