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 List documentation #33120

Merged
merged 51 commits into from
Jun 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
dbeae76
add first batch of demos to list page
siriwatknp Jun 10, 2022
9b46040
use logical properties
siriwatknp Jun 10, 2022
ca7b862
add actionable demo
siriwatknp Jun 10, 2022
ff639fa
add VariantsColors demo
siriwatknp Jun 10, 2022
687b15b
improve customization experience without using css selector
siriwatknp Jun 10, 2022
6f7aaee
add more demos
siriwatknp Jun 10, 2022
670b8d3
add comments and radius adjustment to sheet
siriwatknp Jun 10, 2022
3a544d8
add list variables demo
siriwatknp Jun 10, 2022
a6e9064
update content
siriwatknp Jun 10, 2022
6fa86e5
add ios example
siriwatknp Jun 10, 2022
458cf4f
fix name
siriwatknp Jun 10, 2022
0b6d66d
add Gmail example
siriwatknp Jun 10, 2022
b3abe8d
refine
siriwatknp Jun 10, 2022
8e97273
spread id to input
siriwatknp Jun 10, 2022
7e199cb
improve a11y
siriwatknp Jun 10, 2022
a764d08
consecutive list item
siriwatknp Jun 11, 2022
890e5b3
refine example
siriwatknp Jun 11, 2022
058df1e
add ExampleCollapsibleList
siriwatknp Jun 11, 2022
ef1be2d
improve a11y
siriwatknp Jun 11, 2022
059a029
update variables
siriwatknp Jun 12, 2022
b700312
fix nested item radius vars
siriwatknp Jun 12, 2022
886b085
complete all demos
siriwatknp Jun 12, 2022
78e6311
adjust action width
siriwatknp Jun 12, 2022
8603310
fix demo
siriwatknp Jun 12, 2022
2fd7ae1
add small toggle
siriwatknp Jun 12, 2022
4dd6a54
complete docs
siriwatknp Jun 12, 2022
2a8939f
Merge branch 'master' of https://github.com/mui/material-ui into joy/…
siriwatknp Jun 12, 2022
e9822f7
fix variables
siriwatknp Jun 12, 2022
62f4ea9
add nested list visual regression
siriwatknp Jun 12, 2022
8cbee12
run proptypes
siriwatknp Jun 12, 2022
c5fb33c
simplify
siriwatknp Jun 13, 2022
263e104
fix demo
siriwatknp Jun 13, 2022
9902a58
flip the radius if padding is 0
siriwatknp Jun 13, 2022
7855049
update demo
siriwatknp Jun 13, 2022
73b3f8b
general copywriting revision
danilo-leal Jun 14, 2022
2065abc
demos design refinement
danilo-leal Jun 14, 2022
0621be1
fix key
siriwatknp Jun 14, 2022
18dac03
Merge branch 'joy/list-doc' of github.com:siriwatknp/material-ui into…
siriwatknp Jun 14, 2022
7bd2e62
temp radius adjustment
siriwatknp Jun 14, 2022
a3b2d18
add radius adjustment capability
siriwatknp Jun 14, 2022
c9a74ed
fix demos
siriwatknp Jun 14, 2022
2b9caff
revert implementation
siriwatknp Jun 15, 2022
ca167fd
Fix demos
siriwatknp Jun 15, 2022
d7ddb8a
fix test
siriwatknp Jun 15, 2022
341baee
copywriting and doc structure tweaks
danilo-leal Jun 16, 2022
5a05443
adjust demos design
danilo-leal Jun 16, 2022
b4e0148
Merge branch 'joy/list-doc' of https://github.com/siriwatknp/material…
danilo-leal Jun 16, 2022
e62ad2e
fix demos
danilo-leal Jun 16, 2022
e63edf8
prevent props spreading to DOM
siriwatknp Jun 16, 2022
a4aa000
Merge branch 'joy/list-doc' of github.com:siriwatknp/material-ui into…
siriwatknp Jun 16, 2022
70cbddf
adjust demos
siriwatknp Jun 16, 2022
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
2 changes: 1 addition & 1 deletion docs/data/joy/components/aspect-ratio/ListStackRatio.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function FlexRowRatio() {
borderRadius: 'sm',
}}
>
<List sx={{ py: 'var(--List-gap)' }}>
<List sx={{ py: 'var(--List-divider-gap)' }}>
{data.map((item, index) => (
<React.Fragment key={item.title}>
<ListItem>
Expand Down
2 changes: 1 addition & 1 deletion docs/data/joy/components/aspect-ratio/ListStackRatio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function FlexRowRatio() {
borderRadius: 'sm',
}}
>
<List sx={{ py: 'var(--List-gap)' }}>
<List sx={{ py: 'var(--List-divider-gap)' }}>
{data.map((item, index) => (
<React.Fragment key={item.title}>
<ListItem>
Expand Down
34 changes: 34 additions & 0 deletions docs/data/joy/components/list/ActionableList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import * as React from 'react';
import List from '@mui/joy/List';
import ListItem from '@mui/joy/ListItem';
import ListItemDecorator from '@mui/joy/ListItemDecorator';
import ListItemButton from '@mui/joy/ListItemButton';
import OpenInNew from '@mui/icons-material/OpenInNew';
import Info from '@mui/icons-material/Info';

export default function ActionableList() {
return (
<List
sx={{
maxWidth: 320,
}}
>
<ListItem>
<ListItemButton onClick={() => alert('You clicked')}>
<ListItemDecorator>
<Info />
</ListItemDecorator>
Clickable item
</ListItemButton>
</ListItem>
<ListItem>
<ListItemButton component="a" href="#actionable">
<ListItemDecorator>
<OpenInNew />
</ListItemDecorator>
Open a new tab
</ListItemButton>
</ListItem>
</List>
);
}
25 changes: 25 additions & 0 deletions docs/data/joy/components/list/BasicList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import * as React from 'react';
import List from '@mui/joy/List';
import ListItem from '@mui/joy/ListItem';
import Typography from '@mui/joy/Typography';

export default function BasicList() {
return (
<div>
<Typography
id="basic-list-demo"
level="body3"
textTransform="uppercase"
fontWeight="lg"
mb={1}
>
Ingredients
</Typography>
<List aria-labelledby="basic-list-demo">
<ListItem>1 red onion</ListItem>
<ListItem>2 red peppers</ListItem>
<ListItem>120g bacon</ListItem>
</List>
</div>
);
}
35 changes: 35 additions & 0 deletions docs/data/joy/components/list/DecoratedList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import * as React from 'react';
import List from '@mui/joy/List';
import ListItem from '@mui/joy/ListItem';
import ListItemDecorator from '@mui/joy/ListItemDecorator';
import Typography from '@mui/joy/Typography';

export default function DecoratedList() {
return (
<div>
<Typography
id="decorated-list-demo"
level="body3"
textTransform="uppercase"
fontWeight="lg"
mb={1}
>
Ingredients
</Typography>
<List
aria-labelledby="decorated-list-demo"
sx={{ '--List-decorator-width': '32px' }}
>
<ListItem>
<ListItemDecorator>🧅</ListItemDecorator> 1 red onion
</ListItem>
<ListItem>
<ListItemDecorator>🍤</ListItemDecorator> 2 Shrimps
</ListItem>
<ListItem>
<ListItemDecorator>🥓</ListItemDecorator> 120g bacon
</ListItem>
</List>
</div>
);
}
55 changes: 55 additions & 0 deletions docs/data/joy/components/list/DividedList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import * as React from 'react';
import Avatar from '@mui/joy/Avatar';
import Box from '@mui/joy/Box';
import List from '@mui/joy/List';
import ListDivider from '@mui/joy/ListDivider';
import ListItem from '@mui/joy/ListItem';
import ListItemDecorator from '@mui/joy/ListItemDecorator';
import Typography from '@mui/joy/Typography';
import Sheet from '@mui/joy/Sheet';

export default function DividedList() {
return (
<Box
sx={{
display: 'flex',
flexWrap: 'wrap',
justifyContent: 'center',
gap: 4,
}}
>
{[undefined, 'gutter', 'startDecorator', 'startContent'].map((inset) => (
<Box key={inset || 'default'}>
<Typography level="body3" mb={2}>
<code>{inset ? `inset="${inset}"` : '(default)'}</code>
</Typography>
<Sheet variant="outlined" sx={{ borderRadius: 'sm' }}>
<List
sx={{
paddingBlock: 1,
minWidth: 240,
'--List-decorator-width': '48px',
'--List-item-paddingLeft': '1.5rem',
'--List-item-paddingRight': '1rem',
}}
>
<ListItem>
<ListItemDecorator sx={{ alignSelf: 'flex-start' }}>
<Avatar size="sm" src="/static/images/avatar/1.jpg" />
</ListItemDecorator>
Mabel Boyle
</ListItem>
<ListDivider inset={inset} />
<ListItem>
<ListItemDecorator sx={{ alignSelf: 'flex-start' }}>
<Avatar size="sm" src="/static/images/avatar/2.jpg" />
</ListItemDecorator>
Boyd Burt
</ListItem>
</List>
</Sheet>
</Box>
))}
</Box>
);
}
52 changes: 52 additions & 0 deletions docs/data/joy/components/list/EllipsisList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import * as React from 'react';
import Avatar from '@mui/joy/Avatar';
import Box from '@mui/joy/Box';
import List from '@mui/joy/List';
import ListItem from '@mui/joy/ListItem';
import ListItemContent from '@mui/joy/ListItemContent';
import ListItemDecorator from '@mui/joy/ListItemDecorator';
import Typography from '@mui/joy/Typography';

export default function EllipsisList() {
return (
<Box sx={{ width: 320 }}>
<Typography
id="ellipsis-list-demo"
level="body4"
textTransform="uppercase"
fontWeight="xl"
mb={2}
sx={{ letterSpacing: '0.15rem' }}
>
Inbox
</Typography>
<List
aria-labelledby="ellipsis-list-demo"
sx={{ '--List-decorator-width': '56px' }}
>
<ListItem>
<ListItemDecorator sx={{ alignSelf: 'flex-start' }}>
<Avatar src="/static/images/avatar/1.jpg" />
</ListItemDecorator>
<ListItemContent>
<Typography>Brunch this weekend?</Typography>
<Typography level="body2" noWrap>
I&apos;ll be in your neighborhood doing errands this Tuesday.
</Typography>
</ListItemContent>
</ListItem>
<ListItem>
<ListItemDecorator sx={{ alignSelf: 'flex-start' }}>
<Avatar src="/static/images/avatar/2.jpg" />
</ListItemDecorator>
<ListItemContent>
<Typography>Summer BBQ</Typography>
<Typography level="body2" noWrap>
Wish I could come, but I&apos;m out of town this Friday.
</Typography>
</ListItemContent>
</ListItem>
</List>
</Box>
);
}
173 changes: 173 additions & 0 deletions docs/data/joy/components/list/ExampleCollapsibleList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
import * as React from 'react';
import Box from '@mui/joy/Box';
import List from '@mui/joy/List';
import ListItem, { listItemClasses } from '@mui/joy/ListItem';
import ListItemButton, { listItemButtonClasses } from '@mui/joy/ListItemButton';
import IconButton from '@mui/joy/IconButton';
import Typography from '@mui/joy/Typography';
import ReceiptLong from '@mui/icons-material/ReceiptLong';
import KeyboardArrowDown from '@mui/icons-material/KeyboardArrowDown';

export default function ExampleCollapsibleList() {
const [open, setOpen] = React.useState(false);
const [open2, setOpen2] = React.useState(false);
return (
<Box
sx={{
width: 320,
pl: '24px',
}}
>
<List
size="sm"
sx={(theme) => ({
// Gatsby colors
'--joy-palette-primary-plainColor': '#8a4baf',
'--joy-palette-neutral-plainHoverBg': 'transparent',
'--joy-palette-neutral-plainActiveBg': 'transparent',
'--joy-palette-primary-plainHoverBg': 'transparent',
'--joy-palette-primary-plainActiveBg': 'transparent',
[theme.getColorSchemeSelector('dark')]: {
'--joy-palette-text-secondary': '#635e69',
'--joy-palette-primary-plainColor': '#d48cff',
},

'--List-insetStart': '32px',
'--List-item-paddingY': '0px',
'--List-item-paddingRight': '16px',
'--List-item-paddingLeft': '21px',
'--List-item-startActionWidth': '0px',
'--List-item-startActionTranslateX': '-50%',

[`& .${listItemButtonClasses.root}`]: {
borderLeft: '1px solid',
borderColor: 'divider',
},
[`& .${listItemButtonClasses.root}.${listItemButtonClasses.selected}`]: {
borderColor: 'currentColor',
},
[`& .${listItemClasses.nested} > .${listItemButtonClasses.root}`]: {
border: 'none',
},
'& [class*="startAction"]': {
color: 'var(--joy-palette-text-tertiary)',
},
})}
>
<ListItem nested>
<ListItem component="div" startAction={<ReceiptLong />}>
<Typography level="body3" sx={{ textTransform: 'uppercase' }}>
Documentation
</Typography>
</ListItem>
<List sx={{ '--List-gap': '0px' }}>
<ListItem>
<ListItemButton selected>Overview</ListItemButton>
</ListItem>
</List>
</ListItem>
<ListItem sx={{ '--List-gap': '0px' }}>
<ListItemButton>Quick Start</ListItemButton>
</ListItem>
<ListItem
nested
sx={{ my: 1 }}
startAction={
<IconButton
variant="plain"
size="sm"
color="neutral"
onClick={() => setOpen(!open)}
>
<KeyboardArrowDown
sx={{ transform: open ? 'initial' : 'rotate(-90deg)' }}
/>
</IconButton>
}
>
<ListItemButton>
<Typography
level="inherit"
sx={{
fontWeight: open ? 'bold' : undefined,
color: open ? 'text.primary' : 'inherit',
}}
>
Tutorial
</Typography>
<Typography component="span" level="body3" sx={{ ml: 1 }}>
9
</Typography>
</ListItemButton>
{open && (
<List sx={{ '--List-item-paddingY': '8px' }}>
<ListItem>
<ListItemButton>Overview</ListItemButton>
</ListItem>
<ListItem>
<ListItemButton>
0. Set Up Your Development Environment
</ListItemButton>
</ListItem>
<ListItem>
<ListItemButton>
1. Create and Deploy Your First Gatsby Site
</ListItemButton>
</ListItem>
<ListItem>
<ListItemButton>2. Use and Style React components</ListItemButton>
</ListItem>
</List>
)}
</ListItem>
<ListItem
nested
sx={{ my: 1 }}
startAction={
<IconButton
variant="plain"
size="sm"
color="neutral"
onClick={() => setOpen2((bool) => !bool)}
>
<KeyboardArrowDown
sx={{ transform: open2 ? 'initial' : 'rotate(-90deg)' }}
/>
</IconButton>
}
>
<ListItemButton>
<Typography
level="inherit"
sx={{
fontWeight: open2 ? 'bold' : undefined,
color: open2 ? 'text.primary' : 'inherit',
}}
>
How-to Guides
</Typography>
<Typography component="span" level="body3" sx={{ ml: 1 }}>
39
</Typography>
</ListItemButton>
{open2 && (
<List sx={{ '--List-item-paddingY': '8px' }}>
<ListItem>
<ListItemButton>Overview</ListItemButton>
</ListItem>
<ListItem>
<ListItemButton>Local Development</ListItemButton>
</ListItem>
<ListItem>
<ListItemButton>Routing</ListItemButton>
</ListItem>
<ListItem>
<ListItemButton>Styling</ListItemButton>
</ListItem>
</List>
)}
</ListItem>
</List>
</Box>
);
}
Loading