-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[system] Add container queries utility #41674
Changes from 15 commits
05bc425
ca0d779
6682098
35e2a07
c66c031
235a5c3
1ae42b4
4aa9b01
2602d28
7a88670
e77155d
af3b7a1
4493ee9
a1aa6d6
07907de
7677ad0
885caa5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import * as React from 'react'; | ||
import Box from '@mui/material/Box'; | ||
|
||
export default function ContainerQueries() { | ||
return ( | ||
<Box | ||
sx={{ | ||
overflow: 'auto', | ||
resize: 'horizontal', | ||
width: 400, | ||
maxWidth: '80%', | ||
containerType: 'inline-size', | ||
}} | ||
> | ||
<Box | ||
sx={{ | ||
display: 'flex', | ||
flexDirection: { xs: 'column', '@350': 'row' }, | ||
bgcolor: 'background.default', | ||
border: '1px solid', | ||
borderColor: 'divider', | ||
borderRadius: 2, | ||
overflow: 'clip', | ||
}} | ||
> | ||
<Box | ||
component="img" | ||
sx={{ | ||
alignSelf: 'stretch', | ||
aspectRatio: '16 / 9', | ||
objectFit: 'cover', | ||
width: '100%', | ||
maxWidth: { '@350': '36%', '@500': 240 }, | ||
}} | ||
alt="The house from the offer." | ||
src="https://images.unsplash.com/photo-1512917774080-9991f1c4c750?auto=format&w=350&dpr=2" | ||
/> | ||
<Box | ||
sx={{ | ||
p: { xs: 2, '@500': 3 }, | ||
display: 'flex', | ||
flexDirection: 'column', | ||
gap: 1, | ||
}} | ||
> | ||
<div> | ||
<Box | ||
component="span" | ||
sx={{ fontSize: '0.875rem', color: 'text.secondary' }} | ||
> | ||
123 Main St, Phoenix AZ | ||
</Box> | ||
<Box | ||
sx={{ | ||
color: 'primary.main', | ||
fontSize: '1.125rem', | ||
fontWeight: 'bold', | ||
}} | ||
> | ||
$280,000 — $310,000 | ||
</Box> | ||
</div> | ||
<Box | ||
sx={{ | ||
width: 'fit-content', | ||
py: 0.5, | ||
px: 1, | ||
backgroundColor: 'rgba(46, 125, 50, 0.1)', | ||
borderRadius: 10, | ||
display: 'flex', | ||
alignItems: 'center', | ||
gap: 0.5, | ||
border: '1px solid', | ||
borderColor: 'rgba(46, 125, 50, 0.1)', | ||
fontSize: '0.7rem', | ||
fontWeight: 'bold', | ||
letterSpacing: '.05rem', | ||
textTransform: 'uppercase', | ||
color: 'success.main', | ||
}} | ||
> | ||
Confidence score: 85% | ||
</Box> | ||
</Box> | ||
</Box> | ||
</Box> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import * as React from 'react'; | ||
import Box from '@mui/material/Box'; | ||
|
||
export default function ContainerQueries() { | ||
return ( | ||
<Box | ||
sx={{ | ||
overflow: 'auto', | ||
resize: 'horizontal', | ||
width: 400, | ||
maxWidth: '80%', | ||
containerType: 'inline-size', | ||
}} | ||
> | ||
<Box | ||
sx={{ | ||
display: 'flex', | ||
flexDirection: { xs: 'column', '@350': 'row' }, | ||
bgcolor: 'background.default', | ||
border: '1px solid', | ||
borderColor: 'divider', | ||
borderRadius: 2, | ||
overflow: 'clip', | ||
}} | ||
> | ||
<Box | ||
component="img" | ||
sx={{ | ||
alignSelf: 'stretch', | ||
aspectRatio: '16 / 9', | ||
objectFit: 'cover', | ||
width: '100%', | ||
maxWidth: { '@350': '36%', '@500': 240 }, | ||
}} | ||
alt="The house from the offer." | ||
src="https://images.unsplash.com/photo-1512917774080-9991f1c4c750?auto=format&w=350&dpr=2" | ||
/> | ||
<Box | ||
sx={{ | ||
p: { xs: 2, '@500': 3 }, | ||
display: 'flex', | ||
flexDirection: 'column', | ||
gap: 1, | ||
}} | ||
> | ||
<div> | ||
<Box | ||
component="span" | ||
sx={{ fontSize: '0.875rem', color: 'text.secondary' }} | ||
> | ||
123 Main St, Phoenix AZ | ||
</Box> | ||
<Box | ||
sx={{ | ||
color: 'primary.main', | ||
fontSize: '1.125rem', | ||
fontWeight: 'bold', | ||
}} | ||
> | ||
$280,000 — $310,000 | ||
</Box> | ||
</div> | ||
<Box | ||
sx={{ | ||
width: 'fit-content', | ||
py: 0.5, | ||
px: 1, | ||
backgroundColor: 'rgba(46, 125, 50, 0.1)', | ||
borderRadius: 10, | ||
display: 'flex', | ||
alignItems: 'center', | ||
gap: 0.5, | ||
border: '1px solid', | ||
borderColor: 'rgba(46, 125, 50, 0.1)', | ||
fontSize: '0.7rem', | ||
fontWeight: 'bold', | ||
letterSpacing: '.05rem', | ||
textTransform: 'uppercase', | ||
color: 'success.main', | ||
}} | ||
> | ||
Confidence score: 85% | ||
</Box> | ||
</Box> | ||
</Box> | ||
</Box> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export default class MuiError { | ||
constructor(message: string); | ||
constructor(message: string, ...args: string[]); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ describe('defaultTheme', () => { | |
'colorSchemeSelector', | ||
'defaultColorScheme', | ||
'breakpoints', | ||
'cq', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we (or should we) use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, it can be explicit on this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let me know if you decide to implement this change or not 😊 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! changed to |
||
'components', | ||
'colorSchemes', | ||
'focus', | ||
|
@@ -46,4 +47,9 @@ describe('defaultTheme', () => { | |
expect(defaultTheme.palette.mode).to.equal('light'); | ||
expect(defaultTheme.palette.colorScheme).to.equal('light'); | ||
}); | ||
|
||
it('has `cq` in the theme', () => { | ||
expect(defaultTheme.cq('sidebar').up('sm')).to.equal('@container sidebar (min-width:600px)'); | ||
expect(defaultTheme.cq.up(300)).to.equal('@container (min-width:300px)'); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Come across this since my test is the first
.ts
that usesMuiError
with multiple parameters.