From 126ad48be628f42694fa721dcba4adaade944a8d Mon Sep 17 00:00:00 2001 From: Peter Sanderson Date: Wed, 5 Feb 2025 15:59:07 +0100 Subject: [PATCH] fix: for RadioCard allow optional onClick to allow single-line radio without selection --- .../src/components/RadioCard/RadioCard.tsx | 5 +++-- .../AffectedTransactions/DecreasedOutputs.tsx | 14 ++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/components/src/components/RadioCard/RadioCard.tsx b/packages/components/src/components/RadioCard/RadioCard.tsx index 1e6a245cbb2..4326d1567ee 100644 --- a/packages/components/src/components/RadioCard/RadioCard.tsx +++ b/packages/components/src/components/RadioCard/RadioCard.tsx @@ -24,7 +24,7 @@ type AllowedFrameProps = Pick void; + onClick?: () => void; } & AllowedFrameProps; const Wrapper = styled.div<{ $isActive: boolean } & TransientProps>` @@ -35,7 +35,8 @@ const Wrapper = styled.div<{ $isActive: boolean } & TransientProps theme.borderFocus}; outline-offset: -${borders.widths.small}; - cursor: pointer; + + ${({ onClick }) => onClick && 'cursor: pointer;'} &:hover, &:focus { diff --git a/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/TxDetailModal/AffectedTransactions/DecreasedOutputs.tsx b/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/TxDetailModal/AffectedTransactions/DecreasedOutputs.tsx index c00d4577a65..e64164465fc 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/TxDetailModal/AffectedTransactions/DecreasedOutputs.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/TxDetailModal/AffectedTransactions/DecreasedOutputs.tsx @@ -138,12 +138,14 @@ export const DecreasedOutputs = () => { // it's safe to use array index as key since outputs do not change { - if (useRadio) { - setValue('setMaxOutputId', i); - composeRequest(); - } - }} + onClick={ + useRadio + ? () => { + setValue('setMaxOutputId', i); + composeRequest(); + } + : undefined + } isActive={useRadio && isChecked} >