2019-04-09 22:00:03 -06:00
|
|
|
import * as React from "react";
|
|
|
|
import { t } from "../i18next_wrapper";
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
onClick(): void;
|
|
|
|
title: string;
|
|
|
|
expanded: boolean;
|
|
|
|
}
|
|
|
|
|
2019-12-10 12:53:20 -07:00
|
|
|
export const ExpandableHeader = (props: Props) => {
|
2019-04-09 22:00:03 -06:00
|
|
|
const { onClick, title, expanded } = props;
|
|
|
|
const icon_string = expanded ? "minus" : "plus";
|
2019-10-04 14:10:50 -06:00
|
|
|
const nbwhitespace = title != "";
|
2019-04-09 22:00:03 -06:00
|
|
|
return <h4 className="expandable-header" onClick={onClick}>
|
|
|
|
{t(title)}
|
2019-10-04 14:10:50 -06:00
|
|
|
{nbwhitespace &&
|
|
|
|
"\u00A0\u00A0"
|
|
|
|
}
|
2019-04-09 22:00:03 -06:00
|
|
|
<span className="icon-toggle">
|
2019-10-04 14:10:50 -06:00
|
|
|
[<i className={`fa fa-${icon_string}`} />]
|
2019-04-09 22:00:03 -06:00
|
|
|
</span>
|
|
|
|
</h4>;
|
|
|
|
};
|