mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-21 11:42:05 +00:00
Merge pull request #569 from Stremio/feature-toast-type-info
feature: toast of type info added
This commit is contained in:
commit
f27dcfcf23
2 changed files with 14 additions and 3 deletions
|
|
@ -9,7 +9,7 @@ const styles = require('./styles');
|
||||||
|
|
||||||
const ToastItem = ({ title, message, dataset, onSelect, onClose, ...props }) => {
|
const ToastItem = ({ title, message, dataset, onSelect, onClose, ...props }) => {
|
||||||
const type = React.useMemo(() => {
|
const type = React.useMemo(() => {
|
||||||
return ['success', 'alert', 'error'].includes(props.type) ?
|
return ['success', 'alert', 'info', 'error'].includes(props.type) ?
|
||||||
props.type
|
props.type
|
||||||
:
|
:
|
||||||
'success';
|
'success';
|
||||||
|
|
@ -18,7 +18,8 @@ const ToastItem = ({ title, message, dataset, onSelect, onClose, ...props }) =>
|
||||||
return typeof props.icon === 'string' ? props.icon :
|
return typeof props.icon === 'string' ? props.icon :
|
||||||
type === 'success' ? 'checkmark' :
|
type === 'success' ? 'checkmark' :
|
||||||
type === 'error' ? 'close' :
|
type === 'error' ? 'close' :
|
||||||
null;
|
type === 'info' ? 'about' :
|
||||||
|
null;
|
||||||
}, [type, props.icon]);
|
}, [type, props.icon]);
|
||||||
const toastOnClick = React.useCallback((event) => {
|
const toastOnClick = React.useCallback((event) => {
|
||||||
if (!event.nativeEvent.selectToastPrevented && typeof onSelect === 'function') {
|
if (!event.nativeEvent.selectToastPrevented && typeof onSelect === 'function') {
|
||||||
|
|
@ -81,7 +82,7 @@ const ToastItem = ({ title, message, dataset, onSelect, onClose, ...props }) =>
|
||||||
};
|
};
|
||||||
|
|
||||||
ToastItem.propTypes = {
|
ToastItem.propTypes = {
|
||||||
type: PropTypes.oneOf(['success', 'alert', 'error']),
|
type: PropTypes.oneOf(['success', 'alert', 'info', 'error']),
|
||||||
title: PropTypes.string,
|
title: PropTypes.string,
|
||||||
message: PropTypes.string,
|
message: PropTypes.string,
|
||||||
icon: PropTypes.string,
|
icon: PropTypes.string,
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,16 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.info {
|
||||||
|
.icon-container {
|
||||||
|
background-color: @color-primary-light2;
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
color: @color-surface-light5-90;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.icon-container {
|
.icon-container {
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
background-color: var(--overlay-color);
|
background-color: var(--overlay-color);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue