/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ import React, { Component } from "react"; import PropTypes from "prop-types"; import "./Dropdown.css"; export class Dropdown extends Component { constructor(props) { super(props); this.state = { dropdownShown: false, }; } static get propTypes() { return { icon: PropTypes.node.isRequired, panel: PropTypes.node.isRequired, }; } toggleDropdown = e => { this.setState(prevState => ({ dropdownShown: !prevState.dropdownShown, })); }; renderPanel() { return (
{this.props.panel}
); } renderButton() { return ( ); } renderMask() { return (
); } render() { return (
{this.renderPanel()} {this.renderButton()} {this.renderMask()}
); } } export default Dropdown;