Skip to content

Commit

Permalink
[docs] Add theme.applyStyles and migrate docs (#42498)
Browse files Browse the repository at this point in the history
  • Loading branch information
siriwatknp authored Jun 11, 2024
1 parent d569d3f commit 219380c
Show file tree
Hide file tree
Showing 378 changed files with 5,345 additions and 3,184 deletions.
6 changes: 3 additions & 3 deletions docs/data/joy/components/accordion/AccordionDepthPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ export default function AccordionDepthPanel() {
<AccordionGroup
variant="outlined"
transition="0.2s"
sx={{
sx={(theme) => ({
maxWidth: 400,
borderRadius: 'lg',
[`& .${accordionSummaryClasses.button}:hover`]: {
bgcolor: 'transparent',
},
[`& .${accordionDetailsClasses.content}`]: {
boxShadow: (theme) => `inset 0 1px ${theme.vars.palette.divider}`,
boxShadow: `inset 0 1px ${theme.vars.palette.divider}`,
[`&.${accordionDetailsClasses.expanded}`]: {
paddingBlock: '0.75rem',
},
},
}}
})}
>
<Accordion defaultExpanded>
<AccordionSummary>First accordion</AccordionSummary>
Expand Down
6 changes: 3 additions & 3 deletions docs/data/joy/components/accordion/AccordionDepthPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ export default function AccordionDepthPanel() {
<AccordionGroup
variant="outlined"
transition="0.2s"
sx={{
sx={(theme) => ({
maxWidth: 400,
borderRadius: 'lg',
[`& .${accordionSummaryClasses.button}:hover`]: {
bgcolor: 'transparent',
},
[`& .${accordionDetailsClasses.content}`]: {
boxShadow: (theme) => `inset 0 1px ${theme.vars.palette.divider}`,
boxShadow: `inset 0 1px ${theme.vars.palette.divider}`,
[`&.${accordionDetailsClasses.expanded}`]: {
paddingBlock: '0.75rem',
},
},
}}
})}
>
<Accordion defaultExpanded>
<AccordionSummary>First accordion</AccordionSummary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import AccordionSummary from '@mui/joy/AccordionSummary';
export default function AccordionStylingExpansion() {
return (
<AccordionGroup
sx={{
sx={(theme) => ({
maxWidth: 400,
[`& .${accordionClasses.root}`]: {
marginTop: '0.5rem',
Expand All @@ -27,9 +27,9 @@ export default function AccordionStylingExpansion() {
borderColor: 'background.level2',
},
'& [aria-expanded="true"]': {
boxShadow: (theme) => `inset 0 -1px 0 ${theme.vars.palette.divider}`,
boxShadow: `inset 0 -1px 0 ${theme.vars.palette.divider}`,
},
}}
})}
>
<Accordion>
<AccordionSummary>First accordion</AccordionSummary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import AccordionSummary from '@mui/joy/AccordionSummary';
export default function AccordionStylingExpansion() {
return (
<AccordionGroup
sx={{
sx={(theme) => ({
maxWidth: 400,
[`& .${accordionClasses.root}`]: {
marginTop: '0.5rem',
Expand All @@ -27,9 +27,9 @@ export default function AccordionStylingExpansion() {
borderColor: 'background.level2',
},
'& [aria-expanded="true"]': {
boxShadow: (theme) => `inset 0 -1px 0 ${theme.vars.palette.divider}`,
boxShadow: `inset 0 -1px 0 ${theme.vars.palette.divider}`,
},
}}
})}
>
<Accordion>
<AccordionSummary>First accordion</AccordionSummary>
Expand Down
8 changes: 4 additions & 4 deletions docs/data/joy/components/aspect-ratio/FlexRowRatio.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ export default function FlexRowRatio() {
sx={{ gap: 2, minWidth: 300 }}
>
<AspectRatio
sx={{
flexBasis: flexBasis ? `${flexBasis}px` : undefined,
overflow: 'auto',
}}
sx={[
{ overflow: 'auto' },
flexBasis ? { flexBasis: `${flexBasis}px` } : { flexBasis: null },
]}
>
<img
src="https://images.unsplash.com/photo-1502657877623-f66bf489d236?auto=format&fit=crop&w=800"
Expand Down
8 changes: 4 additions & 4 deletions docs/data/joy/components/aspect-ratio/FlexRowRatio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ export default function FlexRowRatio() {
sx={{ gap: 2, minWidth: 300 }}
>
<AspectRatio
sx={{
flexBasis: flexBasis ? `${flexBasis}px` : undefined,
overflow: 'auto',
}}
sx={[
{ overflow: 'auto' },
flexBasis ? { flexBasis: `${flexBasis}px` } : { flexBasis: null },
]}
>
<img
src="https://images.unsplash.com/photo-1502657877623-f66bf489d236?auto=format&fit=crop&w=800"
Expand Down
20 changes: 18 additions & 2 deletions docs/data/joy/components/autocomplete/GitHubLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,13 @@ export default function GitHubLabel() {
},
})}
>
<DoneIcon sx={{ visibility: selected ? 'visible' : 'hidden' }} />
<DoneIcon
sx={[
selected
? { visibility: 'visible' }
: { visibility: 'hidden' },
]}
/>
<Box
component="span"
sx={{
Expand All @@ -197,7 +203,17 @@ export default function GitHubLabel() {
<Typography level="title-sm">{option.name}</Typography>
<Typography level="body-xs">{option.description}</Typography>
</Box>
<CloseIcon sx={{ visibility: selected ? 'visible' : 'hidden' }} />
<CloseIcon
sx={[
selected
? {
visibility: 'visible',
}
: {
visibility: 'hidden',
},
]}
/>
</AutocompleteOption>
)}
options={[...labels].sort((a, b) => {
Expand Down
20 changes: 18 additions & 2 deletions docs/data/joy/components/autocomplete/GitHubLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,13 @@ export default function GitHubLabel() {
},
})}
>
<DoneIcon sx={{ visibility: selected ? 'visible' : 'hidden' }} />
<DoneIcon
sx={[
selected
? { visibility: 'visible' }
: { visibility: 'hidden' },
]}
/>
<Box
component="span"
sx={{
Expand All @@ -198,7 +204,17 @@ export default function GitHubLabel() {
<Typography level="title-sm">{option.name}</Typography>
<Typography level="body-xs">{option.description}</Typography>
</Box>
<CloseIcon sx={{ visibility: selected ? 'visible' : 'hidden' }} />
<CloseIcon
sx={[
selected
? {
visibility: 'visible',
}
: {
visibility: 'hidden',
},
]}
/>
</AutocompleteOption>
)}
options={[...labels].sort((a, b) => {
Expand Down
16 changes: 10 additions & 6 deletions docs/data/joy/components/card/InstagramPost.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,16 @@ export default function InstagramPost() {
{[...Array(5)].map((_, index) => (
<Box
key={index}
sx={{
borderRadius: '50%',
width: `max(${6 - index}px, 3px)`,
height: `max(${6 - index}px, 3px)`,
bgcolor: index === 0 ? 'primary.solidBg' : 'background.level3',
}}
sx={[
{
borderRadius: '50%',
width: `max(${6 - index}px, 3px)`,
height: `max(${6 - index}px, 3px)`,
},
index === 0
? { bgcolor: 'primary.solidBg' }
: { bgcolor: 'background.level3' },
]}
/>
))}
</Box>
Expand Down
16 changes: 10 additions & 6 deletions docs/data/joy/components/card/InstagramPost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,16 @@ export default function InstagramPost() {
{[...Array(5)].map((_, index) => (
<Box
key={index}
sx={{
borderRadius: '50%',
width: `max(${6 - index}px, 3px)`,
height: `max(${6 - index}px, 3px)`,
bgcolor: index === 0 ? 'primary.solidBg' : 'background.level3',
}}
sx={[
{
borderRadius: '50%',
width: `max(${6 - index}px, 3px)`,
height: `max(${6 - index}px, 3px)`,
},
index === 0
? { bgcolor: 'primary.solidBg' }
: { bgcolor: 'background.level3' },
]}
/>
))}
</Box>
Expand Down
12 changes: 7 additions & 5 deletions docs/data/joy/components/checkbox/ExampleButtonCheckbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ export default function ExampleButtonCheckbox() {
{['Mobile', 'Laptop', 'Monitor'].map((item) => (
<ListItem key={item}>
<ListItemDecorator
sx={{
zIndex: 2,
pointerEvents: 'none',
...(value.includes(item) && { color: 'text.primary' }),
}}
sx={[
{
zIndex: 2,
pointerEvents: 'none',
},
value.includes(item) && { color: 'text.primary' },
]}
>
{
{
Expand Down
12 changes: 7 additions & 5 deletions docs/data/joy/components/checkbox/ExampleButtonCheckbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ export default function ExampleButtonCheckbox() {
{['Mobile', 'Laptop', 'Monitor'].map((item) => (
<ListItem key={item}>
<ListItemDecorator
sx={{
zIndex: 2,
pointerEvents: 'none',
...(value.includes(item) && { color: 'text.primary' }),
}}
sx={[
{
zIndex: 2,
pointerEvents: 'none',
},
value.includes(item) && { color: 'text.primary' },
]}
>
{
{
Expand Down
13 changes: 11 additions & 2 deletions docs/data/joy/components/divider/DividerInCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ export default function DividerInCard() {
>
<Typography sx={{ fontSize: 'lg', fontWeight: 'md' }}>Headline</Typography>
<Divider />
<Box sx={{ display: orientation === 'horizontal' ? 'block' : 'contents' }}>
<Box
sx={[
orientation === 'horizontal'
? { display: 'block' }
: { display: 'contents' },
]}
>
<Typography level="body-sm">
Lorem Ipsum is simply dummy text of the printing and typesetting
industry. Lorem Ipsum has been the industry standard dummy text ever
Expand All @@ -37,7 +43,10 @@ export default function DividerInCard() {
variant="soft"
color="neutral"
endDecorator={<ArrowForward />}
sx={{ width: '100%', mt: orientation === 'horizontal' ? 2 : 0 }}
sx={[
{ width: '100%' },
orientation === 'horizontal' ? { mt: 2 } : { mt: 0 },
]}
>
See more
</Button>
Expand Down
13 changes: 11 additions & 2 deletions docs/data/joy/components/divider/DividerInCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ export default function DividerInCard() {
>
<Typography sx={{ fontSize: 'lg', fontWeight: 'md' }}>Headline</Typography>
<Divider />
<Box sx={{ display: orientation === 'horizontal' ? 'block' : 'contents' }}>
<Box
sx={[
orientation === 'horizontal'
? { display: 'block' }
: { display: 'contents' },
]}
>
<Typography level="body-sm">
Lorem Ipsum is simply dummy text of the printing and typesetting
industry. Lorem Ipsum has been the industry standard dummy text ever
Expand All @@ -38,7 +44,10 @@ export default function DividerInCard() {
variant="soft"
color="neutral"
endDecorator={<ArrowForward />}
sx={{ width: '100%', mt: orientation === 'horizontal' ? 2 : 0 }}
sx={[
{ width: '100%' },
orientation === 'horizontal' ? { mt: 2 } : { mt: 0 },
]}
>
See more
</Button>
Expand Down
28 changes: 16 additions & 12 deletions docs/data/joy/components/divider/DividerUsage.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,25 @@ export default function DividerUsage() {
sx={{ width: 300, pb: 3 }}
>
<Sheet
sx={{
height: props.orientation === 'vertical' ? 120 : 40,
flexGrow: 1,
borderRadius: 'xs',
bgcolor: 'background.level3',
}}
sx={[
{
flexGrow: 1,
borderRadius: 'xs',
bgcolor: 'background.level3',
},
props.orientation === 'vertical' ? { height: 120 } : { height: 40 },
]}
/>
<Divider {...props} />
<Sheet
sx={{
height: props.orientation === 'vertical' ? 120 : 40,
flexGrow: 1,
borderRadius: 'xs',
bgcolor: 'background.level3',
}}
sx={[
{
flexGrow: 1,
borderRadius: 'xs',
bgcolor: 'background.level3',
},
props.orientation === 'vertical' ? { height: 120 } : { height: 40 },
]}
/>
</Stack>
</Sheet>
Expand Down
28 changes: 16 additions & 12 deletions docs/data/joy/components/divider/DividerUsage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,25 @@ export default function DividerUsage() {
sx={{ width: 300, pb: 3 }}
>
<Sheet
sx={{
height: props.orientation === 'vertical' ? 120 : 40,
flexGrow: 1,
borderRadius: 'xs',
bgcolor: 'background.level3',
}}
sx={[
{
flexGrow: 1,
borderRadius: 'xs',
bgcolor: 'background.level3',
},
props.orientation === 'vertical' ? { height: 120 } : { height: 40 },
]}
/>
<Divider {...props} />
<Sheet
sx={{
height: props.orientation === 'vertical' ? 120 : 40,
flexGrow: 1,
borderRadius: 'xs',
bgcolor: 'background.level3',
}}
sx={[
{
flexGrow: 1,
borderRadius: 'xs',
bgcolor: 'background.level3',
},
props.orientation === 'vertical' ? { height: 120 } : { height: 40 },
]}
/>
</Stack>
</Sheet>
Expand Down
Loading

0 comments on commit 219380c

Please sign in to comment.