Skip to content

Commit

Permalink
override the green color for tertiary buttons to fix the notification…
Browse files Browse the repository at this point in the history
… action btns
  • Loading branch information
hadijahkyampeire committed Dec 14, 2023
1 parent c907b7c commit 3fd2ed6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
7 changes: 7 additions & 0 deletions packages/framework/esm-styleguide/src/_overrides.scss
Original file line number Diff line number Diff line change
Expand Up @@ -494,3 +494,10 @@ html[dir='rtl'] {
}
}
}

// This is to override the green border and background color which we apply to tertiary buttons. Since this in the Notification carbon uses blue.
.cds--actionable-notification__action-button.cds--btn--tertiary {
background-color: transparent;
border: 1px solid #0f62fe;
color: #0f62fe;
}
2 changes: 2 additions & 0 deletions packages/framework/esm-styleguide/src/toasts/_toasts.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.omrs-toasts-container {
display: flex;
flex-direction: column;
z-index: 100000;
position: fixed;
width: 20rem;
Expand Down
32 changes: 12 additions & 20 deletions packages/framework/esm-styleguide/src/toasts/toast.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,38 +35,30 @@ export const Toast: React.FC<ToastProps> = ({ toast, closeToast }) => {
title,
actionButtonLabel,
onActionButtonClick = () => {},
millis = defaultOptions.millis,
millis = actionButtonLabel ? null : defaultOptions.millis,
} = toast;

const [waitingForTime, setWaitingForTime] = useState(true);

const handleActionClick = useCallback(() => {
onActionButtonClick();
closeToast();
}, [closeToast, onActionButtonClick]);

useEffect(() => {
if (waitingForTime) {
if (millis) {
const timeoutId = setTimeout(closeToast, millis);
return () => clearTimeout(timeoutId);
}
}, [waitingForTime, closeToast, millis]);
}, [closeToast, millis]);

return (
<div
onMouseEnter={() => setWaitingForTime(false)}
onMouseLeave={() => setWaitingForTime(true)}
>
<ActionableNotification
actionButtonLabel={actionButtonLabel}
kind={kind || "info"}
lowContrast={critical}
subtitle={description}
title={title || ""}
onActionButtonClick={handleActionClick}
onClose={closeToast}
timeout={actionButtonLabel ? null : millis}
/>
</div>
<ActionableNotification
actionButtonLabel={actionButtonLabel}
kind={kind || "info"}
lowContrast={critical}
subtitle={description}
title={title || ""}
onActionButtonClick={handleActionClick}
onClose={closeToast}
/>
);
};

0 comments on commit 3fd2ed6

Please sign in to comment.