Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add default type to button, closes #4333 #4445

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading