Files
flipper/src/ui/components/ButtonGroup.tsx
Daniel Büchele 5cb12c3b1f Button components
Summary: _typescript_

Reviewed By: passy, bnelo12

Differential Revision: D16830539

fbshipit-source-id: a44ad0914b2581648b06e421476e0ba31ae96992
2019-08-20 05:45:47 -07:00

46 lines
944 B
TypeScript

/**
* Copyright 2018-present Facebook.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
* @format
*/
import styled from 'react-emotion';
import React, {Component} from 'react';
import PropTypes from 'prop-types';
const ButtonGroupContainer = styled('div')({
display: 'inline-flex',
marginLeft: 10,
'&:first-child': {
marginLeft: 0,
},
});
/**
* Group a series of buttons together.
*
* ```jsx
* <ButtonGroup>
* <Button>One</Button>
* <Button>Two</Button>
* <Button>Three</Button>
* </ButtonGroup>
* ```
*/
export default class ButtonGroup extends Component<{
children: React.ReactNode;
}> {
static childContextTypes = {
inButtonGroup: PropTypes.bool,
};
getChildContext() {
return {inButtonGroup: true};
}
render() {
return <ButtonGroupContainer>{this.props.children}</ButtonGroupContainer>;
}
}