Skip to content
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

[docs] Polish Slider demos #38759

Merged
merged 2 commits into from
Sep 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/data/material/components/transitions/SimpleCollapse.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import Collapse from '@mui/material/Collapse';
import FormControlLabel from '@mui/material/FormControlLabel';

const icon = (
<Paper sx={{ m: 1 }} elevation={4}>
<Box component="svg" sx={{ width: 100, height: 100 }}>
<Paper sx={{ m: 1, width: 100, height: 100 }} elevation={4}>
<svg>
<Box
component="polygon"
points="0,100 50,00, 100,100"
sx={{
fill: (theme) => theme.palette.common.white,
stroke: (theme) => theme.palette.divider,
strokeWidth: 1,
}}
points="0,100 50,00, 100,100"
/>
</Box>
</svg>
</Paper>
);

Expand Down
11 changes: 5 additions & 6 deletions docs/data/material/components/transitions/SimpleCollapse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,20 @@ import Switch from '@mui/material/Switch';
import Paper from '@mui/material/Paper';
import Collapse from '@mui/material/Collapse';
import FormControlLabel from '@mui/material/FormControlLabel';
import { Theme } from '@mui/material/styles';

const icon = (
<Paper sx={{ m: 1 }} elevation={4}>
<Box component="svg" sx={{ width: 100, height: 100 }}>
<Paper sx={{ m: 1, width: 100, height: 100 }} elevation={4}>
<svg>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the style closer to where they make sense, also kill one React component along the way Box -> svg.

<Box
component="polygon"
points="0,100 50,00, 100,100"
sx={{
fill: (theme: Theme) => theme.palette.common.white,
fill: (theme) => theme.palette.common.white,
stroke: (theme) => theme.palette.divider,
strokeWidth: 1,
}}
points="0,100 50,00, 100,100"
/>
</Box>
</svg>
</Paper>
);

Expand Down
8 changes: 4 additions & 4 deletions docs/data/material/components/transitions/SimpleFade.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import Fade from '@mui/material/Fade';
import FormControlLabel from '@mui/material/FormControlLabel';

const icon = (
<Paper sx={{ m: 1 }} elevation={4}>
<Box component="svg" sx={{ width: 100, height: 100 }}>
<Paper sx={{ m: 1, width: 100, height: 100 }} elevation={4}>
<svg>
<Box
component="polygon"
points="0,100 50,00, 100,100"
sx={{
fill: (theme) => theme.palette.common.white,
stroke: (theme) => theme.palette.divider,
strokeWidth: 1,
}}
points="0,100 50,00, 100,100"
/>
</Box>
</svg>
</Paper>
);

Expand Down
11 changes: 5 additions & 6 deletions docs/data/material/components/transitions/SimpleFade.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,20 @@ import Switch from '@mui/material/Switch';
import Paper from '@mui/material/Paper';
import Fade from '@mui/material/Fade';
import FormControlLabel from '@mui/material/FormControlLabel';
import { Theme } from '@mui/material/styles';

const icon = (
<Paper sx={{ m: 1 }} elevation={4}>
<Box component="svg" sx={{ width: 100, height: 100 }}>
<Paper sx={{ m: 1, width: 100, height: 100 }} elevation={4}>
<svg>
<Box
component="polygon"
points="0,100 50,00, 100,100"
sx={{
fill: (theme: Theme) => theme.palette.common.white,
fill: (theme) => theme.palette.common.white,
stroke: (theme) => theme.palette.divider,
strokeWidth: 1,
}}
points="0,100 50,00, 100,100"
/>
</Box>
</svg>
</Paper>
);

Expand Down
8 changes: 4 additions & 4 deletions docs/data/material/components/transitions/SimpleGrow.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import Grow from '@mui/material/Grow';
import FormControlLabel from '@mui/material/FormControlLabel';

const icon = (
<Paper sx={{ m: 1 }} elevation={4}>
<Box component="svg" sx={{ width: 100, height: 100 }}>
<Paper sx={{ m: 1, width: 100, height: 100 }} elevation={4}>
<svg>
<Box
component="polygon"
points="0,100 50,00, 100,100"
sx={{
fill: (theme) => theme.palette.common.white,
stroke: (theme) => theme.palette.divider,
strokeWidth: 1,
}}
points="0,100 50,00, 100,100"
/>
</Box>
</svg>
</Paper>
);

