Merge pull request #569 from Stremio/feature-toast-type-info

feature: toast of type info added
This commit is contained in:
Tim 2024-02-07 16:31:08 +01:00 committed by GitHub
commit f27dcfcf23
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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' ? 'close' :
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

@ -32,6 +32,16 @@
}
}
&.info {
.icon-container {
background-color: @color-primary-light2;
.icon {
color: @color-surface-light5-90;
}
}
}
.icon-container {
border-radius: 3px;
background-color: var(--overlay-color);