mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-02-15 07:28:59 +00:00
Prevent default event on icon button clicks
This commit is contained in:
@@ -54,9 +54,25 @@ interface IconButtonProps {
|
||||
type: 'save' | 'close' | 'previous' | 'next';
|
||||
onClick?: () => void;
|
||||
}
|
||||
const IconButton = ({ onClick, type }: IconButtonProps) => (
|
||||
<a href="#" onClick={onClick} className={classNames('iconButton', type)} />
|
||||
);
|
||||
|
||||
const IconButton = ({ onClick, type }: IconButtonProps) => {
|
||||
const clickHandler = (event: React.MouseEvent<HTMLAnchorElement>): void => {
|
||||
event.preventDefault();
|
||||
if (!onClick) {
|
||||
return;
|
||||
}
|
||||
|
||||
onClick();
|
||||
};
|
||||
|
||||
return (
|
||||
<a
|
||||
href="#"
|
||||
onClick={clickHandler}
|
||||
className={classNames('iconButton', type)}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export class Lightbox extends React.Component<Props, {}> {
|
||||
private containerRef: HTMLDivElement | null = null;
|
||||
|
||||
Reference in New Issue
Block a user