import {ChevronLeftIcon, ChevronRightIcon, DeleteIcon} from '@chakra-ui/icons' import { Box, ButtonGroup, Divider, HStack, IconButton, Popover, PopoverArrow, PopoverBody, PopoverCloseButton, PopoverContent, PopoverHeader, PopoverTrigger, Portal, Select } from '@chakra-ui/react' import * as React from 'react' import {ISectionConnection} from '../../../../../connectors' export type Props = { trigger: React.ReactNode header: React.ReactNode sections: Array disabled?: boolean disablePrepandSection?: boolean disableAppendSection?: boolean id: string ptrNext: string | null ptrPrev: string | null onDelete: (id: string, ptrPrev: string | null, ptrNext: string | null) => void onAppend: (sectionName: string, id: string, ptrNext: string | null) => void onPrepend: (sectionName: string, id: string, ptrPrev: string | null) => void } const SectionManagePopover = React.memo( ({ trigger, header, sections, disabled, disablePrepandSection, disableAppendSection, id, ptrNext, ptrPrev, onDelete, onAppend, onPrepend }) => { const [sectionName, setSectionName] = React.useState(sections[0].name) return ( {({isOpen, onClose, forceUpdate}: any) => ( <> {trigger} Manage Section } onClick={() => { onPrepend(sectionName, id, ptrPrev) onClose() }} /> } onClick={() => { onAppend(sectionName, id, ptrNext) onClose() }} /> } onClick={() => { onDelete(id, ptrPrev, ptrNext) onClose() }} size="sm" /> )} ) } ) export default SectionManagePopover