forked from supabase/supabase
-
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.
- Loading branch information
Showing
227 changed files
with
3,059 additions
and
3,150 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
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 @@ | ||
'use client' | ||
|
||
import { useConfig } from '@/hooks/use-config' | ||
import { SonnerToaster as Toaster } from 'ui' | ||
|
||
export function SonnerToaster() { | ||
const [config] = useConfig() | ||
return <Toaster position={config.sonnerPosition} expand={config.sonnerExpand} /> | ||
} |
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,37 @@ | ||
import { useConfig } from '@/hooks/use-config' | ||
import { Switch } from 'ui' | ||
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout' | ||
|
||
function SonnerExpandConfig() { | ||
const [config, setConfig] = useConfig() | ||
|
||
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 expand prop" | ||
description="You will need to fire a few Sonner toasts first" | ||
layout="flex" | ||
> | ||
<Switch | ||
name="sonnerExpand" | ||
id="sonnerExpand" | ||
size="large" | ||
checked={config.sonnerExpand} | ||
onCheckedChange={(e) => | ||
setConfig({ | ||
...config, | ||
sonnerExpand: e, | ||
}) | ||
} | ||
/> | ||
</FormItemLayout> | ||
</form> | ||
</div> | ||
) | ||
} | ||
|
||
export { SonnerExpandConfig } |
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,70 @@ | ||
import { useConfig } from '@/hooks/use-config' | ||
import { ComponentProps } from 'react' | ||
import { | ||
SelectContent_Shadcn_, | ||
SelectGroup_Shadcn_, | ||
SelectItem_Shadcn_, | ||
SelectLabel_Shadcn_, | ||
SelectTrigger_Shadcn_, | ||
SelectValue_Shadcn_, | ||
Select_Shadcn_, | ||
SonnerToaster, | ||
} from 'ui' | ||
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout' | ||
|
||
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_Shadcn_ | ||
value={config.sonnerPosition} | ||
defaultValue={config.sonnerPosition} | ||
onValueChange={(e: Position) => { | ||
setConfig({ | ||
...config, | ||
sonnerPosition: e, | ||
}) | ||
}} | ||
> | ||
<SelectTrigger_Shadcn_ className="w-[180px]"> | ||
<SelectValue_Shadcn_ placeholder="Select a position" /> | ||
</SelectTrigger_Shadcn_> | ||
<SelectContent_Shadcn_> | ||
<SelectGroup_Shadcn_> | ||
<SelectLabel_Shadcn_>Positions available</SelectLabel_Shadcn_> | ||
{positions.map((position) => ( | ||
<SelectItem_Shadcn_ key={position} value={position}> | ||
{position} | ||
</SelectItem_Shadcn_> | ||
))} | ||
</SelectGroup_Shadcn_> | ||
</SelectContent_Shadcn_> | ||
</Select_Shadcn_> | ||
</FormItemLayout> | ||
</form> | ||
</div> | ||
) | ||
} | ||
|
||
export { SonnerPositionConfig } |
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
21 changes: 21 additions & 0 deletions
21
apps/design-system/registry/default/example/sonner-demo.tsx
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,21 @@ | ||
import { toast } from 'sonner' | ||
import { Button } from 'ui' | ||
|
||
export default function SonnerDemo() { | ||
return ( | ||
<Button | ||
type="default" | ||
onClick={() => | ||
toast('Event has been created', { | ||
description: 'Sunday, December 03, 2023 at 9:00 AM', | ||
cancel: { | ||
label: 'Undo', | ||
onClick: () => console.log('Undo'), | ||
}, | ||
}) | ||
} | ||
> | ||
Show Toast | ||
</Button> | ||
) | ||
} |
Oops, something went wrong.