import * as React from "react"; import ReportProblemForm from "./ReportProblemForm"; import { ComplaintData } from "../interfaces"; export interface ReportProblemLinkProps extends React.HTMLProps { reportUrl: string; report: (url: string, data: ComplaintData) => Promise; fetchTypes: (url: string) => Promise; types: string[]; } export default class ReportProblemLink extends React.Component { constructor(props) { super(props); this.state = { showForm: false }; this.openForm = this.openForm.bind(this); this.closeForm = this.closeForm.bind(this); } render() { const { ref, reportUrl, ...props } = this.props; return (
Report a Problem { this.state.showForm && }
); } openForm() { this.setState({ showForm: true }); } closeForm() { this.setState({ showForm: false }); } }