Expand Down
11 changes: 5 additions & 6 deletions docs/data/material/components/transitions/SimpleGrow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,20 @@ import Switch from '@mui/material/Switch';
import Paper from '@mui/material/Paper';
import Grow from '@mui/material/Grow';
import FormControlLabel from '@mui/material/FormControlLabel';
import { Theme } from '@mui/material/styles';

const icon = (
<Paper sx={{ m: 1 }} elevation={4}>
<Box component="svg" sx={{ width: 100, height: 100 }}>
<Paper sx={{ m: 1, width: 100, height: 100 }} elevation={4}>
<svg>
<Box
component="polygon"
points="0,100 50,00, 100,100"
sx={{
fill: (theme: Theme) => theme.palette.common.white,
fill: (theme) => theme.palette.common.white,
stroke: (theme) => theme.palette.divider,
strokeWidth: 1,
}}
points="0,100 50,00, 100,100"
/>
</Box>
</svg>
</Paper>
);

Expand Down
33 changes: 19 additions & 14 deletions docs/data/material/components/transitions/SimpleSlide.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import Slide from '@mui/material/Slide';
import FormControlLabel from '@mui/material/FormControlLabel';

const icon = (
<Paper sx={{ m: 1 }} elevation={4}>
<Box component="svg" sx={{ width: 100, height: 100 }}>
<Paper sx={{ m: 1, width: 100, height: 100 }} elevation={4}>
<svg>
<Box
component="polygon"
points="0,100 50,00, 100,100"
sx={{
fill: (theme) => theme.palette.common.white,
stroke: (theme) => theme.palette.divider,
strokeWidth: 1,
}}
points="0,100 50,00, 100,100"
/>
</Box>
</svg>
</Paper>
);

Expand All @@ -29,16 +29,21 @@ export default function SimpleSlide() {
};

return (
<Box sx={{ height: 180 }}>
<Box sx={{ width: `calc(100px + 16px)`, position: 'relative', zIndex: 1 }}>
<FormControlLabel
control={<Switch checked={checked} onChange={handleChange} />}
label="Show"
/>
<Slide direction="up" in={checked} mountOnEnter unmountOnExit>
{icon}
</Slide>
</Box>
<Box
sx={{
height: 180,
width: 130,
position: 'relative',
zIndex: 1,
}}
>
<FormControlLabel
control={<Switch checked={checked} onChange={handleChange} />}
label="Show"
/>
<Slide direction="up" in={checked} mountOnEnter unmountOnExit>
{icon}
</Slide>
</Box>
);
}
36 changes: 20 additions & 16 deletions docs/data/material/components/transitions/SimpleSlide.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,20 @@ import Switch from '@mui/material/Switch';
import Paper from '@mui/material/Paper';
import Slide from '@mui/material/Slide';
import FormControlLabel from '@mui/material/FormControlLabel';
import { Theme } from '@mui/material/styles';

const icon = (
<Paper sx={{ m: 1 }} elevation={4}>
<Box component="svg" sx={{ width: 100, height: 100 }}>
<Paper sx={{ m: 1, width: 100, height: 100 }} elevation={4}>
<svg>
<Box
component="polygon"
points="0,100 50,00, 100,100"
sx={{
fill: (theme: Theme) => theme.palette.common.white,
fill: (theme) => theme.palette.common.white,
stroke: (theme) => theme.palette.divider,
strokeWidth: 1,
}}
points="0,100 50,00, 100,100"
/>
</Box>
</svg>
</Paper>
);

Expand All @@ -30,16 +29,21 @@ export default function SimpleSlide() {
};

