mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-26 12:29:06 +01:00
a28d727caf
* add button component * add all button props * update tests * add button type prop * fix base button size const * add href prop to button base * Update ui/components/component-library/button/README.mdx Co-authored-by: George Marshall <george.marshall@consensys.net> * Update ui/components/component-library/button/README.mdx Co-authored-by: George Marshall <george.marshall@consensys.net> * update tests * Update ui/components/component-library/button-primary/button-primary.js Co-authored-by: George Marshall <george.marshall@consensys.net> * Update ui/components/component-library/button/README.mdx Co-authored-by: George Marshall <george.marshall@consensys.net> * Update ui/components/component-library/button/button.stories.js Co-authored-by: George Marshall <george.marshall@consensys.net> * Update ui/components/component-library/button/button.js Co-authored-by: George Marshall <george.marshall@consensys.net> * Update ui/components/component-library/button/button.stories.js Co-authored-by: George Marshall <george.marshall@consensys.net> * update button props on readme * linting issue fix Co-authored-by: George Marshall <george.marshall@consensys.net>
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_TYPES } from './button.constants';
|
|
|
|
export const Button = ({ type, ...props }) => {
|
|
switch (type) {
|
|
case BUTTON_TYPES.PRIMARY:
|
|
return <ButtonPrimary {...props} />;
|
|
case BUTTON_TYPES.SECONDARY:
|
|
return <ButtonSecondary {...props} />;
|
|
case BUTTON_TYPES.LINK:
|
|
return <ButtonLink {...props} />;
|
|
default:
|
|
return <ButtonPrimary {...props} />;
|
|
}
|
|
};
|
|
|
|
Button.propTypes = {
|
|
/**
|
|
* Select the type of Button.
|
|
* Possible values could be 'BUTTON_TYPES.PRIMARY', 'BUTTON_TYPES.SECONDARY', 'BUTTON_TYPES.LINK'
|
|
* Button will default to `BUTTON_TYPES.PRIMARY`
|
|
*/
|
|
type: PropTypes.oneOf(Object.values(BUTTON_TYPES)),
|
|
/**
|
|
* Button accepts all the props from ButtonPrimary (same props as ButtonSecondary & ButtonLink)
|
|
*/
|
|
...ButtonPrimary.propTypes,
|
|
};
|