msgba-web/js-src/components/center-element.tsx

28 lines
684 B
TypeScript

import * as React from 'react';
export interface CenterElementProps {
hidden?: boolean | undefined,
children?: React.ReactNode,
full?: boolean | undefined;
}
type IHash = {
[id: string]: string;
}
export default function CenterElement(props: CenterElementProps) {
const styles: IHash = {};
let hidden = props.hidden;
if (hidden == null) {
hidden = false;
}
styles["display"] = hidden ? 'none' : '';
let fullClassName = '';
if (props.full !== undefined && props.full) {
fullClassName = 'full-height';
}
return (
<div style={styles} className={`center-content ${fullClassName}`}>{props.children}</div>
);
}