-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from Fleco-Development/main
New sidebar & fixes
- Loading branch information
Showing
14 changed files
with
142 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
--- | ||
title: Development Setup | ||
description: Setup Fleco for Development | ||
--- | ||
|
||
:::note | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/content/docs/packages/duration/interfaces/duration-options.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
import type { Props } from "@astrojs/starlight/props"; | ||
import MobileMenuFooter from "@astrojs/starlight/components/MobileMenuFooter.astro"; | ||
import SidebarSublist from "./SidebarSublist.astro"; | ||
const { sidebar } = Astro.props; | ||
--- | ||
|
||
<SidebarSublist sublist={sidebar} /> | ||
<div class="md:sl-hidden"> | ||
<MobileMenuFooter {...Astro.props} /> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
--- | ||
import Badge from "@astrojs/starlight/components/Badge.astro"; | ||
import type { Badge as BadgeType } from "../utils/badge"; | ||
interface Link { | ||
type: "link"; | ||
label: string; | ||
href: string; | ||
isCurrent: boolean; | ||
badge: BadgeType | undefined; | ||
attrs: any; | ||
} | ||
interface Group { | ||
type: "group"; | ||
label: string; | ||
entries: (Link | Group)[]; | ||
collapsed: boolean; | ||
} | ||
type SidebarEntry = Link | Group; | ||
function flattenSidebar(sidebar: SidebarEntry[]): Link[] { | ||
return sidebar.flatMap((entry) => | ||
entry.type === "group" ? flattenSidebar(entry.entries) : entry, | ||
); | ||
} | ||
interface Props { | ||
sublist: SidebarEntry[]; | ||
nested?: boolean; | ||
} | ||
--- | ||
|
||
<ul class:list={{ "top-level": !Astro.props.nested }} class="!daisy_menu gap-2"> | ||
{ | ||
Astro.props.sublist.map((entry) => ( | ||
<li> | ||
{entry.type === "link" ? ( | ||
<a | ||
href={entry.href} | ||
aria-current={entry.isCurrent && "page"} | ||
class:list={[ | ||
{ | ||
large: !Astro.props.nested, | ||
current_page: entry.isCurrent, | ||
"text-white": !entry.isCurrent, | ||
}, | ||
entry.attrs.class, | ||
"no-underline", | ||
]} | ||
{...entry.attrs} | ||
> | ||
<span>{entry.label}</span> | ||
{entry.badge && ( | ||
<> | ||
{" "} | ||
<Badge | ||
text={entry.badge.text} | ||
variant={ | ||
entry.isCurrent | ||
? "outline" | ||
: entry.badge.variant | ||
} | ||
/> | ||
</> | ||
)} | ||
</a> | ||
) : ( | ||
<details | ||
open={ | ||
flattenSidebar(entry.entries).some( | ||
(i) => i.isCurrent, | ||
) || !entry.collapsed | ||
} | ||
> | ||
<summary> | ||
<span class="text-md font-bold">{entry.label}</span> | ||
</summary> | ||
<Astro.self sublist={entry.entries} nested /> | ||
</details> | ||
)} | ||
</li> | ||
)) | ||
} | ||
</ul> | ||
|
||
<style> | ||
.current_page { | ||
color: var(--sl-color-text-invert); | ||
background-color: var(--sl-color-text-accent); | ||
font-weight: bold; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { z } from 'astro/zod'; | ||
|
||
const badgeSchema = () => | ||
z.object({ | ||
variant: z.enum(['note', 'danger', 'success', 'caution', 'tip', 'default']).default('default'), | ||
text: z.string(), | ||
}); | ||
|
||
export type Badge = z.output<ReturnType<typeof badgeSchema>>; |