fix: some react warnings (#418)

This commit is contained in:
Matiss Janis Aboltins
2023-01-06 03:25:11 +00:00
committed by GitHub
parent 444daae812
commit 0e1276a311
2 changed files with 19 additions and 11 deletions

View File

@@ -426,7 +426,6 @@ export function IncomeCategoryMonth({
name="received"
width="flex"
borderColor={colors.border}
textAlign="right"
style={[
{ paddingRight: MONTH_RIGHT_PADDING, textAlign: 'right' },
isLast && { borderBottomWidth: 0 }

View File

@@ -111,18 +111,27 @@ export function AnchorLink({
);
}
export const ExternalLink = React.forwardRef((props, ref) => {
function onClick(e) {
e.preventDefault();
window.Actual.openURLInBrowser(props.href);
}
export const ExternalLink = React.forwardRef(
({ asAnchor, children, ...props }, ref) => {
function onClick(e) {
e.preventDefault();
window.Actual.openURLInBrowser(props.href);
}
if (props.asAnchor) {
// eslint-disable-next-line
return <a ref={ref} {...props} onClick={onClick} />;
if (asAnchor) {
return (
<a ref={ref} {...props} onClick={onClick}>
{children}
</a>
);
}
return (
<Button ref={ref} bare {...props} onClick={onClick}>
{children}
</Button>
);
}
return <Button ref={ref} bare {...props} onClick={onClick} />;
});
);
function ButtonLink_({
history,