/* @flow */ import React, { Component } from 'react' import classnames from 'classnames' import { isEmpty } from 'lodash' import FontAwesome from 'react-fontawesome' import Text from '../Text/Text' type Props = { bodyClass?: string, children: Array, className?: string, collapsed?: boolean, collapsible?: boolean, headingLinks?: Array, title?: string, titleIcon?: string, subTitle?: string, } import styles from './panel.scss' export default class Panel extends Component { static defaultProps = { className: "panel-default", collapsed: false, collapsible: false, } state = { collapsed: false, } componentWillMount() { this.setState({collapsed: this.props.collapsed}) } props: Props renderHeadingLinks() { const { headingLinks, } = this.props if(!headingLinks) return null return (
{headingLinks.map()}
) } renderHeadingTitle() { const { title, titleIcon, subTitle, } = this.props return (

{title} {subTitle}

) } renderToggle() { const {collapsed} = this.state return ( ) } renderBody() { const { children, collapsible, bodyClass, } = this.props if (collapsible && this.state.collapsed) return return (
{children}
) } render() { const { className, collapsible, title, headingLinks, } = this.props const { collapsed, } = this.state const css = [ styles.panel, "panel", collapsed ? styles["panel-collapsed"] : null, collapsible ? styles["panel-collapsible"] : null, className, ] const toggleCollapsed = () => { this.setState({collapsed: !this.state.collapsed}) } return (
{this.renderHeadingLinks()} {this.renderHeadingTitle()}
{this.renderToggle()}
{this.renderBody()}
) } }