All files / applications/go-by-transit/src/view/lineDetail/component CollapsiblePane.tsx

87.5% Statements 7/8
50% Branches 1/2
75% Functions 3/4
87.5% Lines 7/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55                                  1x               1x   1x       1x                   1x 1x   1x                    
import { Card, CardBody, CardHeader } from "@wintermuted/ui-react";
import React from "react";
import "./CollapsiblePane.scss";
 
interface Props {
  className: string;
  title: string;
  open: boolean;
  children?: React.ReactNode;
}
 
interface State {
  open: boolean;
}
 
export default class CollapsiblePane extends React.Component<Props, State> {
  private static getPaneContents(className, children) {
    return (
      // <article className={`${className}`}>
      <div>{children}</div>
      // </article>
    );
  }
 
  constructor(props) {
    super(props);
 
    this.state = {
      open: this.props.open || true
    };
 
    this.handleToggleClick = this.handleToggleClick.bind(this);
  }
 
  public handleToggleClick() {
    this.setState({
      open: !this.state.open
    });
  }
 
  public render() {
    const { title, className, children } = this.props;
    const { open } = this.state;
 
    return (
      <Card>
        <CardHeader>{title}</CardHeader>
        <CardBody>
          {CollapsiblePane.getPaneContents(className, children)}
        </CardBody>
      </Card>
    );
  }
}