import { css } from '@emotion/css'; import React from 'react'; import { IconButton } from './IconButton'; interface Props { index: number; elements: any[]; onAdd: () => void; onRemove: () => void; } /** * A component used to show add & remove buttons for mutable lists of values. Wether to show or not the add or the remove buttons * depends on the `index` and `elements` props. This enforces a consistent experience whenever this pattern is used. */ export const AddRemove = ({ index, onAdd, onRemove, elements }: Props) => { return (
{index === 0 && } {elements.length >= 2 && }
); };