Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions static/app/components/commandPalette/ui/content.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Fragment, useCallback, useLayoutEffect, useMemo, useRef} from 'react';
import styled from '@emotion/styled';
import {useTheme} from '@emotion/react';
import {Item, Section} from '@react-stately/collections';

import {Flex} from '@sentry/scraps/layout';
Expand All @@ -10,6 +10,7 @@ import {COMMAND_PALETTE_GROUP_KEY_CONFIG} from 'sentry/components/commandPalette
import {CommandPaletteList} from 'sentry/components/commandPalette/ui/list';
import {useCommandPaletteState} from 'sentry/components/commandPalette/ui/useCommandPaletteState';
import type {MenuListItemProps} from 'sentry/components/core/menuListItem';
import type {Theme} from 'sentry/utils/theme';
import {unreachable} from 'sentry/utils/unreachable';
import normalizeUrl from 'sentry/utils/url/normalizeUrl';
import {useNavigate} from 'sentry/utils/useNavigate';
Expand All @@ -21,23 +22,31 @@ type CommandPaletteActionMenuItem = MenuListItemProps & {
};

function actionToMenuItem(
action: CommandPaletteActionWithKey
action: CommandPaletteActionWithKey,
theme: Theme
): CommandPaletteActionMenuItem {
return {
key: action.key,
label: action.display.label,
details: action.display.details,
leadingItems: action.display.icon ? (
<IconWrap align="center" justify="center">
<Flex
align="center"
justify="center"
width={theme.iconSizes.md}
height={theme.iconSizes.md}
>
{action.display.icon}
</IconWrap>
</Flex>
) : undefined,
children: action.type === 'group' ? action.actions.map(actionToMenuItem) : [],
children:
action.type === 'group' ? action.actions.map(a => actionToMenuItem(a, theme)) : [],
hideCheck: true,
};
}

export function CommandPaletteContent() {
const theme = useTheme();
const {actions, selectedAction, selectAction, clearSelection, query, setQuery} =
useCommandPaletteState();
const navigate = useNavigate();
Expand All @@ -50,7 +59,7 @@ export function CommandPaletteContent() {
? (COMMAND_PALETTE_GROUP_KEY_CONFIG[action.groupingKey]?.label ?? '')
: '';
const list = itemsBySection.get(sectionLabel) ?? [];
list.push(actionToMenuItem(action));
list.push(actionToMenuItem(action, theme));
itemsBySection.set(sectionLabel, list);
}

Expand All @@ -64,7 +73,7 @@ export function CommandPaletteContent() {
};
})
.filter(section => section.children.length > 0);
}, [actions]);
}, [actions, theme]);

