mirror of
https://github.com/remvze/moodist.git
synced 2025-12-18 01:14:17 +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);
|
||||
};
|
||||
|
||||
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>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue