mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
toastOnClick func removed
This commit is contained in:
parent
136a2fddda
commit
655d55b65d
3 changed files with 4 additions and 11 deletions
|
|
@ -6,13 +6,6 @@ const Button = require('stremio/common/Button');
|
|||
const styles = require('./styles');
|
||||
|
||||
const Toast = ({ type, title, text, icon, closeButton, onClick, onClose }) => {
|
||||
const isClickable = typeof onClick === 'function';
|
||||
const toastOnClick = React.useCallback(() => {
|
||||
if (isClickable) {
|
||||
onClick();
|
||||
}
|
||||
}, [onClick]);
|
||||
|
||||
return (
|
||||
<div className={classnames(styles['toast-container'], styles[type])}>
|
||||
{
|
||||
|
|
@ -23,7 +16,7 @@ const Toast = ({ type, title, text, icon, closeButton, onClick, onClose }) => {
|
|||
:
|
||||
null
|
||||
}
|
||||
<div className={classnames(styles['message-container'], { [styles.clickable]: isClickable })} onClick={toastOnClick}>
|
||||
<div className={classnames(styles['message-container'], { [styles.clickable]: typeof onClick === 'function' })} onClick={onClick}>
|
||||
{
|
||||
typeof title === 'string' && title.length > 0 ?
|
||||
<h1>{title}</h1>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
const React = require('react');
|
||||
const { storiesOf } = require('@storybook/react');
|
||||
const { Toast } = require('stremio/common');
|
||||
const { Toasts } = require('stremio/common');
|
||||
const styles = require('./styles');
|
||||
const { ToastsContainerProvider } = require('stremio/common/ToastsContainerContext');
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ storiesOf('Toast', module).add('SimpleToast', () => {
|
|||
<button onClick={() => toastRef.current.show({})}>Empty</button>
|
||||
<button onClick={() => toastRef.current.hideAll()}>Close all</button>
|
||||
<ToastsContainerProvider>
|
||||
<Toast ref={toastRef} className={styles['toasts-container']} />
|
||||
<Toasts ref={toastRef} className={styles['toasts-container']} />
|
||||
</ToastsContainerProvider>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -11,4 +11,4 @@ require('./Popup');
|
|||
require('./SeasonsBar');
|
||||
require('./SharePrompt');
|
||||
require('./Stream');
|
||||
require('./Toasts');
|
||||
require('./Toast');
|
||||
|
|
|
|||
Loading…
Reference in a new issue