import React, {Component} from 'react'; import styled from "styled-components"; import _ from "lodash"; import {Button, Intent, Popover, PopoverInteractionKind, Tooltip} from "@blueprintjs/core"; import {Action} from "../components/PageHeader/components/ActionArea"; const Container = styled.div` display: grid; align-items: center; grid-gap: 4px; ` const PopoverContentContainer = styled.div` display: grid; padding: 8px; grid-gap: 8px; grid-template-rows: auto auto; > div { display: flex; justify-content: space-between; } ` export interface ActionButtonProps { action: Action noText: boolean minimal: boolean intent?: Intent } class ActionButton extends Component { static defaultProps: Partial = { action: {callback: () => null, iconName: 'badge', name: 'placeholder', text: 'Placeholder'}, noText: true, } state = { isPopoverOpen: false } handlePopoverConfirmClick = (e) => { this.props.action.callback(e) this.setState({isPopoverOpen: false}) } handlePopoverCancelClick = () => { this.setState({isPopoverOpen: false}) } handleInteraction = (nextOpenState) => { return this.setState({isPopoverOpen: nextOpenState}) } render() { const action = this.props.action; const intent = this.props.intent || action.intent || Intent.NONE; const enabled = action.enabled == null ? true : action.enabled const renderPopover = (button) => { return {this.props.action.confirmationText}
} interactionKind={PopoverInteractionKind.CLICK} isOpen={this.state.isPopoverOpen} onInteraction={(state) => this.handleInteraction(state)} > {button}
} const button =