Skip to content

Commit 6bc3217

Browse files
izmytomasklim
authored andcommitted
feat(suite): add subtle variant to rewards button
1 parent d56a56c commit 6bc3217

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

packages/components/src/components/buttons/buttonStyleUtils.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const getIconColor = ({
4848

4949
switch (variant) {
5050
case 'primary':
51-
return theme.iconOnPrimary;
51+
return isSubtle ? theme.iconPrimaryDefault : theme.iconOnPrimary;
5252
case 'tertiary':
5353
return theme.iconOnTertiary;
5454
case 'info':
@@ -117,8 +117,11 @@ export const useVariantStyle = (
117117
const variantsColors: Record<ButtonVariant, Record<string, string | Colors>> = {
118118
primary: {
119119
background: theme.backgroundPrimaryDefault,
120+
backgroundSubtle: hexToRgba(theme.backgroundPrimaryDefault, SUBTLE_ALPHA),
120121
backgroundHover: theme.backgroundPrimaryPressed,
122+
backgroundSubtleHover: hexToRgba(theme.backgroundPrimaryDefault, SUBTLE_ALPHA_HOVER),
121123
text: theme.textOnPrimary,
124+
textSubtle: theme.textPrimaryDefault,
122125
},
123126
tertiary: {
124127
background: mapElevationToButtonBackground({

packages/components/src/components/form/FractionButton/FractionButton.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export type FractionButtonProps = {
99
children: React.ReactNode;
1010
tooltip?: React.ReactNode;
1111
isDisabled?: boolean;
12+
isSubtle?: boolean;
1213
variant?: ButtonVariant;
1314
onClick: () => void;
1415
};
@@ -18,6 +19,7 @@ export const FractionButton = ({
1819
children,
1920
tooltip,
2021
isDisabled,
22+
isSubtle,
2123
variant,
2224
onClick,
2325
}: FractionButtonProps) => (
@@ -27,6 +29,7 @@ export const FractionButton = ({
2729
type="button"
2830
size="tiny"
2931
isDisabled={isDisabled}
32+
isSubtle={isSubtle}
3033
onClick={onClick}
3134
>
3235
{children}

packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/UnstakeModal/UnstakeEthForm/Inputs.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ export const Inputs = () => {
4444
restakedReward = '0',
4545
} = getStakingDataForNetwork(account) ?? {};
4646

47+
const isRewardsDisabled = restakedReward === '0';
48+
4749
const { symbol } = account;
4850
const networkDisplaySymbol = getNetworkDisplaySymbol(symbol);
4951

@@ -172,15 +174,19 @@ export const Inputs = () => {
172174
{
173175
id: 'TR_FRACTION_BUTTONS_REWARDS',
174176
children: <Translation id="TR_FRACTION_BUTTONS_REWARDS" />,
175-
tooltip: (
177+
tooltip: isRewardsDisabled ? (
178+
<Translation id="TR_STAKE_NO_REWARDS" />
179+
) : (
176180
<Column alignItems="flex-end">
177181
<FormattedCryptoAmount value={restakedReward} symbol={symbol} />
178182
<Text variant="primary">
179183
<FiatValue amount={restakedReward} symbol={symbol} />
180184
</Text>
181185
</Column>
182186
),
187+
isSubtle: true,
183188
variant: 'primary',
189+
isDisabled: isRewardsDisabled,
184190
onClick: () => onCryptoAmountChange(restakedReward),
185191
},
186192
]}

packages/suite/src/support/messages.ts

+4
Original file line numberDiff line numberDiff line change
@@ -8891,6 +8891,10 @@ export default defineMessages({
88918891
id: 'TR_STAKE_ONLY_REWARDS',
88928892
defaultMessage: 'Only rewards',
88938893
},
8894+
TR_STAKE_NO_REWARDS: {
8895+
id: 'TR_STAKE_NO_REWARDS',
8896+
defaultMessage: 'No rewards available',
8897+
},
88948898
TR_STAKE_UNSTAKED_AND_READY_TO_CLAIM: {
88958899
id: 'TR_STAKE_UNSTAKED_AND_READY_TO_CLAIM',
88968900
defaultMessage: 'Unstaked and ready to claim',

0 commit comments

Comments
 (0)