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

[Joy] Add Divider component #34403

Merged
merged 29 commits into from Sep 23, 2022
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
157a119
update divider to be translucent
siriwatknp Sep 19, 2022
628a694
init Divider
siriwatknp Sep 19, 2022
03a42ec
add thickness variable
siriwatknp Sep 19, 2022
12442eb
update demo
siriwatknp Sep 19, 2022
8363028
use Divider in card demos
siriwatknp Sep 19, 2022
6e39ff1
integrate Card with Divider
siriwatknp Sep 19, 2022
f3ebb7d
add inset
siriwatknp Sep 19, 2022
c11c492
integrate Divider with ModalDialog
siriwatknp Sep 19, 2022
f16228e
update demos
siriwatknp Sep 19, 2022
32cca7c
remove fullscreen inset
siriwatknp Sep 19, 2022
793a94b
cleanup
siriwatknp Sep 19, 2022
51b215e
reexports and add ts check
siriwatknp Sep 19, 2022
1a2dd64
run proptypes
siriwatknp Sep 20, 2022
0a8afa4
Merge branch 'master' of https://github.com/mui/material-ui into joy/…
siriwatknp Sep 20, 2022
8ad0817
add test
siriwatknp Sep 20, 2022
04c7b22
Reuse Divider in ListDivider
siriwatknp Sep 20, 2022
e5b655e
add comment
siriwatknp Sep 20, 2022
2fe2d6b
add muiName Divider and integrate with Card, ModalDialog
siriwatknp Sep 21, 2022
8d271d9
add inset none to Divider
siriwatknp Sep 21, 2022
de12125
run proptypes
siriwatknp Sep 21, 2022
35857c3
update demos
siriwatknp Sep 21, 2022
d00aff8
update tailwind switch to retain the same styles
siriwatknp Sep 21, 2022
ef48be0
add fullscreen overflow example
siriwatknp Sep 21, 2022
a0c37a6
add card integration example
siriwatknp Sep 21, 2022
a9efcf9
add demos
siriwatknp Sep 21, 2022
5cc1894
skip some demo from the regression
siriwatknp Sep 21, 2022
9d54861
fix typo
siriwatknp Sep 21, 2022
02843bc
hide toolbar
danilo-leal Sep 23, 2022
cbb5f2c
slight docs organization
danilo-leal Sep 23, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions docs/data/joy/components/card/MultipleInteractionCard.js
@@ -1,8 +1,8 @@
import * as React from 'react';
import AspectRatio from '@mui/joy/AspectRatio';
import Box from '@mui/joy/Box';
import Card from '@mui/joy/Card';
import CardOverflow from '@mui/joy/CardOverflow';
import Divider from '@mui/joy/Divider';
import Typography from '@mui/joy/Typography';
import IconButton from '@mui/joy/IconButton';
import Link from '@mui/joy/Link';
Expand Down Expand Up @@ -43,22 +43,21 @@ export default function MultipleInteractionCard() {
<Typography level="body2" sx={{ mt: 0.5, mb: 2 }}>
<Link href="#multiple-actions">California</Link>
</Typography>
<Divider inset="context" />
<CardOverflow
variant="soft"
sx={{
display: 'flex',
gap: 1.5,
py: 1.5,
px: 'var(--Card-padding)',
borderTop: '1px solid',
borderColor: 'neutral.outlinedBorder',
bgcolor: 'background.level1',
}}
>
<Typography level="body3" sx={{ fontWeight: 'md', color: 'text.secondary' }}>
6.3k views
</Typography>
<Box sx={{ width: 2, bgcolor: 'divider' }} />
<Divider orientation="vertical" />
<Typography level="body3" sx={{ fontWeight: 'md', color: 'text.secondary' }}>
1 hour ago
</Typography>
Expand Down
7 changes: 3 additions & 4 deletions docs/data/joy/components/card/MultipleInteractionCard.tsx
@@ -1,8 +1,8 @@
import * as React from 'react';
import AspectRatio from '@mui/joy/AspectRatio';
import Box from '@mui/joy/Box';
import Card from '@mui/joy/Card';
import CardOverflow from '@mui/joy/CardOverflow';
import Divider from '@mui/joy/Divider';
import Typography from '@mui/joy/Typography';
import IconButton from '@mui/joy/IconButton';
import Link from '@mui/joy/Link';
Expand Down Expand Up @@ -43,22 +43,21 @@ export default function MultipleInteractionCard() {
<Typography level="body2" sx={{ mt: 0.5, mb: 2 }}>
<Link href="#multiple-actions">California</Link>
</Typography>
<Divider inset="context" />
<CardOverflow
variant="soft"
sx={{
display: 'flex',
gap: 1.5,
py: 1.5,
px: 'var(--Card-padding)',
borderTop: '1px solid',
borderColor: 'neutral.outlinedBorder',
bgcolor: 'background.level1',
}}
>
<Typography level="body3" sx={{ fontWeight: 'md', color: 'text.secondary' }}>
6.3k views
</Typography>
<Box sx={{ width: 2, bgcolor: 'divider' }} />
<Divider orientation="vertical" />
<Typography level="body3" sx={{ fontWeight: 'md', color: 'text.secondary' }}>
1 hour ago
</Typography>
Expand Down
7 changes: 3 additions & 4 deletions docs/data/joy/components/card/OverflowCard.js
@@ -1,8 +1,8 @@
import * as React from 'react';
import AspectRatio from '@mui/joy/AspectRatio';
import Box from '@mui/joy/Box';
import Card from '@mui/joy/Card';
import CardOverflow from '@mui/joy/CardOverflow';
import Divider from '@mui/joy/Divider';
import Typography from '@mui/joy/Typography';

export default function OverflowCard() {
Expand All @@ -22,22 +22,21 @@ export default function OverflowCard() {
<Typography level="body2" sx={{ mt: 0.5, mb: 2 }}>
California
</Typography>
<Divider />
<CardOverflow
variant="soft"
sx={{
display: 'flex',
gap: 1.5,
py: 1.5,
px: 'var(--Card-padding)',
borderTop: '1px solid',
borderColor: 'neutral.outlinedBorder',
bgcolor: 'background.level1',
}}
>
<Typography level="body3" sx={{ fontWeight: 'md', color: 'text.secondary' }}>
6.3k views
</Typography>
<Box sx={{ width: 2, bgcolor: 'divider' }} />
<Divider orientation="vertical" />
<Typography level="body3" sx={{ fontWeight: 'md', color: 'text.secondary' }}>
1 hour ago
</Typography>
Expand Down
7 changes: 3 additions & 4 deletions docs/data/joy/components/card/OverflowCard.tsx
@@ -1,8 +1,8 @@
import * as React from 'react';
import AspectRatio from '@mui/joy/AspectRatio';
import Box from '@mui/joy/Box';
import Card from '@mui/joy/Card';
import CardOverflow from '@mui/joy/CardOverflow';
import Divider from '@mui/joy/Divider';
import Typography from '@mui/joy/Typography';

export default function OverflowCard() {
Expand All @@ -22,22 +22,21 @@ export default function OverflowCard() {
<Typography level="body2" sx={{ mt: 0.5, mb: 2 }}>
California
</Typography>
<Divider />
<CardOverflow
variant="soft"
sx={{
display: 'flex',
gap: 1.5,
py: 1.5,
px: 'var(--Card-padding)',
borderTop: '1px solid',
borderColor: 'neutral.outlinedBorder',
bgcolor: 'background.level1',
}}
>
<Typography level="body3" sx={{ fontWeight: 'md', color: 'text.secondary' }}>
6.3k views
</Typography>
<Box sx={{ width: 2, bgcolor: 'divider' }} />
<Divider orientation="vertical" />
<Typography level="body3" sx={{ fontWeight: 'md', color: 'text.secondary' }}>
1 hour ago
</Typography>
Expand Down
5 changes: 3 additions & 2 deletions docs/data/joy/components/card/RowCard.js
Expand Up @@ -3,6 +3,7 @@ import AspectRatio from '@mui/joy/AspectRatio';
import Card from '@mui/joy/Card';
import CardContent from '@mui/joy/CardContent';
import CardOverflow from '@mui/joy/CardOverflow';
import Divider from '@mui/joy/Divider';
import Typography from '@mui/joy/Typography';

export default function InteractiveCard() {
Expand All @@ -12,7 +13,6 @@ export default function InteractiveCard() {
variant="outlined"
sx={{
minWidth: '260px',
gap: 2,
bgcolor: 'background.body',
}}
>
Expand All @@ -24,12 +24,13 @@ export default function InteractiveCard() {
/>
</AspectRatio>
</CardOverflow>
<CardContent>
<CardContent sx={{ px: 2 }}>
<Typography fontWeight="md" textColor="success.plainColor" mb={0.5}>
Yosemite Park
</Typography>
<Typography level="body2">California, USA</Typography>
</CardContent>
<Divider />
<CardOverflow
variant="soft"
color="primary"
Expand Down
5 changes: 3 additions & 2 deletions docs/data/joy/components/card/RowCard.tsx
Expand Up @@ -3,6 +3,7 @@ import AspectRatio from '@mui/joy/AspectRatio';
import Card from '@mui/joy/Card';
import CardContent from '@mui/joy/CardContent';
import CardOverflow from '@mui/joy/CardOverflow';
import Divider from '@mui/joy/Divider';
import Typography from '@mui/joy/Typography';

export default function InteractiveCard() {
Expand All @@ -12,7 +13,6 @@ export default function InteractiveCard() {
variant="outlined"
sx={{
minWidth: '260px',
gap: 2,
bgcolor: 'background.body',
}}
>
Expand All @@ -24,12 +24,13 @@ export default function InteractiveCard() {
/>
</AspectRatio>
</CardOverflow>
<CardContent>
<CardContent sx={{ px: 2 }}>
<Typography fontWeight="md" textColor="success.plainColor" mb={0.5}>
Yosemite Park
</Typography>
<Typography level="body2">California, USA</Typography>
</CardContent>
<Divider />
<CardOverflow
variant="soft"
color="primary"
Expand Down
29 changes: 29 additions & 0 deletions docs/data/joy/components/divider/DividerChildPosition.js
@@ -0,0 +1,29 @@
import * as React from 'react';
import Box from '@mui/joy/Box';
import Divider from '@mui/joy/Divider';
import Stack from '@mui/joy/Stack';
import Slider from '@mui/joy/Slider';
import Sheet from '@mui/joy/Sheet';

export default function DividerChildPosition() {
const [position, setPosition] = React.useState(50);
return (
<Box sx={{ width: '100%' }}>
<Stack spacing={1} sx={{ fontSize: 'sm' }}>
<Sheet variant="soft" sx={{ height: 40, borderRadius: 'xs' }} />
<Divider sx={{ '--Divider-childPosition': `${position}%` }}>
Visual indicator
</Divider>
<Sheet variant="soft" sx={{ height: 40, borderRadius: 'xs' }} />
</Stack>
<Slider
value={position}
min={0}
max={100}
step={1}
valueLabelDisplay="on"
onChange={(event, value) => setPosition(value)}
/>
</Box>
);
}
48 changes: 48 additions & 0 deletions docs/data/joy/components/divider/DividerInCard.js
@@ -0,0 +1,48 @@
import * as React from 'react';
import Box from '@mui/joy/Box';
import Button from '@mui/joy/Button';
import Card from '@mui/joy/Card';
import Checkbox from '@mui/joy/Checkbox';
import Divider from '@mui/joy/Divider';
import Typography from '@mui/joy/Typography';
import ArrowForward from '@mui/icons-material/ArrowForward';

export default function DividerInCard() {
const [row, setRow] = React.useState(false);
return (
<Box>
<Checkbox
label="horizontal"
checked={row}
onChange={(event) => setRow(event.target.checked)}
sx={{ mb: 2 }}
/>
<Card
row={row}
variant="outlined"
sx={{ width: 400, maxWidth: '100%', gap: 1.5 }}
>
<Typography fontSize="lg" fontWeight="md">
Headline
</Typography>
<Divider />
<Box sx={{ display: row ? 'block' : 'contents' }}>
<Typography level="body2">
Lorem Ipsum is simply dummy text of the printing and typesetting
industry. Lorem Ipsum has been the industry standard dummy text ever
since the 1500s
</Typography>
<Button
size="sm"
variant="soft"
color="neutral"
endDecorator={<ArrowForward />}
sx={{ width: '100%', mt: row ? 2 : 0 }}
>
See more
</Button>
</Box>
</Card>
</Box>
);
}
43 changes: 43 additions & 0 deletions docs/data/joy/components/divider/DividerInModalDialog.js
@@ -0,0 +1,43 @@
import * as React from 'react';
import Box from '@mui/joy/Box';
import Button from '@mui/joy/Button';
import ModalDialog from '@mui/joy/ModalDialog';
import Divider from '@mui/joy/Divider';
import Typography from '@mui/joy/Typography';

export default function DividerInModalDialog() {
return (
<ModalDialog
sx={{
// this custom styles is for demonstration purpose, you might not need them in your app
position: 'static',
transform: 'none',
maxWidth: 300,
}}
>
<Typography fontSize="lg" fontWeight="lg">
Modal Title
</Typography>
<Divider inset="none" sx={{ my: 1.5 }} />
<Typography level="body2">
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry standard dummy text ever since the 1500s
</Typography>
<Divider sx={{ mt: 2 }} />
<Box
sx={{
bgcolor: 'background.level1',
px: 2,
py: 1.5,
m: 'calc(-1 * var(--ModalDialog-padding))',
mt: 0,
borderBottomLeftRadius: 'var(--ModalDialog-radius)',
borderBottomRightRadius: 'var(--ModalDialog-radius)',
textAlign: 'right',
}}
>
<Button size="sm">Got it!</Button>
</Box>
</ModalDialog>
);
}
29 changes: 29 additions & 0 deletions docs/data/joy/components/divider/DividerText.js
@@ -0,0 +1,29 @@
import * as React from 'react';
import Box from '@mui/joy/Box';
import Stack from '@mui/joy/Stack';
import Divider from '@mui/joy/Divider';
import Chip from '@mui/joy/Chip';

export default function DividerText() {
const content = (
<Box sx={{ fontSize: 'sm', color: 'text.tertiary' }}>
{`Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus id dignissim justo.
Nulla ut facilisis ligula. Interdum et malesuada fames ac ante ipsum primis in faucibus.
Sed malesuada lobortis pretium.`}
</Box>
);

return (
<Stack spacing={1}>
{content}
<Divider>Visual indicator</Divider>
{content}
<Divider>
<Chip variant="soft" color="neutral" size="sm">
Visual indicator
</Chip>
</Divider>
{content}
</Stack>
);
}