mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
## Summary - `contentlayer2@0.4.6` is unmaintained and drags in a heavy, stale dependency graph (esbuild pinned to 0.17–0.20, mdx-bundler, old `@opentelemetry/core`) that was the recurring source of vuln bumps. - Migrates all three apps that used it — `design-system`, `ui-library`, `learn` — to [Velite](https://velite.js.org), preserving the generated typed `allDocs`/`Doc` collection and the `body.code` + `useMDXComponent` runtime via a small shared local hook. - Same MDX pipeline (remark-gfm, remark-code-import, rehype-slug, rehype-pretty-code w/ Shiki compat + local theme, rehype-autolink-headings, custom `__rawString__`/`__src__`/`__event__`/`__style__` visitors) ported 1:1 into each app's `velite.config.js`. - `learn`'s extra frontmatter fields (`chapterNumber`, `explore`, `courseHero`) are now backed by real Velite/Zod schema types, so the `(doc as any)` casts in `get-next-page.ts` / `get-current-chapter.ts` / the doc page could be dropped. - `next.config.mjs` no longer wraps with `withContentlayer`; since Velite has no Next.js webpack-plugin equivalent, each app's `dev` script now runs `velite dev` and `next dev` in parallel via `npm-run-all`. Ref: [FE-3861](https://linear.app/supabase/issue/FE-3861/migrate-off-contentlayer2-learn-ui-library-design-system-to-shed) ## Test plan - [x] `pnpm build:content` (Velite build) succeeds for all three apps - [x] `pnpm typecheck` passes for all three apps - [ ] Manual smoke test of `pnpm dev` for each app in a browser (docs pages render, TOC, copy-button, code highlighting) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Improvements** * Improved content generation across documentation, learning materials, and the UI library for more consistent pages. * Preserved MDX rendering, navigation, table of contents, course metadata, source previews, and component examples. * Improved consistency when displaying documentation and interactive examples. * Improved application loading by optimizing how interface components are delivered. * **Chores** * Streamlined content compilation and development workflows across the design system, learning area, and UI library. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
143 lines
4.1 KiB
Plaintext
143 lines
4.1 KiB
Plaintext
---
|
|
title: Inner Side Menu
|
|
description: InnerSideMenu is a component that provides a collapsible side menu with multiple sections.
|
|
component: true
|
|
---
|
|
|
|
<ComponentPreview name="inner-side-menu-demo" peekCode wide />
|
|
|
|
## Examples
|
|
|
|
### Multiple sections
|
|
|
|
<ComponentPreview name="inner-side-menu-multiple-sections" peekCode />
|
|
|
|
### Collapsible menus
|
|
|
|
Inner Side Menu uses the `<InnerSideMenuCollapsible />` component to wrap the menu items.
|
|
This is a wrapper component around the `<Collapsible />` component.
|
|
|
|
```jsx {10-12,16-17}
|
|
import {
|
|
InnerSideMenuCollapsible,
|
|
InnerSideMenuCollapsibleContent,
|
|
InnerSideMenuCollapsibleTrigger,
|
|
InnerSideMenuItem,
|
|
} from 'ui-patterns/InnerSideMenu'
|
|
|
|
function app() {
|
|
return (
|
|
<InnerSideMenuCollapsible key={category} defaultOpen>
|
|
<InnerSideMenuCollapsibleTrigger title={category} />
|
|
<InnerSideMenuCollapsibleContent>
|
|
<InnerSideMenuItem href="/dashboard">Dashboard</InnerSideMenuItem>
|
|
<InnerSideMenuItem href="/team">Team</InnerSideMenuItem>
|
|
<InnerSideMenuItem href="/settings">Settings</InnerSideMenuItem>
|
|
</InnerSideMenuCollapsibleContent>
|
|
</InnerSideMenuCollapsible>
|
|
)
|
|
}
|
|
```
|
|
|
|
### Static titles
|
|
|
|
If you don't need the Collapsible features, you can instead use `<InnerSideBarTitle />`.
|
|
This doesn't require the use of the `<InnerSideMenuCollapsible />` parent component wrapped around it.
|
|
|
|
You can wrap the `<InnerSideBarItem />` components however you like. Below we've put a `<div/ >` around them.
|
|
|
|
```jsx {1}
|
|
<InnerSideBarTitle>Projects</InnerSideBarTitle>
|
|
<div className="mt-2">
|
|
<InnerSideMenuItem href="/dashboard">Dashboard</InnerSideMenuItem>
|
|
<InnerSideMenuItem href="/team">Team</InnerSideMenuItem>
|
|
<InnerSideMenuItem href="/settings">Settings</InnerSideMenuItem>
|
|
</div>
|
|
```
|
|
|
|
<ComponentPreview name="inner-side-menu-static-titles" />
|
|
|
|
### Loading state
|
|
|
|
Use `<InnerSideMenuItemLoading />` to show a loading state for menu items.
|
|
|
|
This item is a wrapper around the `<Skeleton />` component, and also includes some y-padding so the items don't layout shift when shifting to loaded state and to look visually separated in a list.
|
|
|
|
<ComponentPreview name="inner-side-menu-loading" />
|
|
|
|
### With search
|
|
|
|
Use the following components to add a search input to the menu.
|
|
|
|
```jsx
|
|
<InnerSideBarFilters>
|
|
<InnerSideBarFilterSearchInput
|
|
name="search-input"
|
|
placeholder="Search..."
|
|
value={searchTerm}
|
|
onChange={(e) => setSearchTerm(e.target.value)}
|
|
aria-labelledby="Search items"
|
|
/>
|
|
</InnerSideBarFilters>
|
|
```
|
|
|
|
There is also a Filter Dropdown component that can be used to sort the menu items.
|
|
This can be used inside `<InnerSideBarFilterSearchInput />`.
|
|
|
|
```jsx {9-16}
|
|
<InnerSideBarFilters>
|
|
<InnerSideBarFilterSearchInput
|
|
name="search-input"
|
|
placeholder="Search..."
|
|
value={searchTerm}
|
|
onChange={(e) => setSearchTerm(e.target.value)}
|
|
aria-labelledby="Search items"
|
|
>
|
|
<InnerSideBarFilterSortDropdown value={sort} onValueChange={(value) => setSort(value)}>
|
|
<InnerSideBarFilterSortDropdownItem value="alphabetical">
|
|
Sort Alphabetically
|
|
</InnerSideBarFilterSortDropdownItem>
|
|
<InnerSideBarFilterSortDropdownItem value="reverse">
|
|
Sort Reverse Alphabetically
|
|
</InnerSideBarFilterSortDropdownItem>
|
|
</InnerSideBarFilterSortDropdown>
|
|
</InnerSideBarFilterSearchInput>
|
|
</InnerSideBarFilters>
|
|
```
|
|
|
|
<ComponentPreview name="inner-side-menu-with-search" />
|
|
|
|
### Empty list state
|
|
|
|
Use `<InnerSideMenuEmptyState />` to show an empty state.
|
|
|
|
Use the `actions` prop to add any actions like a `<Button />`.
|
|
|
|
```jsx {4-7}
|
|
<InnerSideBarEmptyPanel
|
|
title="No functions found"
|
|
description="Create your first serverless function to get started."
|
|
actions={
|
|
<Button variant="default" onClick={createAction}>
|
|
Create Function
|
|
</Button>
|
|
}
|
|
/>
|
|
```
|
|
|
|
You can also use the prop `illustration` to pass in a custom illustration, it accepts any React Node.
|
|
|
|
```jsx {4-7}
|
|
<InnerSideBarEmptyPanel
|
|
title="No functions found"
|
|
description="Create your first serverless function to get started."
|
|
illustration={
|
|
<figure>
|
|
<svg>../</svg>
|
|
</figure>
|
|
}
|
|
/>
|
|
```
|
|
|
|
<ComponentPreview name="inner-side-menu-empty" />
|