feature: toast of type info added

This commit is contained in:
kKaskak 2024-01-29 14:56:40 +02:00
parent 244fb8bf1b
commit 99b09fba17
2 changed files with 14 additions and 3 deletions

View file

@ -9,7 +9,7 @@ const styles = require('./styles');
const ToastItem = ({ title, message, dataset, onSelect, onClose, ...props }) => {
const type = React.useMemo(() => {
return ['success', 'alert', 'error'].includes(props.type) ?
return ['success', 'alert', 'info', 'error'].includes(props.type) ?
props.type
:
'success';
@ -18,7 +18,8 @@ const ToastItem = ({ title, message, dataset, onSelect, onClose, ...props }) =>
return typeof props.icon === 'string' ? props.icon :
type === 'success' ? 'checkmark' :
type === 'error' ? 'warning' :
null;
type === 'info' ? 'about' :
null;
}, [type, props.icon]);
const toastOnClick = React.useCallback((event) => {
if (!event.nativeEvent.selectToastPrevented && typeof onSelect === 'function') {
@ -81,7 +82,7 @@ const ToastItem = ({ title, message, dataset, onSelect, onClose, ...props }) =>
};
ToastItem.propTypes = {
type: PropTypes.oneOf(['success', 'alert', 'error']),
type: PropTypes.oneOf(['success', 'alert', 'info', 'error']),
title: PropTypes.string,
message: PropTypes.string,
icon: PropTypes.string,

View file

@ -33,6 +33,16 @@
}
}
&.info {
.icon-container {
background-color: @color-primary-light2;
.icon {
color: @color-surface-light5-90;
}
}
}
.icon-container {
flex: none;
align-self: stretch;