import * as React from 'react' import * as cx from 'classnames' import { StylableComponent } from '../theme' import { Icon } from '../icon' import { AccordionSectionProps } from './interfaces' const styles = require('../../../src/components/accordion/styles.scss') export class AccordionSection extends StylableComponent { public render(): JSX.Element { const { title, children, expanded, onToggle } = this.props return (
{title}
{this.bodyNode()}
) } private bodyNode(): JSX.Element | null { const { children, expanded } = this.props if (!expanded) return null return (
{children}
) } // private sectionStyles(): object { // } private sectionStyles(): object { const { expanded } = this.props return { borderColor: expanded ? this.primary() : this.gray(100), backgroundColor: expanded ? this.primary() : this.gray(100), color: expanded ? 'white' : this.gray(800), } } private headerStyles(): object { const { expanded } = this.props return { backgroundColor: expanded ? this.primary() : this.gray(100), color: expanded ? 'white' : this.gray(800), } } }