Files
supabase/apps/learn/components/sidebar.tsx
T
Gildas GarciaandIvan Vasilov 96d43099bb chore: refactor Button API so that it can be used a standard button (#46880)
## Problem

Our `<Button>` component breaks the default `button` contract by
redefining the `type` prop to set its variant (`primary`, `default`,
etc) instead of the button type (`submit`, `button`, etc).
This is confusing and forces to write more code when using it with
shadcn components that expect/inject the standard button props.

## Solution

- rename the `type` prop to `variant`
- rename the `htmlType` prop to `type`
- propagate the changes where necessary
- format code

## How to test

As this is just prop renaming, if it builds it's ok

---------

Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2026-06-16 23:59:58 +02:00

37 lines
1.3 KiB
TypeScript

import { Menu } from 'lucide-react'
import SideNavigation from '@/components/side-navigation'
import { getInternalContentPaths } from '@/lib/get-internal-content'
import { Button, ScrollArea, SheetContent, SheetTrigger } from 'ui'
import { MobileMenuSheet } from './mobile-menu-sheet'
import { ThemeSwitcherDropdown } from './theme-switcher-dropdown'
export function Sidebar() {
// Get internal content paths on server side
const internalPaths = Array.from(getInternalContentPaths())
return (
<>
<div className="md:hidden fixed top-0 left-0 right-0 z-50 bg-background justify-between flex items-center px-8 py-3 border-b">
<MobileMenuSheet>
<SheetTrigger asChild>
<Button variant="outline" icon={<Menu />} />
</SheetTrigger>
<SheetContent side="left" className="p-0 w-80" showClose={false}>
<ScrollArea className="h-full">
<SideNavigation internalPaths={internalPaths} />
</ScrollArea>
</SheetContent>
</MobileMenuSheet>
<ThemeSwitcherDropdown />
</div>
<aside className="fixed z-30 top-0 hidden h-screen w-full shrink-0 md:sticky md:block bg-200 border-r border-muted/50">
<ScrollArea className="h-full">
<SideNavigation internalPaths={internalPaths} />
</ScrollArea>
</aside>
</>
)
}