Skip to content

Commit

Permalink
[docs] Polish Slider demos (mui#38759)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari authored and xcode-it committed Sep 11, 2023
1 parent 24d21e7 commit 34004c2
Show file tree
Hide file tree
Showing 18 changed files with 126 additions and 146 deletions.
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>
<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

0 comments on commit 34004c2

Please sign in to comment.