From 7eda53f795e72e23f24715072d236002d4effb2b Mon Sep 17 00:00:00 2001 From: gnattu Date: Sun, 20 Oct 2024 22:15:26 +0800 Subject: [PATCH] Use anchor for onClick --- src/elements/IconButtonElement.tsx | 32 ++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/src/elements/IconButtonElement.tsx b/src/elements/IconButtonElement.tsx index 3970d72392..552c407fea 100644 --- a/src/elements/IconButtonElement.tsx +++ b/src/elements/IconButtonElement.tsx @@ -30,19 +30,29 @@ const createIconButtonElement = ({ is, id, className, title, icon, dataIndex, da }); const IconButtonElement: FunctionComponent = ({ is, id, className, title, icon, dataIndex, dataTag, dataProfileid, onClick }: IProps) => { + const button = createIconButtonElement({ + is: is, + id: id ? `id="${id}"` : '', + className: className, + title: title ? `title="${globalize.translate(title)}"` : '', + icon: icon, + dataIndex: (dataIndex || dataIndex === 0) ? `data-index="${dataIndex}"` : '', + dataTag: dataTag ? `data-tag="${dataTag}"` : '', + dataProfileid: dataProfileid ? `data-profileid="${dataProfileid}"` : '' + }); + + if (onClick !== undefined) { + return ( + + ) + } + return (
); };