Files
web2.0-frontend/src/components/PageSection/PageSection.tsx
T
2018-11-17 15:09:04 +02:00

34 lines
747 B
TypeScript

import * as React from "react";
import "./PageSection.scss";
export enum BackgroundColor {
DarkBlue,
White,
Orange,
}
export interface PageSectionProps {
backgroundColor: BackgroundColor;
}
export interface PageSectionState {}
const colors = new Map<BackgroundColor, string>([
[BackgroundColor.DarkBlue, "dark-blue"],
[BackgroundColor.White, "white"],
[BackgroundColor.Orange, "orange"],
]);
class PageSection extends React.Component<PageSectionProps, PageSectionState> {
render() {
const { backgroundColor, children } = this.props;
const className = `page-section ${colors.get(backgroundColor)}`;
return (
<div className={className}>
{children}
</div>
);
}
}
export default PageSection;