return (
<Box sx={{ height: 180 }}>
<Box sx={{ width: `calc(100px + 16px)`, position: 'relative', zIndex: 1 }}>
<FormControlLabel
control={<Switch checked={checked} onChange={handleChange} />}
label="Show"
/>
<Slide direction="up" in={checked} mountOnEnter unmountOnExit>
{icon}
</Slide>
</Box>
<Box
sx={{
height: 180,
width: 130,
position: 'relative',
zIndex: 1,
}}
>
<FormControlLabel
control={<Switch checked={checked} onChange={handleChange} />}
label="Show"
/>
<Slide direction="up" in={checked} mountOnEnter unmountOnExit>
{icon}
</Slide>
</Box>
);
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<Box sx={{ width: `calc(100px + 16px)`, position: 'relative', zIndex: 1 }}>
<FormControlLabel
control={<Switch checked={checked} onChange={handleChange} />}
label="Show"
/>
<Slide direction="up" in={checked} mountOnEnter unmountOnExit>
{icon}
</Slide>
</Box>
<FormControlLabel
control={<Switch checked={checked} onChange={handleChange} />}
label="Show"
/>
<Slide direction="up" in={checked} mountOnEnter unmountOnExit>
{icon}
</Slide>
8 changes: 4 additions & 4 deletions docs/data/material/components/transitions/SimpleZoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import Zoom from '@mui/material/Zoom';
import FormControlLabel from '@mui/material/FormControlLabel';

const icon = (
<Paper sx={{ m: 1 }} elevation={4}>
<Box component="svg" sx={{ width: 100, height: 100 }}>
<Paper sx={{ m: 1, width: 100, height: 100 }} elevation={4}>
<svg>
<Box
component="polygon"
points="0,100 50,00, 100,100"
sx={{
fill: (theme) => theme.palette.common.white,
stroke: (theme) => theme.palette.divider,
strokeWidth: 1,
}}
points="0,100 50,00, 100,100"
/>
</Box>
</svg>
</Paper>
);

Expand Down
11 changes: 5 additions & 6 deletions docs/data/material/components/transitions/SimpleZoom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,20 @@ import Switch from '@mui/material/Switch';
import Paper from '@mui/material/Paper';
import Zoom from '@mui/material/Zoom';
import FormControlLabel from '@mui/material/FormControlLabel';
import { Theme } from '@mui/material/styles';

const icon = (
<Paper sx={{ m: 1 }} elevation={4}>
<Box component="svg" sx={{ width: 100, height: 100 }}>
<Paper sx={{ m: 1, width: 100, height: 100 }} elevation={4}>
<svg>
<Box
component="polygon"
points="0,100 50,00, 100,100"
sx={{
fill: (theme: Theme) => theme.palette.common.white,
fill: (theme) => theme.palette.common.white,
stroke: (theme) => theme.palette.divider,
strokeWidth: 1,
}}
points="0,100 50,00, 100,100"
/>
</Box>
</svg>
</Paper>
);

Expand Down
22 changes: 9 additions & 13 deletions docs/data/material/components/transitions/SlideFromContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ import FormControlLabel from '@mui/material/FormControlLabel';

const icon = (
<Paper sx={{ m: 1, width: 100, height: 100 }} elevation={4}>
<Box component="svg" sx={{ width: 100, height: 100 }}>
<svg>
<Box
component="polygon"
points="0,100 50,00, 100,100"
sx={{
fill: (theme) => theme.palette.common.white,
stroke: (theme) => theme.palette.divider,
strokeWidth: 1,
}}
points="0,100 50,00, 100,100"
/>
</Box>
</svg>
</Paper>
);

Expand All @@ -32,23 +32,19 @@ export default function SlideFromContainer() {
return (
<Box
sx={{
height: 180,
width: 240,
display: 'flex',
padding: 2,
borderRadius: 1,
bgcolor: (theme) =>
theme.palette.mode === 'light' ? 'grey.100' : 'grey.900',
overflow: 'hidden',
borderRadius: 2,
border: '1px solid',
borderColor: 'divider',
backgroundColor: 'background.default',
}}
ref={containerRef}
>
<Box sx={{ width: 200 }}>
<Box sx={{ p: 2, height: 200, overflow: 'hidden' }} ref={containerRef}>
<FormControlLabel
control={<Switch checked={checked} onChange={handleChange} />}
label="Show from target"
/>
<Slide direction="up" in={checked} container={containerRef.current}>
<Slide in={checked} container={containerRef.current}>
{icon}
</Slide>
</Box>
Expand Down
Loading