/
controlGroup.tsx
47 lines (40 loc) · 1.32 KB
/
controlGroup.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
*/
import classNames from "classnames";
import * as React from "react";
import * as Classes from "../../common/classes";
import { IProps } from "../../common/props";
export interface IControlGroupProps extends React.AllHTMLAttributes<HTMLDivElement>, IProps {
/**
* Whether the control group should take up the full width of its container.
*/
fill?: boolean;
/**
* Whether the button group should appear with vertical styling.
*/
vertical?: boolean;
}
// this component is simple enough that tests would be purely tautological.
/* istanbul ignore next */
export class ControlGroup extends React.PureComponent<IControlGroupProps, {}> {
public static displayName = "Blueprint2.ControlGroup";
public render() {
const { children, className, fill, vertical, ...htmlProps } = this.props;
const rootClasses = classNames(
Classes.CONTROL_GROUP,
{
[Classes.FILL]: fill,
[Classes.VERTICAL]: vertical,
},
className,
);
return (
<div {...htmlProps} className={rootClasses}>
{children}
</div>
);
}
}