From 0c17a82cbb188e7fc4f8f59df55ba0cc31c5cefd Mon Sep 17 00:00:00 2001 From: Hadas Farhi Date: Tue, 20 Jul 2021 16:57:39 +0300 Subject: [PATCH 1/7] feature: toast link support --- package.json | 2 +- src/components/Toast/Toast.jsx | 1 + src/components/Toast/ToastButton.jsx | 33 +++++++ src/components/Toast/ToastLink.jsx | 25 +++++ src/components/Toast/ToastLink.scss | 9 ++ .../Toast/__stories__/toast.stories.js | 94 ++++++++++++++----- 6 files changed, 141 insertions(+), 23 deletions(-) create mode 100644 src/components/Toast/ToastButton.jsx create mode 100644 src/components/Toast/ToastLink.jsx create mode 100644 src/components/Toast/ToastLink.scss diff --git a/package.json b/package.json index e83309c48e..5b13be633f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "monday-ui-react-core", - "version": "0.3.57", + "version": "0.3.58", "description": "Official monday.com UI resources for application development in React.js", "main": "dist/main.js", "scripts": { diff --git a/src/components/Toast/Toast.jsx b/src/components/Toast/Toast.jsx index 3abac153c1..9d91f22c3c 100644 --- a/src/components/Toast/Toast.jsx +++ b/src/components/Toast/Toast.jsx @@ -45,6 +45,7 @@ const Toast = ({ open, autoHideDuration, type, icon, hideIcon, action, children, const timerAutoHide = useRef(); const setAutoHideTimer = useCallback( duration => { + debugger; if (!onClose || duration == null) { return; } diff --git a/src/components/Toast/ToastButton.jsx b/src/components/Toast/ToastButton.jsx new file mode 100644 index 0000000000..ca9861df04 --- /dev/null +++ b/src/components/Toast/ToastButton.jsx @@ -0,0 +1,33 @@ +/* eslint-disable react/jsx-props-no-spreading */ +import React from "react"; +import cx from "classnames"; +import Button from "../Button/Button"; + +const ToastButton = ({ className, ...buttonProps }) => { + return ( + - closeToast()} - action={ - - } - type={knobs.type} - icon={icon} - closeable={knobs.closeable} - autoHideDuration={knobs.autoHideDuration} - hideIcon={knobs.hideIcon} - > - Something Happened - - - + + + closeToast()} + type={knobs.type} + icon={icon} + closeable={knobs.closeable} + autoHideDuration={knobs.autoHideDuration} + hideIcon={knobs.hideIcon} + > + Something Happened + + + + + closeToastButton()} + action={Undo 5} + type={knobs.type} + icon={icon} + closeable={knobs.closeable} + autoHideDuration={knobs.autoHideDuration} + hideIcon={knobs.hideIcon} + > + Something Happened + + + + + closeToastLink()} + action={} + type={knobs.type} + icon={icon} + closeable={knobs.closeable} + autoHideDuration={knobs.autoHideDuration} + hideIcon={knobs.hideIcon} + > + Something Happened + + + + + closeToastLinkButton()} + action={[, Undo 5]} + type={knobs.type} + icon={icon} + closeable={knobs.closeable} + autoHideDuration={knobs.autoHideDuration} + hideIcon={knobs.hideIcon} + > + Something Happened + + ); }; From 763bf9d8fb56f34ad042302da6d1f5c31c48a60d Mon Sep 17 00:00:00 2001 From: Hadas Farhi Date: Wed, 21 Jul 2021 09:10:49 +0300 Subject: [PATCH 2/7] feature: toast link supportnand combo link& button support --- src/components/Toast/Toast.scss | 8 +++++++- src/components/Toast/ToastButton.jsx | 4 ++-- src/components/Toast/ToastLink.jsx | 2 +- src/components/Toast/ToastLink.scss | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/components/Toast/Toast.scss b/src/components/Toast/Toast.scss index b5d68bf037..10db4f5d3d 100644 --- a/src/components/Toast/Toast.scss +++ b/src/components/Toast/Toast.scss @@ -15,7 +15,7 @@ padding: $spacing-small; align-items: center; display: flex; - min-width: 390px; + min-width: 200px; border-radius: $border-radius-small; &-icon { @@ -36,6 +36,12 @@ &-action { padding-right: $spacing-small; margin-left: $spacing-large; + display: flex; + &_button, &_link { + &:not(:first-child) { + margin-left: $spacing-medium; + } + } } &--type { diff --git a/src/components/Toast/ToastButton.jsx b/src/components/Toast/ToastButton.jsx index ca9861df04..355ab0b45b 100644 --- a/src/components/Toast/ToastButton.jsx +++ b/src/components/Toast/ToastButton.jsx @@ -7,7 +7,7 @@ const ToastButton = ({ className, ...buttonProps }) => { return (