refactor: replace enabled prop with disabled in DigitalClock
This commit is contained in:
committed by
Loic Coenen (aider)
parent
a5e300d238
commit
0b3a1d4d66
@@ -2,15 +2,15 @@ import { useState } from "react";
|
||||
import { dateToDigital, digitalToDate } from "../utils";
|
||||
|
||||
interface DigitalClockProps {
|
||||
enabled: boolean;
|
||||
currentTime: Date;
|
||||
onTimeChange: (time: Date) => void;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
export function DigitalClock({
|
||||
enabled,
|
||||
currentTime,
|
||||
onTimeChange,
|
||||
disabled = false,
|
||||
}: DigitalClockProps) {
|
||||
const [inputValue, setInputValue] = useState(dateToDigital(currentTime));
|
||||
|
||||
@@ -23,8 +23,6 @@ export function DigitalClock({
|
||||
}
|
||||
};
|
||||
|
||||
if (!enabled) return null;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<span data-testid="digital-clock">{dateToDigital(currentTime)}</span>
|
||||
@@ -34,6 +32,7 @@ export function DigitalClock({
|
||||
value={inputValue}
|
||||
onChange={handleChange}
|
||||
placeholder="HH:MM:SS"
|
||||
disabled={disabled}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user