mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-25 11:28:51 +01:00
1f0c0d041c
* Update Button prop name type to variant * fix: lint errors on running test cases * change remaining files * change typo: BUTTON_VARIANTS to BUTTON_VARIANT * fix: button.test.js lint errors * update: button instances & import in remaing files * fix: prettier warnings --------- Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com> Co-authored-by: Brad Decker <bhdecker84@gmail.com>
35 lines
1.0 KiB
JavaScript
35 lines
1.0 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { ButtonPrimary } from '../button-primary';
|
|
import { ButtonSecondary } from '../button-secondary';
|
|
import { ButtonLink } from '../button-link';
|
|
|
|
import { BUTTON_VARIANT } from './button.constants';
|
|
|
|
export const Button = ({ variant, ...props }) => {
|
|
switch (variant) {
|
|
case BUTTON_VARIANT.PRIMARY:
|
|
return <ButtonPrimary {...props} />;
|
|
case BUTTON_VARIANT.SECONDARY:
|
|
return <ButtonSecondary {...props} />;
|
|
case BUTTON_VARIANT.LINK:
|
|
return <ButtonLink {...props} />;
|
|
default:
|
|
return <ButtonPrimary {...props} />;
|
|
}
|
|
};
|
|
|
|
Button.propTypes = {
|
|
/**
|
|
* Select the variant of Button.
|
|
* Possible values could be 'BUTTON_VARIANT.PRIMARY', 'BUTTON_VARIANT.SECONDARY', 'BUTTON_VARIANT.LINK'
|
|
* Button will default to `BUTTON_VARIANT.PRIMARY`
|
|
*/
|
|
variant: PropTypes.oneOf(Object.values(BUTTON_VARIANT)),
|
|
/**
|
|
* Button accepts all the props from ButtonPrimary (same props as ButtonSecondary & ButtonLink)
|
|
*/
|
|
...ButtonPrimary.propTypes,
|
|
};
|