mirror of
https://github.com/remvze/moodist.git
synced 2025-12-18 09:24:14 +00:00
feat: add form to sleep timer
This commit is contained in:
parent
e674738ce7
commit
9d458fb60e
1 changed files with 63 additions and 51 deletions
|
|
@ -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>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue