cleaned up time trigger

This commit is contained in:
ari committed 2022-07-20 22:13:46 -04:00
1 parent ef02abe0cb
commit 3a44057a40
14 files changed
+536 -167

No files matched your search

+11 -8
View File
@@ -19,13 +19,14 @@ const fields: Array<keyof AutomationTimeObject> = [
"seconds",
"milliseconds",
];
export interface Props {
export type InputTimeProps = {
label: string;
value?: AutomationTime;
onChange: (v?: AutomationTimeObject) => void;
className?: string;
}
export const InputTime: FC<Props> = (props) => {
value?: AutomationTime;
restrictEmpty?: boolean;
};
export const InputTime: FC<InputTimeProps> = (props) => {
// state
const [disabled, setDisabled] = useState(!props.value);
const [displayValue, setDisplayValue] = useState(
@@ -140,10 +141,12 @@ export const InputTime: FC<Props> = (props) => {
onChange={(e) => updateOne(name)(e.target.value)}
/>
))}
<ButtonIcon
onClick={() => setDisabled(!disabled)}
icon={disabled ? <EditIcon /> : <CloseIcon />}
/>
{!props.restrictEmpty && (
<ButtonIcon
onClick={() => setDisabled(!disabled)}
icon={disabled ? <EditIcon /> : <CloseIcon />}
/>
)}
</div>
</div>
);