Skip to content

Commit 7ca1810

Browse files
committed
[DevTools] Swap Components tab layout based on container size
This is mostly relevant for using React DevTools inline where the devtools container width is not equal to the viewport width (e.g. in the test fixture). Container queries are available in all evergreen browsers and iOS 16
1 parent 6dc4543 commit 7ca1810

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

packages/react-devtools-shared/src/devtools/views/Components/Components.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
cursor: ew-resize;
3939
}
4040

41-
@media screen and (max-width: 600px) {
41+
@container devtools (width < 600px) {
4242
.Components {
4343
flex-direction: column;
4444
}

packages/react-devtools-shared/src/devtools/views/DevTools.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
flex-direction: column;
66
background-color: var(--color-background);
77
color: var(--color-text);
8+
container-name: devtools;
9+
container-type: inline-size;
810
}
911

1012
.TabBar {

packages/react-devtools-shared/src/devtools/views/portaledContent.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ export default function portaledContent(
3636
<ThemeProvider>
3737
<div
3838
data-react-devtools-portal-root={true}
39-
style={{width: '100vw', height: '100vh'}}>
39+
style={{
40+
width: '100vw',
41+
height: '100vh',
42+
containerName: 'devtools',
43+
containerType: 'inline-size',
44+
}}>
4045
{children}
4146
</div>
4247
</ThemeProvider>

0 commit comments

Comments
 (0)