nicolium: i like this style better

Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
nicole mikołajczyk
2026-02-27 17:31:49 +01:00
parent 92b37d12e3
commit 0ea3d8b492
17 changed files with 29 additions and 29 deletions

View File

@@ -39,7 +39,7 @@ const ListItem: React.FC<IListItem> = ({
const labelId = `${domId}-label`;
const hintId = `${domId}-hint`;
const onKeyDown = (e: React.KeyboardEvent) => {
const onKeyDown: React.KeyboardEventHandler<HTMLAnchorElement | HTMLDivElement> = (e) => {
if (e.key === 'Enter') {
onClick!();
}

View File

@@ -15,7 +15,7 @@ interface IHashtagsBar {
const HashtagsBar: React.FC<IHashtagsBar> = ({ hashtags }) => {
const [expanded, setExpanded] = useState(false);
const handleClick = useCallback((e: React.MouseEvent<HTMLButtonElement>) => {
const handleClick: React.MouseEventHandler<HTMLButtonElement> = useCallback((e) => {
e.stopPropagation();
setExpanded(true);

View File

@@ -40,12 +40,12 @@ const Accordion: React.FC<IAccordion> = ({
}) => {
const intl = useIntl();
const handleToggle = (e: React.MouseEvent<HTMLButtonElement>) => {
const handleToggle: React.MouseEventHandler<HTMLButtonElement> = (e) => {
onToggle(!expanded);
e.preventDefault();
};
const handleAction = (e: React.MouseEvent<HTMLButtonElement>) => {
const handleAction: React.MouseEventHandler<HTMLButtonElement> = (e) => {
if (!action) return;
action();

View File

@@ -130,7 +130,7 @@ const Multiselect: React.FC<IMultiselect> = ({
[selectedValues, emitChange],
);
const onInputChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {
const onInputChange: React.ChangeEventHandler<HTMLInputElement> = useCallback((e) => {
setInputValue(e.target.value);
}, []);
@@ -155,8 +155,8 @@ const Multiselect: React.FC<IMultiselect> = ({
}, 0);
}, []);
const onKeyDown = useCallback(
(e: React.KeyboardEvent<HTMLInputElement>) => {
const onKeyDown: React.KeyboardEventHandler<HTMLInputElement> = useCallback(
(e) => {
if (e.key === 'Backspace' && !inputValue && selectedValues.length) {
onRemoveSelectedItem(selectedValues[selectedValues.length - 1]);
return;

View File

@@ -125,7 +125,7 @@ const Upload: React.FC<IUpload> = ({
openModal('MEDIA', { media: [media], index: 0 });
};
const handleOpenAltTextModal = (e: React.MouseEvent<HTMLButtonElement>) => {
const handleOpenAltTextModal: React.MouseEventHandler<HTMLButtonElement> = (e) => {
e.stopPropagation();
e.preventDefault();

View File

@@ -23,7 +23,7 @@ const ReplyMentions: React.FC<IReplyMentions> = ({ composeId }) => {
return null;
}
const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
const handleClick: React.MouseEventHandler<HTMLAnchorElement> = (e) => {
e.preventDefault();
openModal('REPLY_MENTIONS', {

View File

@@ -40,7 +40,7 @@ const ScheduleForm: React.FC<IScheduleForm> = ({ composeId }) => {
});
};
const handleRemove = (e: React.MouseEvent<HTMLButtonElement>) => {
const handleRemove: React.MouseEventHandler<HTMLButtonElement> = (e) => {
updateCompose(composeId, (draft) => {
draft.scheduledAt = null;
});

View File

@@ -22,7 +22,7 @@ const CryptoAddress: React.FC<ICryptoAddress> = (props): React.JSX.Element => {
const { openModal } = useModalsActions();
const handleModalClick = (e: React.MouseEvent<HTMLElement>): void => {
const handleModalClick: React.MouseEventHandler<HTMLElement> = (e) => {
openModal('CRYPTO_DONATE', props);
e.preventDefault();
};

View File

@@ -54,13 +54,13 @@ const EmojiPickerDropdownContainer: React.FC<IEmojiPickerDropdownContainer> = ({
setIsOpen(false);
});
const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
const handleClick: React.MouseEventHandler<HTMLButtonElement> = (e) => {
e.stopPropagation();
e.preventDefault();
setIsOpen(!isOpen);
};
const handleKeyDown = (e: React.KeyboardEvent<HTMLButtonElement>) => {
const handleKeyDown: React.KeyboardEventHandler<HTMLButtonElement> = (e) => {
if (['Enter', ' '].includes(e.key)) {
e.stopPropagation();
e.preventDefault();

View File

@@ -27,7 +27,7 @@ const IconPickerMenu: React.FC<IIconPickerMenu> = ({ icons, onPick }) => {
onPick(icon);
};
const handleKeyDown = (e: React.KeyboardEvent) => {
const handleKeyDown: React.KeyboardEventHandler<HTMLUListElement> = (e) => {
const target = e.target as HTMLButtonElement;
const icon = target.dataset.index;

View File

@@ -249,7 +249,7 @@ const ZoomableImage: React.FC<IZoomableImage> = ({
}
}, [api, style.scale, zoomedIn, width, height, loaded]);
const handleClick = useCallback((e: React.MouseEvent) => {
const handleClick: React.MouseEventHandler<HTMLImageElement> = useCallback((e) => {
// This handler exists to cancel the onClick handler on the media modal which would
// otherwise close the modal. It cannot be used for actual click handling because
// we don't know if the user is about to pan the image or not.

View File

@@ -54,8 +54,8 @@ const Preview: React.FC<PreviewProps> = ({ media, position: [x, y], onPositionCh
nodeRef.current = e;
}, []);
const handleMouseDown = useCallback(
(e: React.MouseEvent) => {
const handleMouseDown: React.MouseEventHandler<HTMLDivElement> = useCallback(
(e) => {
if (e.button !== 0 || !nodeRef.current) {
return;
}
@@ -68,8 +68,8 @@ const Preview: React.FC<PreviewProps> = ({ media, position: [x, y], onPositionCh
[onPositionChange],
);
const handleTouchStart = useCallback(
(e: React.TouchEvent) => {
const handleTouchStart: React.TouchEventHandler<HTMLDivElement> = useCallback(
(e) => {
if (!nodeRef.current) return;
const { x, y } = getPointerPosition(nodeRef.current, e);
@@ -203,8 +203,8 @@ const AltTextModal: React.FC<BaseModalProps & AltTextModalProps> = ({
const [isSaving, setIsSaving] = useState(false);
const dirtyRef = useRef(Boolean(previousDescription));
const handleDescriptionChange = useCallback(
(e: React.ChangeEvent<HTMLTextAreaElement>) => {
const handleDescriptionChange: React.ChangeEventHandler<HTMLTextAreaElement> = useCallback(
(e) => {
setDescription(e.target.value);
dirtyRef.current = true;
},
@@ -235,8 +235,8 @@ const AltTextModal: React.FC<BaseModalProps & AltTextModalProps> = ({
});
}, [dispatch, setIsSaving, media.id, onClose, description, position]);
const handleKeyUp = useCallback(
(e: React.KeyboardEvent) => {
const handleKeyUp: React.KeyboardEventHandler<HTMLTextAreaElement> = useCallback(
(e) => {
if ((e.ctrlKey || e.metaKey) && e.key === 'Enter') {
e.preventDefault();
}

View File

@@ -33,7 +33,7 @@ const PasswordResetPage = () => {
const [isLoading, setIsLoading] = useState(false);
const [success, setSuccess] = useState(false);
const handleSubmit = (e: React.SubmitEvent<HTMLFormElement>) => {
const handleSubmit: React.SubmitEventHandler<HTMLFormElement> = (e) => {
const nicknameOrEmail = e.target.nickname_or_email.value;
setIsLoading(true);
dispatch(resetPassword(nicknameOrEmail))

View File

@@ -87,11 +87,11 @@ const Search: React.FC<IAliasesSearch> = ({ onSubmit }) => {
const [value, setValue] = useState('');
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const handleChange: React.ChangeEventHandler<HTMLInputElement> = (e) => {
setValue(e.target.value);
};
const handleKeyUp = (e: React.KeyboardEvent<HTMLInputElement>) => {
const handleKeyUp: React.KeyboardEventHandler<HTMLInputElement> = (e) => {
if (e.keyCode === 13) {
onSubmit(value);
}

View File

@@ -48,7 +48,7 @@ const AntennaTimelinePage: React.FC = () => {
openModal('ANTENNA_EDITOR', { antennaId });
};
const handleDeleteClick = (e: React.MouseEvent | React.KeyboardEvent) => {
const handleDeleteClick: React.EventHandler<React.KeyboardEvent | React.MouseEvent> = (e) => {
e.preventDefault();
openModal('CONFIRM', {

View File

@@ -48,7 +48,7 @@ const CircleTimelinePage: React.FC = () => {
openModal('CIRCLE_EDITOR', { circleId });
};
const handleDeleteClick = (e: React.MouseEvent | React.KeyboardEvent) => {
const handleDeleteClick: React.EventHandler<React.KeyboardEvent | React.MouseEvent> = (e) => {
e.preventDefault();
openModal('CONFIRM', {

View File

@@ -51,7 +51,7 @@ const ListTimelinePage: React.FC = () => {
openModal('LIST_EDITOR', { listId });
};
const handleDeleteClick = (e: React.MouseEvent | React.KeyboardEvent) => {
const handleDeleteClick: React.EventHandler<React.KeyboardEvent | React.MouseEvent> = (e) => {
e.preventDefault();
openModal('CONFIRM', {