Skip to content

Commit

Permalink
Update event handler
Browse files Browse the repository at this point in the history
  • Loading branch information
shoonia committed Jan 1, 2024
1 parent 8c533c3 commit 338cb89
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/components/Button/BlankButton.tsx
Original file line number Diff line number Diff line change
@@ -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<HTMLButtonElement>;
children?: ComponentChildren;
className?: string;
[key: string]: unknown;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Jobs/PeriodButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface Props {
period: PERIOD;
}

const handlerClick: JSX.KeyboardEventHandler<HTMLLabelElement> = (event): void => {
const handlerClick: JSX.KeyboardEventHandler<HTMLLabelElement> = (event) => {
if (event.key === 'Enter' || event.key === ' ') {
const el = event.currentTarget;

Expand Down
13 changes: 6 additions & 7 deletions src/components/Tooltip/CronExamplesTooltip/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { JSX } from 'preact';

import s from './styles.css';
import cronExamples from './cronExamples.json';
import { useStoreon } from '../../../store';
Expand All @@ -12,18 +14,15 @@ interface Props {
export const CronExamplesTooltip: FC<Props> = ({ 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<HTMLButtonElement> = (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([
Expand Down

0 comments on commit 338cb89

Please sign in to comment.