Skip to content

Commit 87343d4

Browse files
JonasBacursoragentgetsantry[bot]
authored
flex: use core component (#99790)
Replace some usages of styled(div) with core Flex component --------- Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
1 parent 23157ee commit 87343d4

File tree

8 files changed

+36
-55
lines changed

8 files changed

+36
-55
lines changed

static/app/components/badge/groupPriority.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {IconCellSignal} from 'sentry/components/badge/iconCellSignal';
1010
import {Tag} from 'sentry/components/core/badge/tag';
1111
import {Button} from 'sentry/components/core/button';
1212
import {LinkButton} from 'sentry/components/core/button/linkButton';
13+
import {Flex} from 'sentry/components/core/layout';
1314
import {Tooltip} from 'sentry/components/core/tooltip';
1415
import type {MenuItemProps} from 'sentry/components/dropdownMenu';
1516
import {DropdownMenu} from 'sentry/components/dropdownMenu';
@@ -193,9 +194,9 @@ export function GroupPriorityDropdown({
193194
<DropdownMenu
194195
size="sm"
195196
menuTitle={
196-
<MenuTitleContainer>
197+
<Flex align="end" justify="between">
197198
<div>{t('Set Priority')}</div>
198-
</MenuTitleContainer>
199+
</Flex>
199200
}
200201
minMenuWidth={230}
201202
trigger={(triggerProps, isOpen) => (
@@ -269,12 +270,6 @@ const InlinePlaceholder = styled(Placeholder)`
269270
vertical-align: middle;
270271
`;
271272

272-
const MenuTitleContainer = styled('div')`
273-
display: flex;
274-
align-items: flex-end;
275-
justify-content: space-between;
276-
`;
277-
278273
const StyledFooter = styled(DropdownMenuFooter)`
279274
max-width: 230px;
280275
${p => p.theme.overflowEllipsis};

static/app/components/timeRangeSelector/index.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import styled from '@emotion/styled';
44
import {Button} from 'sentry/components/core/button';
55
import type {SelectOption, SingleSelectProps} from 'sentry/components/core/compactSelect';
66
import {CompactSelect} from 'sentry/components/core/compactSelect';
7+
import {Flex} from 'sentry/components/core/layout';
78
import DropdownButton from 'sentry/components/dropdownButton';
89
import HookOrDefault from 'sentry/components/hookOrDefault';
910
import {DesyncedFilterIndicator} from 'sentry/components/organizations/pageFilters/desyncedFilter';
@@ -451,7 +452,7 @@ export function TimeRangeSelector({
451452
<FooterWrap>
452453
<FooterInnerWrap>{menuFooter as React.ReactNode}</FooterInnerWrap>
453454
{showAbsoluteSelector && (
454-
<AbsoluteSelectorFooter>
455+
<Flex gap="md" justify="end">
455456
{showRelative && (
456457
<Button
457458
size="xs"
@@ -473,7 +474,7 @@ export function TimeRangeSelector({
473474
>
474475
{t('Apply')}
475476
</Button>
476-
</AbsoluteSelectorFooter>
477+
</Flex>
477478
)}
478479
</FooterWrap>
479480
</Fragment>
@@ -520,12 +521,6 @@ const StyledDateRangeHook = styled(DateRangeHook)`
520521
width: max-content;
521522
`;
522523

523-
const AbsoluteSelectorFooter = styled('div')`
524-
display: flex;
525-
gap: ${space(1)};
526-
justify-content: flex-end;
527-
`;
528-
529524
const FooterMessage = styled('p')`
530525
padding: ${space(0.75)} ${space(1)};
531526
margin: ${space(0.5)} 0;

static/app/data/forms/projectGeneralSettings.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {PlatformIcon} from 'platformicons';
44
import {hasEveryAccess} from 'sentry/components/acl/access';
55
import {CodeSnippet} from 'sentry/components/codeSnippet';
66
import {Button} from 'sentry/components/core/button';
7+
import {Flex} from 'sentry/components/core/layout';
78
import {Link} from 'sentry/components/core/link';
89
import {createFilter} from 'sentry/components/forms/controls/reactSelectWrapper';
910
import type {Field} from 'sentry/components/forms/types';
@@ -44,10 +45,6 @@ const ORG_DISABLED_REASON = t(
4445
"This option is enforced by your organization's settings and cannot be customized per-project."
4546
);
4647

47-
const PlatformWrapper = styled('div')`
48-
display: flex;
49-
align-items: center;
50-
`;
5148
const StyledPlatformIcon = styled(PlatformIcon)`
5249
margin-right: ${space(1)};
5350
`;
@@ -82,10 +79,10 @@ export const fields = {
8279
options: platforms.map(({id, name}) => ({
8380
value: id,
8481
label: (
85-
<PlatformWrapper key={id}>
82+
<Flex align="center" key={id}>
8683
<StyledPlatformIcon platform={id} />
8784
{name}
88-
</PlatformWrapper>
85+
</Flex>
8986
),
9087
})),
9188
help: t('The primary platform for this project'),

static/app/plugins/components/settings.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import {css} from '@emotion/react';
2-
import styled from '@emotion/styled';
32
import isEqual from 'lodash/isEqual';
43

54
import {Alert} from 'sentry/components/core/alert';
65
import {LinkButton} from 'sentry/components/core/button/linkButton';
6+
import {Flex} from 'sentry/components/core/layout';
77
import Form from 'sentry/components/deprecatedforms/form';
88
import FormState from 'sentry/components/forms/state';
99
import LoadingIndicator from 'sentry/components/loadingIndicator';
@@ -223,7 +223,7 @@ class PluginSettings<
223223
onSubmit={this.onSubmit}
224224
submitDisabled={isSaving || !hasChanges}
225225
>
226-
<Flex>
226+
<Flex direction="column">
227227
{this.state.errors.__all__ && (
228228
<Alert type="error" showIcon={false}>
229229
<ul>
@@ -245,9 +245,4 @@ class PluginSettings<
245245
}
246246
}
247247

248-
const Flex = styled('div')`
249-
display: flex;
250-
flex-direction: column;
251-
`;
252-
253248
export default PluginSettings;

static/app/stories/apiReference.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import styled from '@emotion/styled';
44

55
import {Button} from 'sentry/components/core/button';
66
import {InputGroup} from 'sentry/components/core/input/inputGroup';
7+
import {Flex} from 'sentry/components/core/layout';
78
import {Tooltip} from 'sentry/components/core/tooltip';
89
import {IconChevron} from 'sentry/icons';
910
import {IconSearch} from 'sentry/icons/iconSearch';
@@ -109,7 +110,7 @@ function StoryDefinitionFilePath(props: {node: PropTreeNode}) {
109110
<Fragment>
110111
<tr>
111112
<StoryTypesTableDefinitionCell colSpan={2}>
112-
<StoryTypesTableDefinitionCellContent>
113+
<Flex align="center">
113114
<Button
114115
borderless
115116
icon={<IconChevron direction={expanded ? 'down' : 'right'} />}
@@ -122,7 +123,7 @@ function StoryDefinitionFilePath(props: {node: PropTreeNode}) {
122123
/>{' '}
123124
<span>{props.node.prop.parent?.name}</span> (
124125
{stripNodeModulesPrefix(props.node.prop.definitionFilePath)})
125-
</StoryTypesTableDefinitionCellContent>
126+
</Flex>
126127
</StoryTypesTableDefinitionCell>
127128
</tr>
128129
{expanded ? (
@@ -412,11 +413,6 @@ const StoryTypesTableDefinitionCell = styled('td')`
412413
}
413414
`;
414415

415-
const StoryTypesTableDefinitionCellContent = styled('div')`
416-
display: flex;
417-
align-items: center;
418-
`;
419-
420416
const StoryType = styled('div')`
421417
font-family: ${p => p.theme.text.familyMono};
422418
`;

static/app/stories/layout.tsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
import styled from '@emotion/styled';
22

33
import NegativeSpaceContainer from 'sentry/components/container/negativeSpaceContainer';
4+
import {Flex} from 'sentry/components/core/layout';
45
import {space} from 'sentry/styles/space';
56

6-
export const SideBySide = styled('div')<{vertical?: boolean}>`
7-
display: flex;
8-
gap: ${space(2)};
9-
flex-wrap: wrap;
10-
align-items: flex-start;
11-
flex-direction: ${p => (p.vertical ? 'column' : 'row')};
12-
`;
7+
export const SideBySide = styled(
8+
(props: {children: React.ReactNode; vertical?: boolean}) => {
9+
return (
10+
<Flex
11+
gap="xl"
12+
align="start"
13+
wrap="wrap"
14+
direction={props.vertical ? 'column' : 'row'}
15+
>
16+
{props.children}
17+
</Flex>
18+
);
19+
}
20+
)``;
1321

1422
export const Grid = styled('div')<{columns?: number}>`
1523
display: grid;

static/app/utils/discover/styles.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import styled from '@emotion/styled';
22

3+
import {Flex} from 'sentry/components/core/layout';
34
import {Link} from 'sentry/components/core/link';
45
import {DateTime} from 'sentry/components/dateTime';
56
import ShortId, {StyledAutoSelectText} from 'sentry/components/shortId';
@@ -68,7 +69,6 @@ export const UserIcon = styled(IconUser)`
6869
color: ${p => p.theme.gray400};
6970
`;
7071

71-
export const IconContainer = styled('div')`
72-
display: flex;
73-
gap: ${p => p.theme.space.md};
74-
`;
72+
export const IconContainer = styled((props: {children: React.ReactNode}) => {
73+
return <Flex gap="md">{props.children}</Flex>;
74+
})``;

static/app/views/integrationPipeline/githubInstallationSelect.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {Button} from 'sentry/components/core/button';
99
import {LinkButton} from 'sentry/components/core/button/linkButton';
1010
import type {SelectKey, SelectOption} from 'sentry/components/core/compactSelect';
1111
import {CompactSelect} from 'sentry/components/core/compactSelect';
12+
import {Flex} from 'sentry/components/core/layout';
1213
import HookOrDefault from 'sentry/components/hookOrDefault';
1314
import {IconAdd, IconLightning} from 'sentry/icons';
1415
import {t} from 'sentry/locale';
@@ -107,7 +108,7 @@ export function GithubInstallationSelect({
107108
value: installation.installation_id,
108109
textValue: installation.github_account,
109110
label: (
110-
<OptionLabelWrapper>
111+
<Flex align="center" gap="md">
111112
{installation.installation_id === '-1' ? (
112113
<IconAdd />
113114
) : (
@@ -122,7 +123,7 @@ export function GithubInstallationSelect({
122123
{!doesntRequireUpgrade(installation.installation_id) && (
123124
<IconLightning size="xs" />
124125
)}
125-
</OptionLabelWrapper>
126+
</Flex>
126127
),
127128
})
128129
);
@@ -219,12 +220,6 @@ const StyledHeader = styled('h3')`
219220
width: 100%;
220221
`;
221222

222-
const OptionLabelWrapper = styled('div')`
223-
display: flex;
224-
align-items: center;
225-
gap: ${space(1)};
226-
`;
227-
228223
const StyledAvatar = styled(BaseAvatar)`
229224
flex-shrink: 0;
230225
`;

0 commit comments

Comments
 (0)