forked from mui/material-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0fa90a5
commit 18c237c
Showing
7 changed files
with
171 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
docs/data/joy/main-features/color-inversion/ColorInversionAnyParentStyled.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import * as React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { styled } from '@mui/joy/styles'; | ||
import { applySolidInversion } from '@mui/joy/colorInversion'; | ||
import Box from '@mui/joy/Box'; | ||
import Button from '@mui/joy/Button'; | ||
import Typography from '@mui/joy/Typography'; | ||
|
||
const StyledBox = styled(Box)( | ||
({ theme }) => ({ | ||
padding: 32, | ||
display: 'grid', | ||
gridTemplateColumns: '1fr 1fr', | ||
alignItems: 'center', | ||
rowGap: 2, | ||
columnGap: 8, | ||
borderRadius: 8, | ||
background: `linear-gradient(45deg, ${theme.vars.palette.neutral[800]}, ${theme.vars.palette.neutral[600]})`, | ||
}), | ||
applySolidInversion('neutral'), | ||
); | ||
|
||
function Stat({ description, value }) { | ||
return ( | ||
<Box sx={{ borderLeft: 3, borderColor: 'divider', px: 2, py: 0.5 }}> | ||
<Typography level="h3" component="div"> | ||
{value} | ||
</Typography> | ||
<Typography level="title-sm" textColor="text.secondary"> | ||
{description} | ||
</Typography> | ||
</Box> | ||
); | ||
} | ||
|
||
Stat.propTypes = { | ||
description: PropTypes.node, | ||
value: PropTypes.node, | ||
}; | ||
|
||
export default function ColorInversionAnyParentStyled() { | ||
return ( | ||
<StyledBox> | ||
<div> | ||
<Typography sx={{ mb: 2 }}> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod | ||
tempor incididunt ut labore et dolore magna aliqua. | ||
</Typography> | ||
<Button variant="soft">Learn more</Button> | ||
</div> | ||
<Box | ||
sx={{ | ||
display: 'grid', | ||
gridTemplateColumns: { | ||
xs: 'repeat(auto-fill, minmax(min(100%, 180px), 1fr))', | ||
sm: '1fr 1fr', | ||
}, | ||
gap: 3, | ||
}} | ||
> | ||
<Stat value="4M" description="Weekly downloads" /> | ||
<Stat value="87k" description="Stars on GitHub" /> | ||
<Stat value="2.7k" description="Open source contributors" /> | ||
<Stat value="18.4k" description="Followers on Twitter" /> | ||
</Box> | ||
</StyledBox> | ||
); | ||
} |
68 changes: 68 additions & 0 deletions
68
docs/data/joy/main-features/color-inversion/ColorInversionAnyParentStyled.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import * as React from 'react'; | ||
import { styled } from '@mui/joy/styles'; | ||
import { applySolidInversion } from '@mui/joy/colorInversion'; | ||
import Box from '@mui/joy/Box'; | ||
import Button from '@mui/joy/Button'; | ||
import Typography from '@mui/joy/Typography'; | ||
|
||
const StyledBox = styled(Box)( | ||
({ theme }) => ({ | ||
padding: 32, | ||
display: 'grid', | ||
gridTemplateColumns: '1fr 1fr', | ||
alignItems: 'center', | ||
rowGap: 2, | ||
columnGap: 8, | ||
borderRadius: 8, | ||
background: `linear-gradient(45deg, ${theme.vars.palette.neutral[800]}, ${theme.vars.palette.neutral[600]})`, | ||
}), | ||
applySolidInversion('neutral'), | ||
); | ||
|
||
function Stat({ | ||
description, | ||
value, | ||
}: { | ||
description: React.ReactNode; | ||
value: React.ReactNode; | ||
}) { | ||
return ( | ||
<Box sx={{ borderLeft: 3, borderColor: 'divider', px: 2, py: 0.5 }}> | ||
<Typography level="h3" component="div"> | ||
{value} | ||
</Typography> | ||
<Typography level="title-sm" textColor="text.secondary"> | ||
{description} | ||
</Typography> | ||
</Box> | ||
); | ||
} | ||
|
||
export default function ColorInversionAnyParentStyled() { | ||
return ( | ||
<StyledBox> | ||
<div> | ||
<Typography sx={{ mb: 2 }}> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod | ||
tempor incididunt ut labore et dolore magna aliqua. | ||
</Typography> | ||
<Button variant="soft">Learn more</Button> | ||
</div> | ||
<Box | ||
sx={{ | ||
display: 'grid', | ||
gridTemplateColumns: { | ||
xs: 'repeat(auto-fill, minmax(min(100%, 180px), 1fr))', | ||
sm: '1fr 1fr', | ||
}, | ||
gap: 3, | ||
}} | ||
> | ||
<Stat value="4M" description="Weekly downloads" /> | ||
<Stat value="87k" description="Stars on GitHub" /> | ||
<Stat value="2.7k" description="Open source contributors" /> | ||
<Stat value="18.4k" description="Followers on Twitter" /> | ||
</Box> | ||
</StyledBox> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.