@ustack/uskin
Version:
A graceful framework which provides developers another chance to build an amazing site.
42 lines (31 loc) • 803 B
JSX
import PropTypes from 'prop-types';
import React from 'react';
import styles from '../../mixins/styles';
class ButtonGroup extends React.Component {
constructor(props) {
super(props);
}
getClassName(props) {
let className = 'btn-group';
(props.type === 'vertical') && (className += '-vertical');
(props.width) && (className += ' btn-group-justified');
return className;
}
render() {
const props = this.props;
const style = styles.getWidth(props.width);
return (
<div className={this.getClassName(props)} style={style}>
{props.children}
</div>
);
}
}
ButtonGroup.propTypes = {
type: PropTypes.oneOf(['vertical']),
width: PropTypes.oneOfType([
PropTypes.number,
PropTypes.string
])
};
export default ButtonGroup;