UNPKG

@bigfishtv/cockpit

Version:

47 lines (42 loc) 1.27 kB
import PropTypes from 'prop-types' import React, { Component } from 'react' import Button from '../Button' import DropdownButton from './DropdownButton' /** * Is a Button with a DropdownButton */ export default class DropdownAction extends Component { static propTypes = { /** Size string as per turret guidelines i.e. xsmall, small, medium, large, xlarge */ size: PropTypes.string, /** Button's text */ text: PropTypes.string, /** Outputs custom button class e.g 'primary' = 'button-primary' */ style: PropTypes.string, /** Direction of dropdown menu -- up or down */ direction: PropTypes.oneOf(['up', 'down']), /** whether or not to align dropdown menu to left of button */ pullRight: PropTypes.bool, /** onClick callback */ onClick: PropTypes.func, } static defaultProps = { size: 'medium', text: 'Dropdown', style: 'default', direction: 'down', pullRight: true, onClick: () => console.warn('no default onClick prop provided for DropdownAction'), } render() { const { text, children, pullRight, ...props } = this.props return ( <div className="button-group"> <Button text={text} {...props} /> <DropdownButton pullRight={pullRight} {...props}> {children} </DropdownButton> </div> ) } }