converted components to .ts

This commit is contained in:
andres alcocer
2022-11-26 16:25:35 -05:00
parent 907500f0f5
commit 7b82882998
33 changed files with 291 additions and 326 deletions

35
src/components/Modal.tsx Normal file
View File

@@ -0,0 +1,35 @@
import React from 'react'
interface IBackdrop {
toggleBackdrop?: () => void
show: boolean
}
interface IModal extends IBackdrop {
backgroundImage: string
children: JSX.Element
}
const Backdrop = ({ toggleBackdrop, show }: IBackdrop) =>
show ? <div onClick={toggleBackdrop} className='backdrop'></div> : null
const Modal = ({ show, toggleBackdrop, children, backgroundImage }: IModal) => {
const backgroundStyle = {
backgroundSize: 'cover',
backgroundImage: `url(https://image.tmdb.org/t/p/original/${backgroundImage})`,
}
return (
<div>
<Backdrop show={show} toggleBackdrop={toggleBackdrop} />
<div
style={backgroundStyle}
className={show ? 'modal show' : 'modal hide'}
>
{children}
</div>
</div>
)
}
export default Modal