Skip to content

Commit

Permalink
feat: add Toast warning variation (#1637)
Browse files Browse the repository at this point in the history
  • Loading branch information
talkor authored Oct 16, 2023
1 parent 7e3cb4e commit e8d242e
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
15 changes: 15 additions & 0 deletions src/components/Toast/Toast.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,21 @@
background-color: var(--negative-color);
}

.typeWarning {
background-color: var(--warning-color);
color: var(--text-color-fixed-dark);

.closeButton {
color: var(--text-color-fixed-dark);
}

.actionButton,
.actionLink {
color: var(--text-color-fixed-dark);
border-color: var(--text-color-fixed-dark);
}
}

// Animation
.enterActive {
animation-iteration-count: 1;
Expand Down
7 changes: 5 additions & 2 deletions src/components/Toast/ToastConstants.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import Info from "../Icon/Icons/components/Info";
import Check from "../Icon/Icons/components/Check";
import Alert from "../Icon/Icons/components/Alert";
import Warning from "../Icon/Icons/components/Warning";

export enum ToastType {
NORMAL = "normal",
POSITIVE = "positive",
NEGATIVE = "negative"
NEGATIVE = "negative",
WARNING = "warning"
}

export enum ToastActionType {
Expand All @@ -16,7 +18,8 @@ export enum ToastActionType {
export const defaultIconMap = {
[ToastType.NORMAL]: Info,
[ToastType.POSITIVE]: Check,
[ToastType.NEGATIVE]: Alert
[ToastType.NEGATIVE]: Alert,
[ToastType.WARNING]: Warning
};

export type ToastAction = {
Expand Down
21 changes: 21 additions & 0 deletions src/components/Toast/__stories__/toast.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,27 @@ Use when something was deleted, a problem has occured, etc.
</Story>
</Canvas>

### Warning message

<Canvas>
<Story name="Warning message">
{() => {
const actions = useMemo(() => [{ type: Toast.actionTypes.BUTTON, content: "Button" }], []);
return (
<Toast
open
actions={actions}
type={Toast.types.WARNING}
autoHideDuration={5000}
className="monday-storybook-toast_wrapper"
>
Warning message toast
</Toast>
);
}}
</Story>
</Canvas>

## Do’s and Don’ts

<ComponentRules
Expand Down

0 comments on commit e8d242e

Please sign in to comment.