diff --git a/docs/src/pages/demos/lists/AlignItemsList.tsx b/docs/src/pages/demos/lists/AlignItemsList.tsx new file mode 100644 index 00000000000000..5e3371f8e5925d --- /dev/null +++ b/docs/src/pages/demos/lists/AlignItemsList.tsx @@ -0,0 +1,100 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { createStyles, Theme, withStyles, WithStyles } from '@material-ui/core/styles'; +import List from '@material-ui/core/List'; +import ListItem, { ListItemProps } from '@material-ui/core/ListItem'; +import ListItemText from '@material-ui/core/ListItemText'; +import ListItemAvatar from '@material-ui/core/ListItemAvatar'; +import Avatar from '@material-ui/core/Avatar'; +import Typography from '@material-ui/core/Typography'; + +const styles = (theme: Theme) => + createStyles({ + root: { + width: '100%', + maxWidth: 360, + backgroundColor: theme.palette.background.paper, + }, + inline: { + display: 'inline', + }, + }); + +export interface AlignItemListProps extends WithStyles {} + +function AlignItemsList(props: AlignItemListProps) { + const { classes } = props; + return ( + + + + + + + + Ali Connors + + {" — I'll be in your neighborhood doing errands this…"} + + } + /> + + + + + + + + to Scott, Alex, Jennifer + + {" — Wish I could come, but I'm out of town this…"} + + } + /> + + + + + + + + Sandra Adams + + {' — Do you have Paris recommendations? Have you ever…'} + + } + /> + + + ); +} + +AlignItemsList.propTypes = { + classes: PropTypes.object.isRequired, +} as any; + +export default withStyles(styles)(AlignItemsList); diff --git a/docs/src/pages/demos/lists/CheckboxList.tsx b/docs/src/pages/demos/lists/CheckboxList.tsx new file mode 100644 index 00000000000000..5ee653e994800a --- /dev/null +++ b/docs/src/pages/demos/lists/CheckboxList.tsx @@ -0,0 +1,55 @@ +import React from 'react'; +import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'; +import List from '@material-ui/core/List'; +import ListItem from '@material-ui/core/ListItem'; +import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction'; +import ListItemText from '@material-ui/core/ListItemText'; +import Checkbox from '@material-ui/core/Checkbox'; +import IconButton from '@material-ui/core/IconButton'; +import CommentIcon from '@material-ui/icons/Comment'; + +const useStyles = makeStyles((theme: Theme) => + createStyles({ + root: { + width: '100%', + maxWidth: 360, + backgroundColor: theme.palette.background.paper, + }, + }), +); + +function CheckboxList() { + const classes = useStyles(); + const [checked, setChecked] = React.useState([0]); + + const handleToggle = (value: number) => () => { + const currentIndex = checked.indexOf(value); + const newChecked = [...checked]; + + if (currentIndex === -1) { + newChecked.push(value); + } else { + newChecked.splice(currentIndex, 1); + } + + setChecked(newChecked); + }; + + return ( + + {[0, 1, 2, 3].map(value => ( + + + + + + + + + + ))} + + ); +} + +export default CheckboxList; diff --git a/docs/src/pages/demos/lists/CheckboxListSecondary.tsx b/docs/src/pages/demos/lists/CheckboxListSecondary.tsx new file mode 100644 index 00000000000000..bd3c208821f4fb --- /dev/null +++ b/docs/src/pages/demos/lists/CheckboxListSecondary.tsx @@ -0,0 +1,55 @@ +import React from 'react'; +import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'; +import List from '@material-ui/core/List'; +import ListItem from '@material-ui/core/ListItem'; +import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction'; +import ListItemText from '@material-ui/core/ListItemText'; +import ListItemAvatar from '@material-ui/core/ListItemAvatar'; +import Checkbox from '@material-ui/core/Checkbox'; +import Avatar from '@material-ui/core/Avatar'; + +const useStyles = makeStyles((theme: Theme) => + createStyles({ + root: { + width: '100%', + maxWidth: 360, + backgroundColor: theme.palette.background.paper, + }, + }), +); + +function CheckboxListSecondary() { + const classes = useStyles(); + const [checked, setChecked] = React.useState([1]); + + const handleToggle = (value: number) => () => { + const currentIndex = checked.indexOf(value); + const newChecked = [...checked]; + + if (currentIndex === -1) { + newChecked.push(value); + } else { + newChecked.splice(currentIndex, 1); + } + + setChecked(newChecked); + }; + + return ( + + {[0, 1, 2, 3].map(value => ( + + + + + + + + + + ))} + + ); +} + +export default CheckboxListSecondary; diff --git a/docs/src/pages/demos/lists/FolderList.tsx b/docs/src/pages/demos/lists/FolderList.tsx new file mode 100644 index 00000000000000..164b6528e0896a --- /dev/null +++ b/docs/src/pages/demos/lists/FolderList.tsx @@ -0,0 +1,53 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { createStyles, Theme, withStyles, WithStyles } from '@material-ui/core/styles'; +import List from '@material-ui/core/List'; +import ListItem from '@material-ui/core/ListItem'; +import ListItemText from '@material-ui/core/ListItemText'; +import Avatar from '@material-ui/core/Avatar'; +import ImageIcon from '@material-ui/icons/Image'; +import WorkIcon from '@material-ui/icons/Work'; +import BeachAccessIcon from '@material-ui/icons/BeachAccess'; + +const styles = (theme: Theme) => + createStyles({ + root: { + width: '100%', + maxWidth: 360, + backgroundColor: theme.palette.background.paper, + }, + }); + +export interface FolderListProps extends WithStyles {} + +function FolderList(props: FolderListProps) { + const { classes } = props; + return ( + + + + + + + + + + + + + + + + + + + + + ); +} + +FolderList.propTypes = { + classes: PropTypes.object.isRequired, +} as any; + +export default withStyles(styles)(FolderList); diff --git a/docs/src/pages/demos/lists/InsetList.tsx b/docs/src/pages/demos/lists/InsetList.tsx new file mode 100644 index 00000000000000..4d7e5a1b5125f3 --- /dev/null +++ b/docs/src/pages/demos/lists/InsetList.tsx @@ -0,0 +1,42 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { createStyles, Theme, withStyles, WithStyles } from '@material-ui/core/styles'; +import List from '@material-ui/core/List'; +import ListItem from '@material-ui/core/ListItem'; +import ListItemIcon from '@material-ui/core/ListItemIcon'; +import ListItemText from '@material-ui/core/ListItemText'; +import StarIcon from '@material-ui/icons/Star'; + +const styles = (theme: Theme) => + createStyles({ + root: { + width: '100%', + maxWidth: 360, + backgroundColor: theme.palette.background.paper, + }, + }); + +export interface InsetListProps extends WithStyles {} + +function InsetList(props: InsetListProps) { + const { classes } = props; + return ( + + + + + + + + + + + + ); +} + +InsetList.propTypes = { + classes: PropTypes.object.isRequired, +} as any; + +export default withStyles(styles)(InsetList); diff --git a/docs/src/pages/demos/lists/PinnedSubheaderList.tsx b/docs/src/pages/demos/lists/PinnedSubheaderList.tsx new file mode 100644 index 00000000000000..1831121e83048a --- /dev/null +++ b/docs/src/pages/demos/lists/PinnedSubheaderList.tsx @@ -0,0 +1,55 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { createStyles, Theme, withStyles, WithStyles } from '@material-ui/core/styles'; +import List from '@material-ui/core/List'; +import ListItem from '@material-ui/core/ListItem'; +import ListItemText from '@material-ui/core/ListItemText'; +import ListSubheader from '@material-ui/core/ListSubheader'; + +const styles = (theme: Theme) => + createStyles({ + root: { + width: '100%', + maxWidth: 360, + backgroundColor: theme.palette.background.paper, + position: 'relative', + overflow: 'auto', + maxHeight: 300, + }, + listSection: { + backgroundColor: 'inherit', + }, + ul: { + backgroundColor: 'inherit', + padding: 0, + }, + }); + +export interface PinnedSubheaderListProps extends WithStyles {} + +function PinnedSubheaderList(props: PinnedSubheaderListProps) { + const { classes } = props; + + return ( + }> + {[0, 1, 2, 3, 4].map(sectionId => ( +
  • +
      + {`I'm sticky ${sectionId}`} + {[0, 1, 2].map(item => ( + + + + ))} +
    +
  • + ))} +
    + ); +} + +PinnedSubheaderList.propTypes = { + classes: PropTypes.object.isRequired, +} as any; + +export default withStyles(styles)(PinnedSubheaderList);