mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-21 12:29:36 +02:00
Some changes on how application list is being rendered. Added isDay property on WeatherIcon to render icon accordingly to time of day. Modal can now be closed by clicking on backdrop
This commit is contained in:
parent
e170f56a03
commit
28683e7511
6 changed files with 37 additions and 8 deletions
|
@ -1,15 +1,25 @@
|
|||
import { MouseEvent, useRef, useEffect } from 'react';
|
||||
|
||||
import classes from './Modal.module.css';
|
||||
|
||||
interface ComponentProps {
|
||||
isOpen: boolean;
|
||||
setIsOpen: Function;
|
||||
children: JSX.Element;
|
||||
}
|
||||
|
||||
const Modal = (props: ComponentProps): JSX.Element => {
|
||||
const modalRef = useRef(null);
|
||||
const modalClasses = [classes.Modal, props.isOpen ? classes.ModalOpen : classes.ModalClose].join(' ');
|
||||
|
||||
const clickHandler = (e: MouseEvent) => {
|
||||
if (e.target === modalRef.current) {
|
||||
props.setIsOpen(false);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={modalClasses}>
|
||||
<div className={modalClasses} onClick={clickHandler} ref={modalRef}>
|
||||
{props.children}
|
||||
</div>
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue