35 lines
847 B
TypeScript
35 lines
847 B
TypeScript
import * as React from "react";
|
|
import "./SectionDividerWidget.scss";
|
|
import Icon from "../Icon";
|
|
import { IconType } from "../Icon/Icon";
|
|
|
|
export interface SectionDividerWidgetProps {
|
|
label: string;
|
|
}
|
|
export interface SectionDividerWidgetState { }
|
|
|
|
const getIconByLabel = (label: string) => {
|
|
if (label === "Finnish") {
|
|
return <Icon name={IconType.FinlandFlag} />
|
|
}
|
|
if (label === "English") {
|
|
return <Icon name={IconType.GBFlag} />
|
|
}
|
|
console.error(`No icon found for label: ${label}`);
|
|
return null;
|
|
}
|
|
|
|
class SectionDividerWidget extends React.Component<SectionDividerWidgetProps, SectionDividerWidgetState> {
|
|
render() {
|
|
const { label } = this.props;
|
|
|
|
return (
|
|
<h3 className="section-divider-widget">
|
|
{label} {getIconByLabel(label)}
|
|
</h3>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default SectionDividerWidget;
|