Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance(Toast): hide dismissible button on toast and show with group hover #132

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions packages/design-system/src/Toast.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,21 +111,36 @@ export const Error = () => {

export const Dismissible = () => {
return (
<div>
<div className="mb-2">
<div className="flex flex-col gap-2">
<div>
Toast components can have an "addimissible" prop set to true. This will
set the duration automatically to a minute, but offer an option to the
user to manually close the tooltip. Optionally, the duration of a minute
can also be overwritten using the duration prop.
</div>
<Toast triggerText="Trigger - no overwritten duration" dismissible>
Toast Content
</Toast>
<Toast triggerText="Trigger - duration 5s" duration={5000} dismissible>
Toast Content
</Toast>
<Toast
triggerText="Trigger - no overwritten duration"
className={{ trigger: 'mb-2' }}
type="success"
triggerText="Success Toast"
duration={5000}
dismissible
>
Toast Content
</Toast>
<Toast triggerText="Trigger - duration 5s" duration={5000} dismissible>
<Toast
type="warning"
triggerText="Warning Toast"
duration={5000}
dismissible
>
Toast Content
</Toast>
<Toast type="error" triggerText="Error Toast" duration={5000} dismissible>
Toast Content
</Toast>
</div>
Expand Down
4 changes: 2 additions & 2 deletions packages/design-system/src/Toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export function Toast({

<RadixToast.Root
className={twMerge(
'border-md grid items-center gap-x-4 rounded-md bg-white p-3 shadow-md',
'border-md group grid items-center gap-x-4 rounded-md bg-white p-3 shadow-md',
type === 'success' && 'border-2 border-solid border-green-500',
type === 'warning' && 'border-2 border-solid border-orange-500',
type === 'error' && 'border-2 border-solid border-red-500',
Expand All @@ -136,7 +136,7 @@ export function Toast({
>
{dismissible && (
<Button
className={{ root: 'fixed right-6 top-4' }}
className={{ root: 'fixed right-6 top-4 hidden group-hover:block' }}
basic
onClick={() =>
setOpenExternal ? setOpenExternal(false) : setOpen(false)
Expand Down
Loading