import {Children, cloneElement, isValidElement} from 'react'; import {css} from '@emotion/react'; import styled from '@emotion/styled'; import classNames from 'classnames'; import {ButtonProps, StyledButton} from 'sentry/components/button'; import space, {ValidSize} from 'sentry/styles/space'; type ButtonBarProps = { children: React.ReactNode; active?: ButtonProps['barId']; className?: string; gap?: ValidSize; merged?: boolean; }; function ButtonBar({ children, className, active, merged = false, gap = 0, }: ButtonBarProps) { const shouldCheckActive = typeof active !== 'undefined'; return ( {!shouldCheckActive ? children : Children.map(children, child => { if (!isValidElement(child)) { return child; } const {props: childProps, ...childWithoutProps} = child; // We do not want to pass `barId` to