Summary: adding documentation for more of our UI components. Deleted some unused components, which were not working anyways. Reviewed By: jknoxville Differential Revision: D12896109 fbshipit-source-id: 959c7864240883869ad67283f80a3c189b94bf00
47 lines
942 B
JavaScript
47 lines
942 B
JavaScript
/**
|
|
* 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 '../styled/index.js';
|
|
import {Component} from 'react';
|
|
|
|
const PropTypes = require('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$Node,
|
|
}> {
|
|
getChildContext() {
|
|
return {inButtonGroup: true};
|
|
}
|
|
|
|
render() {
|
|
return <ButtonGroupContainer>{this.props.children}</ButtonGroupContainer>;
|
|
}
|
|
}
|
|
|
|
ButtonGroup.childContextTypes = {
|
|
inButtonGroup: PropTypes.bool,
|
|
};
|