Skip to content

Commit

Permalink
Replace ButtonLink with Link
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-jeremy committed Apr 12, 2024
1 parent 5f3a174 commit 571a9f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion packages/desktop-client/src/components/common/Link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ const ButtonLink = ({ to, style, activeStyle, ...props }: ButtonLinkProps) => {
{...props}
onClick={e => {
props.onClick?.(e);
navigate(path);
if (!e.defaultPrevented) {
navigate(path);
}
}}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import React, { type ComponentPropsWithoutRef } from 'react';
import { useNavigate } from '../../../hooks/useNavigate';
import { SvgAdd } from '../../../icons/v1';
import { theme } from '../../../style';
import { ButtonLink } from '../../common/ButtonLink';
import { Link } from '../../common/Link';

type AddTransactionButtonProps = {
to: ComponentPropsWithoutRef<typeof ButtonLink>['to'];
to: ComponentPropsWithoutRef<typeof Link>['to'];
accountId?: string;
categoryId?: string;
};
Expand All @@ -18,7 +18,8 @@ export function AddTransactionButton({
}: AddTransactionButtonProps) {
const navigate = useNavigate();
return (
<ButtonLink
<Link
variant="button"
to={to}
type="bare"
aria-label="Add transaction"
Expand All @@ -38,6 +39,6 @@ export function AddTransactionButton({
}}
>
<SvgAdd width={20} height={20} />
</ButtonLink>
</Link>
);
}

0 comments on commit 571a9f7

Please sign in to comment.