Skip to content

Commit 2820835

Browse files
fix(ui): Improve layout responsiveness for smaller screens (#109173)
Hide overflowing tabs completely, add flex wrapping to explore tables, web vitals browser list, and crons monitor header actions to prevent layout overflow on smaller devices.
1 parent 391ab2e commit 2820835

File tree

6 files changed

+46
-27
lines changed

6 files changed

+46
-27
lines changed

static/app/components/core/tabs/tab.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ const StyledTabWrap = styled('li', {
4646
}
4747
4848
&[aria-disabled] {
49-
opacity: ${p => (p.overflowing ? 0 : 0.6)};
49+
opacity: 0.6;
5050
cursor: default;
5151
}
5252
5353
${p =>
5454
p.overflowing &&
5555
css`
56-
opacity: 0;
56+
display: none;
5757
pointer-events: none;
5858
`}
5959
`;

static/app/components/core/tabs/tabList.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,25 @@ function useOverflowTabs({
118118
element => element && observer.observe(element)
119119
);
120120

121+
// When tabs are hidden via `display: none`, IntersectionObserver can no
122+
// longer detect them. If the container grows, those tabs would remain
123+
// permanently hidden. Resetting overflow state when the container grows
124+
// removes `display: none`, allowing the IO to re-evaluate all tabs.
125+
let previousWidth = tabListRef.current?.getBoundingClientRect().width ?? 0;
126+
const resizeObserver = new ResizeObserver(entries => {
127+
const newWidth = entries[0]?.contentRect.width ?? 0;
128+
if (newWidth > previousWidth) {
129+
setOverflowTabs([]);
130+
}
131+
previousWidth = newWidth;
132+
});
133+
if (tabListRef.current) {
134+
resizeObserver.observe(tabListRef.current);
135+
}
136+
121137
return () => {
122138
observer.disconnect();
139+
resizeObserver.disconnect();
123140
setOverflowTabs([]);
124141
};
125142
}, [tabListRef, tabItemsRef, disabled, theme]);

static/app/components/layouts/thirds.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ export const HeaderActions = styled('div')`
8888
width: max-content;
8989
margin-bottom: ${space(2)};
9090
}
91+
92+
@media (max-width: ${p => p.theme.breakpoints.sm}) {
93+
width: 100%;
94+
min-width: 100%;
95+
max-width: 100%;
96+
}
9197
`;
9298

9399
/**

static/app/views/explore/tables/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export function ExploreTables(props: ExploreTablesProps) {
107107

108108
return (
109109
<Fragment>
110-
<Flex justify="between" marginBottom="md">
110+
<Flex justify="between" marginBottom="md" gap="md" wrap="wrap">
111111
<Tabs value={props.tab} onChange={props.setTab} size="sm">
112112
<TabList variant="floating">
113113
<TabList.Item key={Tab.SPAN}>{t('Span Samples')}</TabList.Item>

static/app/views/insights/browser/webVitals/components/webVitalDescription.tsx

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -142,31 +142,27 @@ export function WebVitalDescription({score, value, webVital}: Props) {
142142
webVital: webVital.toUpperCase(),
143143
})}
144144
</Stack>
145-
<SupportedBrowsers>
146-
{Object.values(Browser).map(browser => (
147-
<Flex align="center" gap="md" key={browser}>
148-
{vitalSupportedBrowsers[
149-
WebVital[webVital.toUpperCase() as Uppercase<typeof webVital>]
150-
]?.includes(browser) ? (
151-
<IconCheckmark variant="success" size="sm" />
152-
) : (
153-
<IconClose variant="danger" size="sm" />
154-
)}
155-
{browser}
156-
</Flex>
157-
))}
158-
</SupportedBrowsers>
159-
<ReferenceLink>{link}</ReferenceLink>
145+
<Stack gap="xl">
146+
<Flex display="inline-flex" wrap="wrap" gap="xl">
147+
{Object.values(Browser).map(browser => (
148+
<Flex align="center" gap="md" key={browser}>
149+
{vitalSupportedBrowsers[
150+
WebVital[webVital.toUpperCase() as Uppercase<typeof webVital>]
151+
]?.includes(browser) ? (
152+
<IconCheckmark variant="success" size="sm" />
153+
) : (
154+
<IconClose variant="danger" size="sm" />
155+
)}
156+
{browser}
157+
</Flex>
158+
))}
159+
</Flex>
160+
<ReferenceLink>{link}</ReferenceLink>
161+
</Stack>
160162
</div>
161163
);
162164
}
163165

164-
const SupportedBrowsers = styled('div')`
165-
display: inline-flex;
166-
gap: ${space(2)};
167-
margin-bottom: ${space(2)};
168-
`;
169-
170166
const ReferenceLink = styled('div')`
171167
margin-bottom: ${space(2)};
172168
`;

static/app/views/insights/crons/components/monitorHeaderActions.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Button, LinkButton, type ButtonProps} from '@sentry/scraps/button';
2-
import {Grid} from '@sentry/scraps/layout';
2+
import {Flex} from '@sentry/scraps/layout';
33
import {Link} from '@sentry/scraps/link';
44

55
import {deleteMonitor, updateMonitor} from 'sentry/actionCreators/monitors';
@@ -82,7 +82,7 @@ function MonitorHeaderActions({monitor, orgSlug, onUpdate}: Props) {
8282
}
8383

8484
return (
85-
<Grid flow="column" align="center" gap="md">
85+
<Flex direction="row" align="center" gap="md" wrap="wrap">
8686
<FeedbackButton />
8787
<Button
8888
size="sm"
@@ -131,7 +131,7 @@ function MonitorHeaderActions({monitor, orgSlug, onUpdate}: Props) {
131131
>
132132
{t('Edit Monitor')}
133133
</LinkButton>
134-
</Grid>
134+
</Flex>
135135
);
136136
}
137137

0 commit comments

Comments
 (0)