blob: 49da2c044b9e7da20a0da0c0f299d9eb461e5afb [file]
import React from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import { getLink } from '../../../utils';
import './index.scss';
const propTypes = {
type: PropTypes.oneOf(['primary', 'normal']),
link: PropTypes.string,
target: PropTypes.string,
};
const defaultProps = {
type: 'primary',
link: '',
target: '_self',
};
const Button = (props) => {
return (
<a
className={
classnames({
button: true,
[`button-${props.type}`]: true,
})
}
target={props.target || '_self'}
href={getLink(props.link)}
>
{props.children}
</a>
);
};
Button.propTypes = propTypes;
Button.defaultProps = defaultProps;
export default Button;