mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-05 08:29:49 +00:00
Better handling of the close function
This commit is contained in:
parent
683acc77ef
commit
0c90e2d490
1 changed files with 3 additions and 7 deletions
|
|
@ -22,23 +22,19 @@ const ColorInput = ({ className, value, onChange }) => {
|
|||
}, [value, colorInputVisible]);
|
||||
|
||||
const modalBackgroundOnClick = React.useCallback((event) => {
|
||||
if (!event.nativeEvent.preventClose) {
|
||||
if(event.target === event.currentTarget) {
|
||||
closeColorInput();
|
||||
}
|
||||
}, []);
|
||||
|
||||
const modalContentOnClick = React.useCallback((event) => {
|
||||
event.nativeEvent.preventClose = true;
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<Button className={className} title={selectedColor} onClick={showColorInput} style={{ backgroundColor: value }}></Button>
|
||||
{
|
||||
colorInputVisible
|
||||
?
|
||||
<Modal className={classnames(styles['color-input-modal'])} onClick={modalBackgroundOnClick}>
|
||||
<div className={classnames(styles['color-input-container'])} onClick={modalContentOnClick}>
|
||||
<Modal className={styles['color-input-modal']} onMouseDown={modalBackgroundOnClick}>
|
||||
<div className={styles['color-input-container']}>
|
||||
<Button onClick={closeColorInput}>
|
||||
<Icon className={classnames(styles['x-icon'])} icon={'ic_x'} />
|
||||
</Button>
|
||||
|
|
|
|||
Loading…
Reference in a new issue