import * as React from "react"; import ConfirmationPopup from "./ConfirmationPopup"; import { BookData } from "opds-web-client/lib/interfaces"; export interface RevokeButtonProps extends React.HTMLProps { revoke: () => Promise; } export interface RevokeButtonState { showConfirmationPopup: boolean; } export default class RevokeButton extends React.Component { constructor(props) { super(props); this.state = { showConfirmationPopup: false }; this.showConfirmationPopup = this.showConfirmationPopup.bind(this); this.hideConfirmationPopup = this.hideConfirmationPopup.bind(this); this.revoke = this.revoke.bind(this); } render() { const { revoke, ref, onCopy, ...props } = this.props; return (
{ this.state.showConfirmationPopup && }
); } showConfirmationPopup() { this.setState({ showConfirmationPopup: true }); } hideConfirmationPopup() { this.setState({ showConfirmationPopup: false }); } revoke() { this.hideConfirmationPopup(); return this.props.revoke(); } }