diff --git a/src/components/Button/BlankButton.tsx b/src/components/Button/BlankButton.tsx index f4c5e31..25c0000 100644 --- a/src/components/Button/BlankButton.tsx +++ b/src/components/Button/BlankButton.tsx @@ -1,10 +1,10 @@ -import type { ComponentChildren } from 'preact'; +import type { JSX, ComponentChildren } from 'preact'; import s from './styles.css'; import { classNames } from '../../util/component'; interface Props { - onClick?: EventListener; + onClick?: JSX.MouseEventHandler; children?: ComponentChildren; className?: string; [key: string]: unknown; diff --git a/src/components/Jobs/PeriodButton.tsx b/src/components/Jobs/PeriodButton.tsx index a0bcfbb..dd509c8 100644 --- a/src/components/Jobs/PeriodButton.tsx +++ b/src/components/Jobs/PeriodButton.tsx @@ -9,7 +9,7 @@ interface Props { period: PERIOD; } -const handlerClick: JSX.KeyboardEventHandler = (event): void => { +const handlerClick: JSX.KeyboardEventHandler = (event) => { if (event.key === 'Enter' || event.key === ' ') { const el = event.currentTarget; diff --git a/src/components/Tooltip/CronExamplesTooltip/index.tsx b/src/components/Tooltip/CronExamplesTooltip/index.tsx index c12725f..c0690ae 100644 --- a/src/components/Tooltip/CronExamplesTooltip/index.tsx +++ b/src/components/Tooltip/CronExamplesTooltip/index.tsx @@ -1,3 +1,5 @@ +import type { JSX } from 'preact'; + import s from './styles.css'; import cronExamples from './cronExamples.json'; import { useStoreon } from '../../../store'; @@ -12,18 +14,15 @@ interface Props { export const CronExamplesTooltip: FC = ({ target }) => { const { items, dispatch } = useStoreon('items'); - const { id } = target.dataset; + const id = target.dataset.id || ''; const { cronExpression } = items.find((i) => i.id === id) || {}; - const onClick: EventListener = (event) => { - const el = event.target as HTMLButtonElement; - + const onClick: JSX.MouseEventHandler = (event) => dispatch('items/update', { - id: id || '', + id, name: KEYS.cronExpression, - value: el.value, + value: event.currentTarget.value, }); - }; const list = cronExamples.map((i) => { const classList = classNames([