Skip to content

Commit 4447d81

Browse files
authored
ref(ui): make "md" the new buttonBar gap default (#95551)
The `ButtonBar` component now: - takes spacing tokens as value for the `gap` prop - defaults to `gap=“md”`, as this were most of the usages That means places where we had `<ButtonBar gap=“1”>` are now just `<ButtonBar>`, whereas we need to pass `gap=“none”` explicitly in places where we want no spacing.
1 parent fa0ebe5 commit 4447d81

File tree

184 files changed

+219
-220
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+219
-220
lines changed

static/app/components/actions/archive.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ function ArchiveActions({
297297
});
298298

299299
return (
300-
<ButtonBar merged>
300+
<ButtonBar merged gap="none">
301301
<ArchiveButton
302302
size={size}
303303
className={className}

static/app/components/actions/resolve.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ function ResolveActions({
329329

330330
return (
331331
<Tooltip disabled={!projectFetchError} title={t('Error fetching project')}>
332-
<ButtonBar merged>
332+
<ButtonBar merged gap="none">
333333
<ResolveButton
334334
priority={priority}
335335
size={size}

static/app/components/alerts/snoozeAlert.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ function SnoozeAlert({
167167
);
168168
}
169169
return (
170-
<ButtonBar>
170+
<ButtonBar gap="none">
171171
<MuteButton
172172
size="sm"
173173
icon={<IconSound />}

static/app/components/assistant/guideAnchor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ class BaseGuideAnchor extends Component<Props, State> {
172172
}}
173173
wrapperComponent={wrapperComponent ?? GuideAnchorWrapper}
174174
actions={
175-
<ButtonBar gap={1}>
175+
<ButtonBar>
176176
{lastStep ? (
177177
<TourAction size="xs" onClick={this.handleFinish}>
178178
{currentStep.nextText ||

static/app/components/banner.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function Banner({
7373
<BannerContent>
7474
<BannerTitle>{title}</BannerTitle>
7575
<BannerSubtitle>{subtitle}</BannerSubtitle>
76-
<StyledButtonBar gap={1}>{children}</StyledButtonBar>
76+
<StyledButtonBar>{children}</StyledButtonBar>
7777
</BannerContent>
7878
</BannerWrapper>
7979
);

static/app/components/checkInTimeline/checkInTimeline.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export default Storybook.story('CheckInTimeline', story => {
102102
are contiguously the same status will be merged together visually.
103103
</p>
104104

105-
<Controls gap={1}>
105+
<Controls>
106106
<DatePageFilter triggerProps={{prefix: 'Time Window'}} />
107107
<CompactSelect
108108
triggerProps={{prefix: 'Spacing'}}

static/app/components/confirm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ function ConfirmModal({
324324
{makeConfirmMessage()}
325325
</Body>
326326
<Footer>
327-
<ButtonBar gap={2}>
327+
<ButtonBar gap="xl">
328328
{renderCancelButton ? (
329329
renderCancelButton({
330330
closeModal,

static/app/components/core/button/buttonBar.stories.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default Storybook.story('ButtonBar', (story, APIReference) => {
4545
is handled by the parent component, not the{' '}
4646
<Storybook.JSXNode name="ButtonBar" /> itself.
4747
</p>
48-
<ButtonBar>
48+
<ButtonBar gap="none">
4949
{['One', 'Two', 'Three'].map(id => (
5050
<Button key={id} {...makeProps(id)}>
5151
{id}
@@ -57,7 +57,7 @@ export default Storybook.story('ButtonBar', (story, APIReference) => {
5757
You can also pass the 'merged' prop to the{' '}
5858
<Storybook.JSXNode name="ButtonBar" /> to merge the buttons together.
5959
</p>
60-
<ButtonBar merged>
60+
<ButtonBar merged gap="none">
6161
{['One', 'Two', 'Three'].map(id => (
6262
<Button key={id} {...makeMergedProps(id)}>
6363
{id}
@@ -69,7 +69,7 @@ export default Storybook.story('ButtonBar', (story, APIReference) => {
6969
Managing the active state is optional, and you can also just use the buttonbar
7070
to manage the button layout.
7171
</p>
72-
<ButtonBar merged>
72+
<ButtonBar merged gap="none">
7373
{['One', 'Two', 'Three'].map(id => (
7474
<Button key={id}>{id}</Button>
7575
))}
@@ -79,7 +79,7 @@ export default Storybook.story('ButtonBar', (story, APIReference) => {
7979
<Storybook.JSXNode name="ButtonBar" />s can have a single button in which case
8080
it looks like a button.
8181
</p>
82-
<ButtonBar>
82+
<ButtonBar gap="none">
8383
<Button>One Lonely Button</Button>
8484
</ButtonBar>
8585
</Fragment>

static/app/components/core/button/buttonBar.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,34 @@
1+
import type {Theme} from '@emotion/react';
12
import {css} from '@emotion/react';
23
import styled from '@emotion/styled';
34

45
import {StyledButton} from 'sentry/components/core/button';
5-
// eslint-disable-next-line boundaries/element-types
6-
import type {ValidSize} from 'sentry/styles/space';
7-
// eslint-disable-next-line boundaries/element-types
8-
import {space} from 'sentry/styles/space';
6+
7+
type Gap = keyof Theme['space'];
98

109
interface ButtonBarProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'className'> {
1110
children: React.ReactNode;
12-
gap?: ValidSize | 0;
11+
gap?: Gap;
1312
merged?: boolean;
1413
}
1514

16-
export function ButtonBar({children, merged = false, gap = 0, ...props}: ButtonBarProps) {
15+
export function ButtonBar({
16+
children,
17+
merged = false,
18+
gap = 'md',
19+
...props
20+
}: ButtonBarProps) {
1721
return (
1822
<StyledButtonBar merged={merged} gap={gap} {...props}>
1923
{children}
2024
</StyledButtonBar>
2125
);
2226
}
2327

24-
const StyledButtonBar = styled('div')<{gap: ValidSize | 0; merged: boolean}>`
28+
const StyledButtonBar = styled('div')<{gap: Gap; merged: boolean}>`
2529
display: grid;
2630
grid-auto-flow: column;
27-
grid-column-gap: ${p => (p.gap === 0 ? '0' : space(p.gap))};
31+
grid-column-gap: ${p => p.theme.space[p.gap]};
2832
align-items: center;
2933
3034
${p => p.merged && MergedButtonBarStyles}

static/app/components/customIgnoreCountModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export default function CustomIgnoreCountModal(props: Props) {
7878
/>
7979
</Body>
8080
<Footer>
81-
<ButtonBar gap={1}>
81+
<ButtonBar>
8282
<Button onClick={closeModal}>{t('Cancel')}</Button>
8383
<Button priority="primary" onClick={handleSubmit}>
8484
{t('Ignore')}

0 commit comments

Comments
 (0)