23 lines
510 B
TypeScript
23 lines
510 B
TypeScript
import * as React from 'react';
|
|
|
|
export interface CenterElementProps {
|
|
hidden?: boolean | undefined,
|
|
children?: React.ReactNode,
|
|
}
|
|
|
|
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' : '';
|
|
return (
|
|
<div style={styles} className="center-content">{props.children}</div>
|
|
);
|
|
}
|