mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
## Problem The `_Shadcn_` suffix isn't needed anymore on `Select` components ## Solution Remove it. No other changes <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Updated internal component architecture to standardize and simplify the codebase. These changes improve code maintainability and consistency across the application without affecting existing functionality or user experience. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/45988) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
72 lines
1.8 KiB
TypeScript
72 lines
1.8 KiB
TypeScript
import { ComponentProps } from 'react'
|
|
import {
|
|
Select,
|
|
SelectContent,
|
|
SelectGroup,
|
|
SelectItem,
|
|
SelectLabel,
|
|
SelectTrigger,
|
|
SelectValue,
|
|
SonnerToaster,
|
|
} from 'ui'
|
|
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
|
|
|
|
import { useConfig } from '@/hooks/use-config'
|
|
|
|
function SonnerPositionConfig() {
|
|
const [config, setConfig] = useConfig()
|
|
|
|
type Position = NonNullable<ComponentProps<typeof SonnerToaster>['position']>
|
|
|
|
const positions: Position[] = [
|
|
'top-left',
|
|
'top-right',
|
|
'bottom-left',
|
|
'bottom-right',
|
|
'top-center',
|
|
'bottom-center',
|
|
]
|
|
|
|
return (
|
|
<div className="px-5 py-5 border rounded-lg my-2 bg-surface-75">
|
|
<form>
|
|
<FormItemLayout
|
|
name="sonnerExpand"
|
|
id="sonnerExpand"
|
|
isReactForm={false}
|
|
label="Use position prop"
|
|
description="You will need to fire a few Sonner toasts first"
|
|
layout="flex"
|
|
>
|
|
<Select
|
|
value={config.sonnerPosition}
|
|
defaultValue={config.sonnerPosition}
|
|
onValueChange={(e: Position) => {
|
|
setConfig({
|
|
...config,
|
|
sonnerPosition: e,
|
|
})
|
|
}}
|
|
>
|
|
<SelectTrigger className="w-[180px]">
|
|
<SelectValue placeholder="Select a position" />
|
|
</SelectTrigger>
|
|
<SelectContent>
|
|
<SelectGroup>
|
|
<SelectLabel>Positions available</SelectLabel>
|
|
{positions.map((position) => (
|
|
<SelectItem key={position} value={position}>
|
|
{position}
|
|
</SelectItem>
|
|
))}
|
|
</SelectGroup>
|
|
</SelectContent>
|
|
</Select>
|
|
</FormItemLayout>
|
|
</form>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export { SonnerPositionConfig }
|