import * as React from "react"; import * as _ from "lodash"; import Collapsible from "react-collapsible"; import { Sprite, SpriteType } from "../../components/Sprite"; type JSXFunction = () => JSX.Element; interface IAccordionProps { renderTitle: string | JSXFunction; renderSibling?: string | JSXFunction; renderContent?: () => JSX.Element; onClosing?: () => void; onOpening?: () => void; onClose?: () => void; onOpen?: () => void; } export class Accordion extends React.Component { public render() { return (
{_.isFunction(this.props.renderContent) && (
{(() => { return this.props.renderContent() })()}
)}
); } private renderTrigger = () => { return (
{_.isFunction(this.props.renderTitle) ? this.props.renderTitle() : this.props.renderTitle}
{this.props.renderSibling && (
{_.isFunction(this.props.renderSibling) ? this.props.renderSibling() : this.props.renderSibling}
)}
); } }