/* * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ import React from "react"; import { EuiButton, EuiFlexGroup, EuiFlexItem } from "@elastic/eui"; import { ModalConsumer } from "../Modal"; interface ContentPanelActionsProps { actions: { text: string; buttonProps?: object; flexItemProps?: object; children?: React.ReactChild; modal?: { onClickModal: (onShow: (component: any, props: object) => void) => () => void; }; }[]; } const ContentPanelActions: React.SFC = ({ actions }) => ( {actions.map(({ text, buttonProps = {}, flexItemProps = {}, modal = null, children }, index) => { let button = children ? ( children ) : ( {text} ); if (modal) { button = ( {({ onShow }) => ( {text} )} ); } return ( {button} ); })} ); export default ContentPanelActions;