mirror of
https://github.com/supabase/supabase.git
synced 2026-10-10 03:45:06 +03:00
## 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>
75 lines
2.5 KiB
TypeScript
75 lines
2.5 KiB
TypeScript
import { Heart, Pointer } from 'lucide-react'
|
|
import React from 'react'
|
|
import { Button, Card } from 'ui'
|
|
import {
|
|
InnerSideBarEmptyPanel,
|
|
InnerSideBarShimmeringLoaders,
|
|
InnerSideMenuCollapsible,
|
|
InnerSideMenuCollapsibleContent,
|
|
InnerSideMenuCollapsibleTrigger,
|
|
InnerSideMenuItem,
|
|
InnerSideMenuSeparator,
|
|
} from 'ui-patterns/InnerSideMenu'
|
|
|
|
export default function InnerSideMenuEmpty() {
|
|
const [isLoading, setIsLoading] = React.useState(true)
|
|
const [hasItems, setHasItems] = React.useState(false)
|
|
|
|
React.useEffect(() => {
|
|
// Simulate loading
|
|
const timer = setTimeout(() => {
|
|
setIsLoading(false)
|
|
}, 2000)
|
|
return () => clearTimeout(timer)
|
|
}, [])
|
|
|
|
return (
|
|
<Card className="w-64 py-4 flex flex-col gap-4 bg-dash-sidebar">
|
|
<InnerSideMenuCollapsible defaultOpen>
|
|
<InnerSideMenuCollapsibleTrigger title="Functions" />
|
|
<InnerSideMenuCollapsibleContent className="pt-2">
|
|
<InnerSideBarEmptyPanel
|
|
className="mx-2"
|
|
title="No functions found"
|
|
description="Create your first serverless function to get started."
|
|
illustration={<div className="text-4xl">🚀</div>}
|
|
actions={
|
|
<Button variant="default" onClick={() => setHasItems(true)}>
|
|
Create Function
|
|
</Button>
|
|
}
|
|
/>
|
|
</InnerSideMenuCollapsibleContent>
|
|
</InnerSideMenuCollapsible>
|
|
<InnerSideMenuSeparator />
|
|
<InnerSideMenuCollapsible defaultOpen>
|
|
<InnerSideMenuCollapsibleTrigger title="Functions" />
|
|
<InnerSideMenuCollapsibleContent className="pt-2">
|
|
<InnerSideBarEmptyPanel
|
|
className="mx-2"
|
|
title="No functions found"
|
|
description="Create your first serverless function to get started."
|
|
illustration={
|
|
<figure className="relative mb-3">
|
|
<div className="h-6 w-6 bg-surface-100 border rounded-md flex items-center justify-center">
|
|
<Heart className="text-light" size={13} />
|
|
</div>
|
|
<Pointer
|
|
className="absolute right-[-6px] -bottom-2 text-lighter"
|
|
strokeWidth={1.5}
|
|
size={16}
|
|
/>
|
|
</figure>
|
|
}
|
|
actions={
|
|
<Button variant="default" onClick={() => setHasItems(true)}>
|
|
Create Function
|
|
</Button>
|
|
}
|
|
/>
|
|
</InnerSideMenuCollapsibleContent>
|
|
</InnerSideMenuCollapsible>
|
|
</Card>
|
|
)
|
|
}
|