-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCenterDiv.tsx
More file actions
30 lines (28 loc) · 1.2 KB
/
CenterDiv.tsx
File metadata and controls
30 lines (28 loc) · 1.2 KB
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
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import * as React from "react";
import classnames from "classnames";
import "./CenterDiv.scss";
import { CommonProps } from "./MobileUi";
/**
* Properties for {@link CenterDiv} component
* @public
*/
interface CenterDivProps extends CommonProps, React.DOMAttributes<HTMLDivElement> {
/** Set to true to have the {@link CenterDiv} fill 100% of its parent. Default: no */
fill?: boolean;
/** Children of this node */
children?: React.ReactNode;
}
/**
* A React component that centers its child both horizontally and vertically.
*
* Note: If there are multiple children, they will be arrayed in a horizontal flex layout.
* @public
*/
export function CenterDiv(props: CenterDivProps) {
const { fill, children, className, ...others } = props;
return <div className={classnames("mui-center-div", fill && "mui-fill", className)} {...others} ><div>{children}</div></div>;
}