-
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
14 changed files
with
140 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@utima/ui": minor | ||
--- | ||
|
||
Added `Toast` component (using sonner package) | ||
Added `info` color to multiple components |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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,47 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { Toast, toast } from './Toast'; | ||
import { Button } from '../button/Button'; | ||
|
||
const meta: Meta<typeof Toast> = { | ||
component: Toast, | ||
tags: ['autodocs'], | ||
args: { | ||
closeButton: true, | ||
duration: 5000, | ||
position: 'bottom-right', | ||
gap: 10, | ||
}, | ||
title: 'Components/Toast', | ||
decorators: Story => ( | ||
<> | ||
<Button | ||
onClick={() => { | ||
toast('Event has been created', { | ||
description: | ||
'Event has been created successfully, you can view it in the calendar, or edit it. You can also undo this action. Do you want to confirm?', | ||
cancel: { | ||
label: 'Dismiss', | ||
onClick: () => {}, | ||
}, | ||
action: { | ||
label: 'Undo', | ||
onClick: () => {}, | ||
}, | ||
}); | ||
}} | ||
> | ||
Show Toast | ||
</Button> | ||
<Story /> | ||
</> | ||
), | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof Toast>; | ||
|
||
export const Basic: Story = { | ||
args: {}, | ||
}; |
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,23 @@ | ||
import { twOverrides } from '@/overrides'; | ||
|
||
export const toastDef = twOverrides( | ||
{ | ||
toast: | ||
'[&>[data-icon]]:float-left [&>[data-icon]]:mr-3 [&>[data-icon]]:mt-1 group p-4 rounded toast bg-background shadow-lg border-border text-primary drop-shadow', | ||
title: 'group-[.toaster]:font-bold group-[.toaster]:text-sm', | ||
description: 'group-[.toaster]:text-sm', | ||
actionButton: | ||
'float-right group-[.toast]:!ml-2 group-[.toast]:mt-2 group-[.toast]:bg-primary hover:group-[.toast]:opacity-85 active:group-[.toast]:opacity-75 group-[.toast]:text-primary-fg', | ||
cancelButton: | ||
'float-right group-[.toast]:!ml-2 group-[.toast]:mt-2 group-[.toast]:bg-muted hover:group-[.toast]:opacity-85 active:group-[.toast]:opacity-75 group-[.toast]:text-muted-fg', | ||
closeButton: '', | ||
error: | ||
'[&>[data-icon]]:text-danger [&>[data-button]]:!bg-danger [&>[data-cancel]]:!bg-danger/15 [&>[data-cancel]]:!text-danger', | ||
success: | ||
'[&>[data-icon]]:text-success [&>[data-button]]:!bg-success [&>[data-cancel]]:!bg-success/15 [&>[data-cancel]]:!text-success', | ||
warning: | ||
'[&>[data-icon]]:text-warning [&>[data-button]]:!bg-warning [&>[data-cancel]]:!bg-warning/15 [&>[data-cancel]]:!text-warning', | ||
info: '[&>[data-icon]]:text-info [&>[data-button]]:!bg-info [&>[data-cancel]]:!bg-info/15 [&>[data-cancel]]:!text-info', | ||
}, | ||
'toast', | ||
); |
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,22 @@ | ||
import type { ComponentProps } from 'react'; | ||
import { Toaster, toast } from 'sonner'; | ||
|
||
import { toastDef } from './Toast.styles'; | ||
|
||
type ToastProps = ComponentProps<typeof Toaster>; | ||
|
||
export function Toast({ className, ...props }: ToastProps) { | ||
return ( | ||
<Toaster | ||
className='toaster group' | ||
{...props} | ||
toastOptions={{ | ||
unstyled: true, | ||
classNames: toastDef, | ||
...props.toastOptions, | ||
}} | ||
/> | ||
); | ||
} | ||
|
||
export { toast }; |
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