1 | /*
|
2 | * Copyright 2017 Palantir Technologies, Inc. All rights reserved.
|
3 | *
|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | * you may not use this file except in compliance with the License.
|
6 | * You may obtain a copy of the License at
|
7 | *
|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
9 | *
|
10 | * Unless required by applicable law or agreed to in writing, software
|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 | * See the License for the specific language governing permissions and
|
14 | * limitations under the License.
|
15 | */
|
16 |
|
17 | import classNames from "classnames";
|
18 | import * as React from "react";
|
19 | import { polyfill } from "react-lifecycles-compat";
|
20 |
|
21 | import { AbstractPureComponent2, Alignment, Classes } from "../../common";
|
22 | import { DISPLAYNAME_PREFIX, HTMLDivProps, Props } from "../../common/props";
|
23 |
|
24 | // eslint-disable-next-line deprecation/deprecation
|
25 | export type NavbarGroupProps = INavbarGroupProps;
|
26 | /** @deprecated use NavbarGroupProps */
|
27 | export interface INavbarGroupProps extends Props, HTMLDivProps {
|
28 | /**
|
29 | * The side of the navbar on which the group should appear.
|
30 | * The `Alignment` enum provides constants for these values.
|
31 | *
|
32 | * @default Alignment.LEFT
|
33 | */
|
34 | align?: Alignment;
|
35 | }
|
36 |
|
37 | // this component is simple enough that tests would be purely tautological.
|
38 | /* istanbul ignore next */
|
39 |
|
40 | export class NavbarGroup extends AbstractPureComponent2<NavbarGroupProps> {
|
41 | public static displayName = `${DISPLAYNAME_PREFIX}.NavbarGroup`;
|
42 |
|
43 | public static defaultProps: NavbarGroupProps = {
|
44 | align: Alignment.LEFT,
|
45 | };
|
46 |
|
47 | public render() {
|
48 | const { align, children, className, ...htmlProps } = this.props;
|
49 | const classes = classNames(Classes.NAVBAR_GROUP, Classes.alignmentClass(align), className);
|
50 | return (
|
51 | <div className={classes} {...htmlProps}>
|
52 | {children}
|
53 | </div>
|
54 | );
|
55 | }
|
56 | }
|