mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 01:39:44 +01:00
fix button text props (#17478)
* fix button text props * fix textProps size from being overriden * Update ui/components/component-library/button-link/button-link.js Co-authored-by: George Marshall <george.marshall@consensys.net> --------- Co-authored-by: George Marshall <george.marshall@consensys.net>
This commit is contained in:
parent
26222a9b27
commit
db0492e042
@ -66,7 +66,13 @@ import { ButtonLink, Text, TEXT } from '../../component-library';
|
||||
Inherits the font-size of the parent element. <ButtonLink size={SIZES.INHERIT}>Learn more</ButtonLink>
|
||||
</Text>
|
||||
<Text variant={TEXT.BODY_XS}>
|
||||
Inherits the font-size of the parent element. <ButtonLink size={SIZES.INHERIT}>Learn more</ButtonLink>
|
||||
Inherits the font-size of the parent element and example with textProps override for a success color.
|
||||
<ButtonLink
|
||||
size={SIZES.INHERIT}
|
||||
textProps={{ color: COLORS.SUCCESS_DEFAULT }}
|
||||
>
|
||||
Learn more
|
||||
</ButtonLink>
|
||||
</Text>
|
||||
```
|
||||
|
||||
|
@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
|
||||
import classnames from 'classnames';
|
||||
|
||||
import { ButtonBase } from '../button-base';
|
||||
import { Text } from '../text';
|
||||
import { COLORS, TEXT, SIZES } from '../../../helpers/constants/design-system';
|
||||
import { BUTTON_LINK_SIZES } from './button-link.constants';
|
||||
|
||||
@ -10,6 +11,7 @@ export const ButtonLink = ({
|
||||
className,
|
||||
danger,
|
||||
size = SIZES.AUTO,
|
||||
textProps,
|
||||
...props
|
||||
}) => {
|
||||
return (
|
||||
@ -28,6 +30,7 @@ export const ButtonLink = ({
|
||||
textProps={{
|
||||
variant:
|
||||
size === BUTTON_LINK_SIZES.INHERIT ? TEXT.INHERIT : TEXT.BODY_MD,
|
||||
...textProps,
|
||||
}}
|
||||
iconProps={{
|
||||
size: size === BUTTON_LINK_SIZES.INHERIT ? SIZES.INHERIT : SIZES.SM,
|
||||
@ -54,6 +57,10 @@ ButtonLink.propTypes = {
|
||||
* Default value is 'SIZES.AUTO'.
|
||||
*/
|
||||
size: PropTypes.oneOf(Object.values(BUTTON_LINK_SIZES)),
|
||||
/**
|
||||
* textProps accepts all the props from Text component
|
||||
*/
|
||||
textProps: PropTypes.shape(Text.PropTypes),
|
||||
/**
|
||||
* ButtonLink accepts all the props from ButtonBase
|
||||
*/
|
||||
|
@ -153,8 +153,13 @@ export const Size = (args) => (
|
||||
</ButtonLink>
|
||||
</Text>
|
||||
<Text variant={TEXT.BODY_XS}>
|
||||
Inherits the font-size of the parent element.{' '}
|
||||
<ButtonLink {...args} size={SIZES.INHERIT}>
|
||||
Inherits the font-size of the parent element and example with textProps
|
||||
override for a success color.{' '}
|
||||
<ButtonLink
|
||||
{...args}
|
||||
size={SIZES.INHERIT}
|
||||
textProps={{ color: COLORS.SUCCESS_DEFAULT }}
|
||||
>
|
||||
Learn more
|
||||
</ButtonLink>
|
||||
</Text>
|
||||
|
Loading…
Reference in New Issue
Block a user