hookshot/web/components/elements/EventHookCheckbox.tsx
Will Hunt 1e8a112a28
Drop ignoreHooks configuration. (#592)
* Refactor HookFilter to only support enabledEvents (and add a function to convert)

* Convert connections to deprecate ignoreHooks

* Update documentation

* Split out EventHookCheckbox

* Refactor frontend to support enableHooks only mode

* drop old field name

* changelog

* Fix enabledHooks for widgets

* Fixes across the board

* Update test description

* Cleanup

* Fix HookFilter

* Fixup checkboxes

* Cleanup
2023-01-10 17:08:50 +00:00

22 lines
720 B
TypeScript

import { FunctionComponent } from "preact";
import { JSXInternal } from "preact/src/jsx";
export const EventHookCheckbox: FunctionComponent<{
enabledHooks: string[],
onChange: JSXInternal.GenericEventHandler<HTMLInputElement>,
hookEventName: string,
parentEvent?: string,
}> = ({enabledHooks, onChange, hookEventName, parentEvent, children}) => {
const checked = enabledHooks.includes(hookEventName) || (!!parentEvent && enabledHooks.includes(parentEvent));
return <li>
<label>
<input
type="checkbox"
x-event-name={hookEventName}
checked={checked}
onChange={onChange} />
{ children }
</label>
</li>;
};