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