You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bazarr/frontend/src/components/modals/subtitle-tools/ColorTool.tsx

37 lines
1004 B

import { Selector } from "@/components";
import { useModal, withModal } from "@/modules/modals";
import { submodProcessColor } from "@/utilities";
import { FunctionComponent, useCallback, useState } from "react";
import { Button } from "react-bootstrap";
import { useProcess } from "./ToolContext";
import { colorOptions } from "./tools";
const ColorTool: FunctionComponent = () => {
const [selection, setSelection] = useState<Nullable<string>>(null);
const Modal = useModal();
const process = useProcess();
const submit = useCallback(() => {
if (selection) {
const action = submodProcessColor(selection);
process(action);
}
}, [process, selection]);
const footer = (
<Button disabled={selection === null} onClick={submit}>
Save
</Button>
);
return (
<Modal title="Choose Color" footer={footer}>
<Selector options={colorOptions} onChange={setSelection}></Selector>
</Modal>
);
};
export default withModal(ColorTool, "color-tool");