All Downloads are FREE. Search and download functionalities are using the official Maven repository.

components.widgets.Form.fieldsets.MultiFieldset.MultiFieldsetItemToolbar.tsx Maven / Gradle / Ivy

There is a newer version: 7.28.2
Show newest version
import React from 'react'
import { Button } from 'reactstrap'

export interface Props {
    needCopyButton: boolean
    needRemoveButton: boolean
    disabled: boolean
    index: number
    canRemoveFirstItem: boolean
    onRemoveField(index: number): void
    onCopyField(index: number): void
}

/* FIXME сделать нормальный toolbar */
export function MultiFieldsetItemToolbar({
    needCopyButton,
    needRemoveButton,
    disabled,
    index,
    canRemoveFirstItem,
    onRemoveField,
    onCopyField,
}: Props) {
    const onCopyClick = () => onCopyField(index)
    const onRemoveClick = () => onRemoveField(index)

    return (
        
{needCopyButton && ( )} {needRemoveButton && index > +!canRemoveFirstItem - 1 && ( )}
) }