feat: add form to sleep timer

This commit is contained in:
MAZE 2024-04-29 15:21:50 +04:30
parent e674738ce7
commit 9d458fb60e

View file

@ -69,6 +69,12 @@ export function SleepTimerModal({ onClose, show }: SleepTimerModalProps) {
setRunning(false); setRunning(false);
}; };
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
handleStart();
};
return ( return (
<Modal show={show} onClose={onClose}> <Modal show={show} onClose={onClose}>
<header className={styles.header}> <header className={styles.header}>
@ -78,6 +84,7 @@ export function SleepTimerModal({ onClose, show }: SleepTimerModalProps) {
</p> </p>
</header> </header>
<form onSubmit={handleSubmit}>
<div className={styles.controls}> <div className={styles.controls}>
{!running && ( {!running && (
<div className={styles.inputContainer}> <div className={styles.inputContainer}>
@ -119,7 +126,11 @@ export function SleepTimerModal({ onClose, show }: SleepTimerModalProps) {
<div className={styles.buttons}> <div className={styles.buttons}>
{running && ( {running && (
<button className={styles.button} onClick={handleReset}> <button
className={styles.button}
type="button"
onClick={handleReset}
>
Reset Reset
</button> </button>
)} )}
@ -127,13 +138,14 @@ export function SleepTimerModal({ onClose, show }: SleepTimerModalProps) {
{!running && ( {!running && (
<button <button
className={cn(styles.button, styles.primary)} className={cn(styles.button, styles.primary)}
onClick={handleStart} type="submit"
> >
Save Save
</button> </button>
)} )}
</div> </div>
</div> </div>
</form>
</Modal> </Modal>
); );
} }