Skip to content

Commit

Permalink
fix: add default type to button, closes #4333
Browse files Browse the repository at this point in the history
  • Loading branch information
fbwoolf committed Oct 26, 2023
1 parent 190868a commit d54f7c1
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/app/components/button/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ export type ButtonProps = Omit<
ButtonVariantProps;

export function LeatherButton(props: ButtonProps) {
const { children, variant, fullWidth, invert, ...rest } = props;
const { children, variant, fullWidth, invert, type = 'button', ...rest } = props;
return (
<StyledButton className={buttonRecipe({ variant, fullWidth, invert })} {...rest}>
<StyledButton className={buttonRecipe({ variant, fullWidth, invert })} type={type} {...rest}>
{children}
</StyledButton>
);
Expand Down
1 change: 1 addition & 0 deletions src/app/components/preview-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export function PreviewButton({ text = 'Continue', isDisabled, ...props }: Previ
data-testid={SendCryptoAssetSelectors.PreviewSendTxBtn}
disabled={isDisabled}
onClick={() => handleSubmit()}
type="submit"
{...props}
>
{text}
Expand Down
1 change: 1 addition & 0 deletions src/app/features/add-network/add-network.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ export function AddNetwork() {
disabled={loading}
aria-busy={loading}
data-testid={NetworkSelectors.BtnAddNetwork}
type="submit"
>
Add network
</LeatherButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export function BitcoinSendMaxButton({
>
<Box>
<LeatherButton
type="button"
data-testid={SendCryptoAssetSelectors.SendMaxBtn}
onClick={() => onSendMax()}
variant="link"
Expand Down
3 changes: 1 addition & 2 deletions src/app/pages/swap/components/swap-selected-asset.layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function SwapSelectedAssetLayout({
</HStack>
<SelectedAssetField
contentLeft={
<LeatherButton onClick={onChooseAsset} p="space.02" type="button" variant="ghost">
<LeatherButton onClick={onChooseAsset} p="space.02" variant="ghost">
<HStack>
{icon && <styled.img src={icon} width="32px" height="32px" alt="Swap asset" />}
<styled.span textStyle="label.01">{symbol}</styled.span>
Expand All @@ -87,7 +87,6 @@ export function SwapSelectedAssetLayout({
_focus={{ _before: { color: 'unset' } }}
cursor={onClickHandler ? 'pointer' : 'unset'}
onClick={onClickHandler ? onClickHandler : noop}
type="button"
variant={onClickHandler ? 'link' : 'text'}
>
<styled.span textStyle="caption.02">{value}</styled.span>
Expand Down
6 changes: 5 additions & 1 deletion src/app/pages/swap/swap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ export function Swap() {
<SwapSelectedAssets />
</SwapContentLayout>
<SwapFooterLayout>
<LeatherButton disabled={!(dirty && isValid) || isFetchingExchangeRate} width="100%">
<LeatherButton
disabled={!(dirty && isValid) || isFetchingExchangeRate}
type="submit"
width="100%"
>
Review and swap
</LeatherButton>
</SwapFooterLayout>
Expand Down

0 comments on commit d54f7c1

Please sign in to comment.