const handleSelect = useCallback(
(action: CommandPaletteActionWithKey) => {
Expand Down Expand Up @@ -132,8 +141,3 @@ export function CommandPaletteContent() {
</Fragment>
);
}

const IconWrap = styled(Flex)`
width: ${p => p.theme.iconSizes.md};
height: ${p => p.theme.iconSizes.md};
`;
14 changes: 12 additions & 2 deletions static/app/components/core/layout/flex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@ import {Container, type ContainerElement, type ContainerProps} from './container
import {getSpacing, rc, type Responsive, type SpacingSize} from './styles';

const omitFlexProps = new Set<keyof FlexLayoutProps | 'as'>([
'align',
'as',
'direction',
'display',
'flex',
'gap',
'display',
'align',
'justify',
'placeItems',
'wrap',
]);

type PlaceItems = 'start' | 'end' | 'center' | 'baseline' | 'stretch';
Copy link
Contributor

Choose a reason for hiding this comment

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

Bug: Prop Forwarding: Missing Omit for placeItems Prop

The placeItems prop was added to the FlexLayoutProps interface and used in the styled component, but wasn't added to the omitFlexProps Set. This causes the prop to be forwarded to the DOM element, which will trigger React warnings about unknown DOM attributes.

Fix in Cursor Fix in Web


interface FlexLayoutProps {
/**
* Aligns flex items along the cross axis of the current line of flex items.
Expand All @@ -39,13 +42,19 @@ interface FlexLayoutProps {
* Specifies the spacing between flex items.
*/
gap?: Responsive<SpacingSize | `${SpacingSize} ${SpacingSize}`>;

/**
* Aligns flex items along the block axis of the current line of flex items.
* Uses CSS justify-content property.
*/
justify?: Responsive<
'start' | 'end' | 'center' | 'between' | 'around' | 'evenly' | 'left' | 'right'
>;
/**
* Shorthand property for align-items and justify-items.
*
*/
placeItems?: Responsive<PlaceItems | `${PlaceItems} ${PlaceItems}`>;
/**
* Specifies the wrapping behavior of the flex items.
*/
Expand All @@ -70,6 +79,7 @@ export const Flex = styled(Container, {
${p => rc('flex-direction', p.direction, p.theme)};
${p => rc('flex-wrap', p.wrap, p.theme)};
${p => rc('flex', p.flex, p.theme)};
${p => rc('place-items', p.placeItems, p.theme)};
${p =>
rc('justify-content', p.justify, p.theme, (value, _breakpoint, _theme) => {
switch (value) {
Expand Down
34 changes: 10 additions & 24 deletions static/app/components/events/groupingInfo/groupingInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {Fragment, useState} from 'react';
import styled from '@emotion/styled';

import {Flex} from 'sentry/components/core/layout';
import {Flex} from '@sentry/scraps/layout';
import {Separator} from '@sentry/scraps/separator';

import {SegmentedControl} from 'sentry/components/core/segmentedControl';
import {GroupInfoSummary} from 'sentry/components/events/groupingInfo/groupingSummary';
import {useEventGroupingInfo} from 'sentry/components/events/groupingInfo/useEventGroupingInfo';
Expand Down Expand Up @@ -70,7 +71,7 @@ export default function GroupingInfo({

return (
<Fragment>
<ConfigHeader>
<Flex justify="between" gap="md" marginBottom="2xs">
{hasStreamlinedUI && (
<GroupInfoSummary
event={event}
Expand All @@ -86,8 +87,8 @@ export default function GroupingInfo({
{feedbackComponent}
</div>
)}
</ConfigHeader>
<ToggleContainer>
</Flex>
<Flex justify="start" paddingBottom="lg">
<SegmentedControl
aria-label={t('Filter by contribution')}
size="xs"
Expand All @@ -99,7 +100,7 @@ export default function GroupingInfo({
</SegmentedControl.Item>
<SegmentedControl.Item key="all">{t('All Values')}</SegmentedControl.Item>
</SegmentedControl>
</ToggleContainer>
</Flex>
{isError ? <LoadingError message={t('Failed to fetch grouping info.')} /> : null}
{isPending && !hasPerformanceGrouping ? <LoadingIndicator /> : null}
{hasPerformanceGrouping || isSuccess
Expand All @@ -112,27 +113,12 @@ export default function GroupingInfo({
variant={variant}
showNonContributing={showNonContributing}
/>
{index < filteredVariants.length - 1 && <VariantDivider />}
{index < filteredVariants.length - 1 && (
<Separator orientation="horizontal" />
)}
</Fragment>
))
: null}
</Fragment>
);
}

const ConfigHeader = styled('div')`
display: flex;
justify-content: space-between;
gap: ${p => p.theme.space.md};
margin-bottom: ${p => p.theme.space['2xs']};
`;

const ToggleContainer = styled(Flex)`
justify-content: flex-start;
padding-bottom: ${p => p.theme.space.lg};
`;

const VariantDivider = styled('hr')`
padding-top: ${p => p.theme.space.md};
border-top: 1px solid ${p => p.theme.border};
`;
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,15 @@ function InnerContent({
{...{hiddenExceptions, toggleRelatedExceptions, values, exception}}
/>
{exception.mechanism || hasCoverageData ? (
<RowWrapper direction="row" justify="between">
<Flex direction="row" justify="between" margin="xl 0 xs 0">
{exception.mechanism && (
<Mechanism
data={exception.mechanism}
meta={meta?.[exceptionIdx]?.mechanism}
/>
)}
{hasCoverageData ? <LineCoverageLegend /> : null}
</RowWrapper>
</Flex>
) : null}
<RelatedExceptions
mechanism={exception.mechanism}
Expand Down Expand Up @@ -411,7 +411,3 @@ const StyledFoldSection = styled(FoldSection)`
margin-right: ${p => p.theme.space.xl};
}
`;

const RowWrapper = styled(Flex)`
margin: ${p => p.theme.space.xl} 0 ${p => p.theme.space.xs} 0;
`;
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {useMemo, useState} from 'react';
import styled from '@emotion/styled';

import {Flex, type FlexProps} from '@sentry/scraps/layout';

import {CompactSelect} from 'sentry/components/core/compactSelect';
import {Flex} from 'sentry/components/core/layout';
import {IconArrow} from 'sentry/icons';
import {t} from 'sentry/locale';
import {space} from 'sentry/styles/space';
Expand Down Expand Up @@ -264,10 +265,15 @@ const SortableThreadSelectorGridCell = styled(ThreadSelectorGridCell)`
}
`;

const HeaderText = styled(Flex)`
display: flex;
align-items: center;
justify-content: flex-start;
gap: ${space(0.5)};
padding: 0 ${space(0.5)};
`;
function HeaderText(props: FlexProps) {
return (
<Flex
gap="xs"
display="flex"
Copy link
Member

Choose a reason for hiding this comment

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

bonus prop?

align="center"
justify="start"
padding="0 xs"
{...props}
/>
);
}
8 changes: 4 additions & 4 deletions static/app/components/feedback/list/feedbackListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import styled from '@emotion/styled';
import {ActorAvatar} from 'sentry/components/core/avatar/actorAvatar';
import {Checkbox} from 'sentry/components/core/checkbox';
import InteractionStateLayer from 'sentry/components/core/interactionStateLayer';
import {Flex} from 'sentry/components/core/layout';
import {Flex, type FlexProps} from 'sentry/components/core/layout';
import {Link} from 'sentry/components/core/link';
import {Tooltip} from 'sentry/components/core/tooltip';
import IssueTrackingSignals from 'sentry/components/feedback/list/issueTrackingSignals';
Expand Down Expand Up @@ -202,9 +202,9 @@ const LinkedFeedbackCard = styled(Link)`
align-items: center;
`;

const Row = styled(Flex)`
place-items: center;
`;
function Row(props: FlexProps) {
return <Flex place-items="center" {...props} />;
}

const BottomGrid = styled('div')`
display: grid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -642,10 +642,10 @@ function ProfileIdsSubMenu(props: {
setIsOpen(true);
}}
>
<FullWidthFlex justify="between" align="center">
<Flex justify="between" align="center" width="100%">
<div>{t('Appears in %s profiles', props.profileIds.length)}</div>
<IconChevron direction="right" size="xs" />
</FullWidthFlex>
</Flex>
</ProfilingContextMenuItemButton>
{isOpen &&
props.subMenuPortalRef &&
Expand Down Expand Up @@ -712,7 +712,3 @@ function ProfileIdsSubMenu(props: {
</Fragment>
);
}

const FullWidthFlex = styled(Flex)`
width: 100%;
`;
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {useTheme} from '@emotion/react';
import styled from '@emotion/styled';
import invariant from 'invariant';

Expand Down Expand Up @@ -25,6 +26,7 @@ interface Props {
}

export default function ReplayListItem({replay, onClick}: Props) {
const theme = useTheme();
const organization = useOrganization();
const project = useProjectFromId({project_id: replay.project_id ?? undefined});

Expand All @@ -36,9 +38,9 @@ export default function ReplayListItem({replay, onClick}: Props) {
if (replay.is_archived) {
return (
<Flex gap="md" align="center" justify="center">
<ArchivedWrapper>
<Flex justify="center" align="center" width={theme.space['2xl']}>
<IconDelete color="gray500" size="md" />
</ArchivedWrapper>
</Flex>

<Flex direction="column" gap="xs">
<DisplayName>{t('Deleted Replay')}</DisplayName>
Expand Down Expand Up @@ -105,12 +107,6 @@ const CardSpacing = styled('div')`
padding: ${space(0.5)} ${space(0.5)} 0 ${space(0.5)};
`;

const ArchivedWrapper = styled(Flex)`
width: ${p => p.theme.space['2xl']};
align-items: center;
justify-content: center;
`;

const SubText = styled('div')`
font-size: 0.875em;
line-height: normal;
Expand Down
10 changes: 4 additions & 6 deletions static/app/components/replays/table/replayTableColumns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {PlatformIcon} from 'platformicons';

import {LinkButton} from 'sentry/components/core/button/linkButton';
import {Checkbox} from 'sentry/components/core/checkbox';
import {Flex} from 'sentry/components/core/layout/flex';
import {Flex, type FlexProps} from 'sentry/components/core/layout/flex';
import {ExternalLink, Link} from 'sentry/components/core/link';
import {Tooltip} from 'sentry/components/core/tooltip';
import Duration from 'sentry/components/duration/duration';
Expand Down Expand Up @@ -588,11 +588,9 @@ const DetailsLink = styled(Link)`
line-height: 0;
`;

const DropdownContainer = styled(Flex)`
position: relative;
flex-direction: column;
justify-content: center;
`;
function DropdownContainer(props: FlexProps) {
return <Flex position="relative" direction="column" justify="center" {...props} />;
}

const TabularNumber = styled('div')`
font-variant-numeric: tabular-nums;
Expand Down
17 changes: 7 additions & 10 deletions static/app/views/automations/components/automationBuilder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import styled from '@emotion/styled';
import {fetchOrgMembers} from 'sentry/actionCreators/members';
import {Alert} from 'sentry/components/core/alert';
import {Button} from 'sentry/components/core/button';
import {Flex} from 'sentry/components/core/layout';
import {Flex, Stack, type FlexProps} from 'sentry/components/core/layout';
import {Select} from 'sentry/components/core/select';
import {ConditionBadge} from 'sentry/components/workflowEngine/ui/conditionBadge';
import {PurpleTextButton} from 'sentry/components/workflowEngine/ui/purpleTextButton';
Expand Down Expand Up @@ -234,16 +234,13 @@ function ActionFilterBlock({actionFilter}: ActionFilterBlockProps) {
);
}

const Step = styled(Flex)`
flex-direction: column;
gap: ${p => p.theme.space.sm};
`;
function Step(props: FlexProps) {
return <Stack gap="sm" {...props} />;
Copy link
Member

Choose a reason for hiding this comment

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

Stack!

}

const StepLead = styled(Flex)`
align-items: center;
gap: ${p => p.theme.space.xs};
margin-bottom: ${p => p.theme.space.xs};
`;
function StepLead(props: FlexProps) {
return <Flex align="center" gap="xs" marginBottom="xs" {...props} />;
}

const EmbeddedSelectField = styled(Select)`
padding: 0;
Expand Down
Loading
Loading