mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Align custom spending cap Max button in approve screen for multiple languages (#16927)
* Align custom spending cap Max button in approve screen for multiple languages * Modify some css styles and adding Box props * Using ButtonLink component instead of <button/> Co-authored-by: Brad Decker <bhdecker84@gmail.com>
This commit is contained in:
parent
54cbc66120
commit
4d12c36cf8
@ -5,6 +5,7 @@ import { I18nContext } from '../../../contexts/i18n';
|
|||||||
import Box from '../../ui/box';
|
import Box from '../../ui/box';
|
||||||
import FormField from '../../ui/form-field';
|
import FormField from '../../ui/form-field';
|
||||||
import Typography from '../../ui/typography';
|
import Typography from '../../ui/typography';
|
||||||
|
import { ButtonLink } from '../../component-library';
|
||||||
import {
|
import {
|
||||||
ALIGN_ITEMS,
|
ALIGN_ITEMS,
|
||||||
COLORS,
|
COLORS,
|
||||||
@ -15,6 +16,7 @@ import {
|
|||||||
TYPOGRAPHY,
|
TYPOGRAPHY,
|
||||||
JUSTIFY_CONTENT,
|
JUSTIFY_CONTENT,
|
||||||
SIZES,
|
SIZES,
|
||||||
|
BLOCK_SIZES,
|
||||||
} from '../../../helpers/constants/design-system';
|
} from '../../../helpers/constants/design-system';
|
||||||
import { getCustomTokenAmount } from '../../../selectors';
|
import { getCustomTokenAmount } from '../../../selectors';
|
||||||
import { setCustomTokenAmount } from '../../../ducks/app/app';
|
import { setCustomTokenAmount } from '../../../ducks/app/app';
|
||||||
@ -112,21 +114,6 @@ export default function CustomSpendingCap({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Box
|
|
||||||
textAlign={TEXT_ALIGN.END}
|
|
||||||
className="custom-spending-cap__max-button"
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
className="custom-spending-cap__input--max-button"
|
|
||||||
type="link"
|
|
||||||
onClick={(e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
handleChange(currentTokenBalance);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{t('max')}
|
|
||||||
</button>
|
|
||||||
</Box>
|
|
||||||
<Box
|
<Box
|
||||||
className="custom-spending-cap"
|
className="custom-spending-cap"
|
||||||
borderRadius={SIZES.SM}
|
borderRadius={SIZES.SM}
|
||||||
@ -174,9 +161,8 @@ export default function CustomSpendingCap({
|
|||||||
value={value}
|
value={value}
|
||||||
titleDetail={
|
titleDetail={
|
||||||
showUseDefaultButton && (
|
showUseDefaultButton && (
|
||||||
<button
|
<ButtonLink
|
||||||
className="custom-spending-cap__input--button"
|
size={SIZES.AUTO}
|
||||||
type="link"
|
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setShowUseDefaultButton(false);
|
setShowUseDefaultButton(false);
|
||||||
@ -184,12 +170,30 @@ export default function CustomSpendingCap({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('useDefault')}
|
{t('useDefault')}
|
||||||
</button>
|
</ButtonLink>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
titleDetailWrapperProps={{ marginBottom: 2, marginRight: 0 }}
|
titleDetailWrapperProps={{ marginBottom: 2, marginRight: 0 }}
|
||||||
allowDecimals
|
allowDecimals
|
||||||
/>
|
/>
|
||||||
|
<Box
|
||||||
|
width={BLOCK_SIZES.MAX}
|
||||||
|
marginLeft="auto"
|
||||||
|
paddingRight={4}
|
||||||
|
paddingBottom={2}
|
||||||
|
textAlign={TEXT_ALIGN.END}
|
||||||
|
className="custom-spending-cap__max"
|
||||||
|
>
|
||||||
|
<ButtonLink
|
||||||
|
size={SIZES.AUTO}
|
||||||
|
onClick={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
handleChange(currentTokenBalance);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t('max')}
|
||||||
|
</ButtonLink>
|
||||||
|
</Box>
|
||||||
<Typography
|
<Typography
|
||||||
color={COLORS.TEXT_DEFAULT}
|
color={COLORS.TEXT_DEFAULT}
|
||||||
variant={TYPOGRAPHY.H7}
|
variant={TYPOGRAPHY.H7}
|
||||||
|
@ -3,26 +3,13 @@
|
|||||||
display: contents;
|
display: contents;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__max-button {
|
&__max {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
margin-top: -30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__input {
|
&__input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
&--button {
|
|
||||||
background: none;
|
|
||||||
color: var(--color-primary-default);
|
|
||||||
}
|
|
||||||
|
|
||||||
&--max-button {
|
|
||||||
color: var(--color-text-alternative);
|
|
||||||
background: none;
|
|
||||||
position: absolute;
|
|
||||||
margin-top: 55px;
|
|
||||||
margin-inline-start: -75px;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#custom-spending-cap-input-value {
|
#custom-spending-cap-input-value {
|
||||||
|
@ -20,11 +20,6 @@
|
|||||||
&__heading-detail {
|
&__heading-detail {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
align-self: center;
|
align-self: center;
|
||||||
|
|
||||||
&__button {
|
|
||||||
background: none;
|
|
||||||
color: var(--color-primary-default);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
i {
|
i {
|
||||||
|
@ -4,6 +4,7 @@ import { I18nContext } from '../../../contexts/i18n';
|
|||||||
import Box from '../box';
|
import Box from '../box';
|
||||||
import Tooltip from '../tooltip';
|
import Tooltip from '../tooltip';
|
||||||
import Typography from '../typography';
|
import Typography from '../typography';
|
||||||
|
import { ButtonLink } from '../../component-library';
|
||||||
import {
|
import {
|
||||||
ALIGN_ITEMS,
|
ALIGN_ITEMS,
|
||||||
COLORS,
|
COLORS,
|
||||||
@ -93,16 +94,15 @@ export default function ReviewSpendingCap({
|
|||||||
className="review-spending-cap__heading-detail"
|
className="review-spending-cap__heading-detail"
|
||||||
textAlign={TEXT_ALIGN.END}
|
textAlign={TEXT_ALIGN.END}
|
||||||
>
|
>
|
||||||
<button
|
<ButtonLink
|
||||||
className="review-spending-cap__heading-detail__button"
|
size={SIZES.AUTO}
|
||||||
type="link"
|
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
onEdit();
|
onEdit();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('edit')}
|
{t('edit')}
|
||||||
</button>
|
</ButtonLink>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
<Box>
|
<Box>
|
||||||
|
Loading…
Reference in New Issue
Block a user