Skip to content
2 changes: 1 addition & 1 deletion static/app/components/actions/archive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ function ArchiveActions({
});

return (
<ButtonBar merged>
<ButtonBar merged gap="none">
<ArchiveButton
size={size}
className={className}
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/actions/resolve.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ function ResolveActions({

return (
<Tooltip disabled={!projectFetchError} title={t('Error fetching project')}>
<ButtonBar merged>
<ButtonBar merged gap="none">
<ResolveButton
priority={priority}
size={size}
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/alerts/snoozeAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ function SnoozeAlert({
);
}
return (
<ButtonBar>
<ButtonBar gap="none">
<MuteButton
size="sm"
icon={<IconSound />}
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/assistant/guideAnchor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class BaseGuideAnchor extends Component<Props, State> {
}}
wrapperComponent={wrapperComponent ?? GuideAnchorWrapper}
actions={
<ButtonBar gap={1}>
<ButtonBar>
{lastStep ? (
<TourAction size="xs" onClick={this.handleFinish}>
{currentStep.nextText ||
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function Banner({
<BannerContent>
<BannerTitle>{title}</BannerTitle>
<BannerSubtitle>{subtitle}</BannerSubtitle>
<StyledButtonBar gap={1}>{children}</StyledButtonBar>
<StyledButtonBar>{children}</StyledButtonBar>
</BannerContent>
</BannerWrapper>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export default Storybook.story('CheckInTimeline', story => {
are contiguously the same status will be merged together visually.
</p>

<Controls gap={1}>
<Controls>
<DatePageFilter triggerProps={{prefix: 'Time Window'}} />
<CompactSelect
triggerProps={{prefix: 'Spacing'}}
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/confirm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ function ConfirmModal({
{makeConfirmMessage()}
</Body>
<Footer>
<ButtonBar gap={2}>
<ButtonBar gap="xl">
{renderCancelButton ? (
renderCancelButton({
closeModal,
Expand Down
8 changes: 4 additions & 4 deletions static/app/components/core/button/buttonBar.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default Storybook.story('ButtonBar', (story, APIReference) => {
is handled by the parent component, not the{' '}
<Storybook.JSXNode name="ButtonBar" /> itself.
</p>
<ButtonBar>
<ButtonBar gap="none">
{['One', 'Two', 'Three'].map(id => (
<Button key={id} {...makeProps(id)}>
{id}
Expand All @@ -57,7 +57,7 @@ export default Storybook.story('ButtonBar', (story, APIReference) => {
You can also pass the 'merged' prop to the{' '}
<Storybook.JSXNode name="ButtonBar" /> to merge the buttons together.
</p>
<ButtonBar merged>
<ButtonBar merged gap="none">
{['One', 'Two', 'Three'].map(id => (
<Button key={id} {...makeMergedProps(id)}>
{id}
Expand All @@ -69,7 +69,7 @@ export default Storybook.story('ButtonBar', (story, APIReference) => {
Managing the active state is optional, and you can also just use the buttonbar
to manage the button layout.
</p>
<ButtonBar merged>
<ButtonBar merged gap="none">
{['One', 'Two', 'Three'].map(id => (
<Button key={id}>{id}</Button>
))}
Expand All @@ -79,7 +79,7 @@ export default Storybook.story('ButtonBar', (story, APIReference) => {
<Storybook.JSXNode name="ButtonBar" />s can have a single button in which case
it looks like a button.
</p>
<ButtonBar>
<ButtonBar gap="none">
<Button>One Lonely Button</Button>
</ButtonBar>
</Fragment>
Expand Down
20 changes: 12 additions & 8 deletions static/app/components/core/button/buttonBar.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
import type {Theme} from '@emotion/react';
import {css} from '@emotion/react';
import styled from '@emotion/styled';

import {StyledButton} from 'sentry/components/core/button';
// eslint-disable-next-line boundaries/element-types
import type {ValidSize} from 'sentry/styles/space';
// eslint-disable-next-line boundaries/element-types
import {space} from 'sentry/styles/space';

type Gap = keyof Theme['space'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have our own Space type that doesn't rely on module augmentation from @emotion/react? This will be a large part of our component API surface moving forward.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this just depends where we import theme from. not sure why exactly we augment the emotion types instead of having our own useTheme hook and Theme type 🤷

But yes, we can definitely streamline this type once we have more components that have a prop that needs space


interface ButtonBarProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'className'> {
children: React.ReactNode;
gap?: ValidSize | 0;
gap?: Gap;
merged?: boolean;
}

export function ButtonBar({children, merged = false, gap = 0, ...props}: ButtonBarProps) {
export function ButtonBar({
children,
merged = false,
gap = 'md',
...props
}: ButtonBarProps) {
return (
<StyledButtonBar merged={merged} gap={gap} {...props}>
{children}
</StyledButtonBar>
);
}

const StyledButtonBar = styled('div')<{gap: ValidSize | 0; merged: boolean}>`
const StyledButtonBar = styled('div')<{gap: Gap; merged: boolean}>`
display: grid;
grid-auto-flow: column;
grid-column-gap: ${p => (p.gap === 0 ? '0' : space(p.gap))};
grid-column-gap: ${p => p.theme.space[p.gap]};
align-items: center;
${p => p.merged && MergedButtonBarStyles}
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/customIgnoreCountModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default function CustomIgnoreCountModal(props: Props) {
/>
</Body>
<Footer>
<ButtonBar gap={1}>
<ButtonBar>
<Button onClick={closeModal}>{t('Cancel')}</Button>
<Button priority="primary" onClick={handleSubmit}>
{t('Ignore')}
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/customIgnoreDurationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export default function CustomIgnoreDurationModal(props: Props) {
</Alert.Container>
)}
<Footer>
<ButtonBar gap={1}>
<ButtonBar>
<Button priority="default" onClick={closeModal}>
{t('Cancel')}
</Button>
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/deprecatedSmartSearchBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2121,7 +2121,7 @@ class DeprecatedSmartSearchBar extends Component<DefaultProps & Props, State> {
{useFormWrapper ? <form onSubmit={this.onSubmit}>{input}</form> : input}
</InputWrapper>

<ActionsBar gap={0.5}>
<ActionsBar gap="xs">
{query !== '' && !disabled && (
<ActionButton
type="button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function SearchDropdown({
)}

<DropdownFooter>
<ButtonBar gap={1}>
<ButtonBar>
{runShortcut &&
visibleShortcuts?.map(shortcut => (
<Button
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/errors/detailedError.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function DetailedError({className, heading, message, onRetry, hideSupportLinks}:
<div>{onRetry && <Button onClick={onRetry}>{t('Retry')}</Button>}</div>

{!hideSupportLinks && (
<ButtonBar gap={1.5}>
<ButtonBar gap="lg">
{lastEventId && (
<Button
priority="link"
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/events/autofix/autofixChanges.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ export function AutofixChanges({
</ChatButton>
</HeaderText>
{!prsMade && (
<ButtonBar gap={1}>
<ButtonBar>
{branchesMade ? (
step.changes.length === 1 && step.changes[0] ? (
<BranchButton change={step.changes[0]} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function AutofixInsightCard({
}
}}
/>
<ButtonBar merged>
<ButtonBar merged gap="none">
<Button
type="button"
size="sm"
Expand Down Expand Up @@ -403,7 +403,7 @@ function CollapsibleChainLink({
}
}}
/>
<ButtonBar merged>
<ButtonBar merged gap="none">
<Button
type="button"
size="sm"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ function AutofixRootCauseDisplay({
<IconChat size="xs" />
</ChatButton>
</HeaderText>
<ButtonBar>
<ButtonBar gap="none">
<CopyRootCauseButton cause={cause} />
</ButtonBar>
</HeaderWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export function AutofixSetupWriteAccessModal({
</Body>
{!canCreatePullRequests && (
<Footer>
<ButtonBar gap={1}>
<ButtonBar>
<Button onClick={closeModal}>{t('Later')}</Button>
<LinkButton
href="https://github.com/apps/seer-by-sentry/installations/new"
Expand Down
6 changes: 3 additions & 3 deletions static/app/components/events/autofix/autofixSolution.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -487,13 +487,13 @@ function AutofixSolutionDisplay({
<IconChat size="xs" />
</ChatButton>
</HeaderText>
<ButtonBar gap={1}>
<ButtonBar>
<ButtonBar>
<ButtonBar gap="none">
{!isEditing && (
<CopySolutionButton solution={solution} isEditing={isEditing} />
)}
</ButtonBar>
<ButtonBar>
<ButtonBar gap="none">
<Tooltip
isHoverable
title={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export default function BreadcrumbsDataSection({
: BreadcrumbTimeDisplay.ABSOLUTE;

const actions = (
<ButtonBar gap={1}>
<ButtonBar>
<Button
aria-label={t('Open Breadcrumb Search')}
icon={<IconSearch size="xs" />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export function BreadcrumbsDrawer({
);

const actions = (
<ButtonBar gap={1}>
<ButtonBar>
<InputGroup>
<SearchInput
size="xs"
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/events/eventAttachmentActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function EventAttachmentActions({
const hasPreview = hasInlineAttachmentRenderer(attachment);

return (
<ButtonBar gap={1}>
<ButtonBar>
{withPreviewButton && (
<Button
size="xs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ function DifferentialFlamegraphChangedFunctionsTitle(props: {
{props.subtitle}
</DifferentialFlamegraphChangedFunctionsSubtitleText>
</DifferentialFlamegraphChangedFunctionsTitleText>
<ButtonBar merged>
<ButtonBar merged gap="none">
<DifferentialFlamegraphPaginationButton
size="xs"
disabled={!props.onPreviousPageClick}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function Screenshot({
</StyledPanelBody>
{!onlyRenderScreenshot && (
<StyledPanelFooter>
<ButtonBar gap={1}>
<ButtonBar>
<Button
size="xs"
onClick={() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export default function ScreenshotModal({
</Flex>
</Body>
<Footer>
<ButtonBar gap={1}>
<ButtonBar>
{onDelete && (
<Confirm
confirmText={t('Delete')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export function EventTagsDataSection({
}, [event.tags]);

const actions = (
<ButtonBar gap={1}>
<ButtonBar>
{additionalActions}
<SegmentedControl
size="xs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export default function FeatureFlagInlineCTA({
}

const actions = (
<ButtonBar gap={1}>
<ButtonBar>
{feedbackButton}
<FeatureFlagSettingsButton orgSlug={organization.slug} />
</ButtonBar>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function EventFeatureFlagDrawer({
);

const actions = (
<ButtonBar gap={1}>
<ButtonBar>
<InputGroup>
<SearchInput
size="xs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ function BaseEventFeatureFlagList({event, group, project}: EventFeatureFlagSecti
}

const actions = (
<ButtonBar gap={1}>
<ButtonBar>
{feedbackButton}
<FeatureFlagSettingsButton orgSlug={organization.slug} />
{hasFlags && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ export default function EditHighlightsModal({
<IconInfo />
<div>{t('Changes are applied to all issues for this project')}</div>
</FooterInfo>
<ButtonBar gap={1}>
<ButtonBar>
<Button
onClick={() => {
trackAnalytics('highlights.edit_modal.cancel_clicked', {organization});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ export default function HighlightsDataSection({
data-test-id="event-highlights"
actions={
<ErrorBoundary mini>
<ButtonBar gap={1}>
<ButtonBar>
{viewAllButton}
<EditHighlightsButton project={project} event={event} />
</ButtonBar>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export function CronTimelineSection({event, organization, project}: Props) {
(new Date(event.dateReceived).valueOf() - start.valueOf()) / msPerPixel;

const actions = (
<ButtonBar gap={1}>
<ButtonBar>
<LinkButton
size="xs"
icon={<IconOpen />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function Actions({
const actions = (
<Access access={['project:write']}>
{({hasAccess}) => (
<ButtonBar gap={1}>
<ButtonBar>
<Tooltip disabled={hasRole} title={noPermissionToDownloadDebugFilesInfo}>
<LinkButton
size="xs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ export function DebugImageDetails({
</Content>
</Body>
<Footer>
<StyledButtonBar gap={1}>
<StyledButtonBar>
<LinkButton
href="https://docs.sentry.io/platforms/native/data-management/debug-files/"
external
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ function StacktraceLinkModal({
</ModalContainer>
</Body>
<Footer>
<ButtonBar gap={1}>
<ButtonBar>
<Button onClick={closeModal}>{t('Cancel')}</Button>
<Button priority="primary" onClick={handleSubmit}>
{t('Save')}
Expand Down
Loading
Loading