Skip to content

Commit

Permalink
[GridList] Rename ImageList
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Mar 21, 2019
1 parent d1a7d76 commit 4b52faa
Show file tree
Hide file tree
Showing 53 changed files with 246 additions and 244 deletions.
39 changes: 0 additions & 39 deletions docs/src/pages/demos/grid-list/grid-list.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import GridList from '@material-ui/core/GridList';
import GridListTile from '@material-ui/core/GridListTile';
import GridListTileBar from '@material-ui/core/GridListTileBar';
import ImageList from '@material-ui/core/ImageList';
import ImageListTile from '@material-ui/core/ImageListTile';
import ImageListTileBar from '@material-ui/core/ImageListTileBar';
import IconButton from '@material-ui/core/IconButton';
import StarBorderIcon from '@material-ui/icons/StarBorder';
import tileData from './tileData';
Expand Down Expand Up @@ -50,16 +50,16 @@ const styles = theme => ({
* },
* ];
*/
function AdvancedGridList(props) {
function AdvancedImageList(props) {
const { classes } = props;

return (
<div className={classes.root}>
<GridList cellHeight={200} spacing={1} className={classes.gridList}>
<ImageList cellHeight={200} spacing={1} className={classes.gridList}>
{tileData.map(tile => (
<GridListTile key={tile.img} cols={tile.featured ? 2 : 1} rows={tile.featured ? 2 : 1}>
<ImageListTile key={tile.img} cols={tile.featured ? 2 : 1} rows={tile.featured ? 2 : 1}>
<img src={tile.img} alt={tile.title} />
<GridListTileBar
<ImageListTileBar
title={tile.title}
titlePosition="top"
actionIcon={
Expand All @@ -70,15 +70,15 @@ function AdvancedGridList(props) {
actionPosition="left"
className={classes.titleBar}
/>
</GridListTile>
</ImageListTile>
))}
</GridList>
</ImageList>
</div>
);
}

AdvancedGridList.propTypes = {
AdvancedImageList.propTypes = {
classes: PropTypes.object.isRequired,
};

export default withStyles(styles)(AdvancedGridList);
export default withStyles(styles)(AdvancedImageList);
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import GridList from '@material-ui/core/GridList';
import GridListTile from '@material-ui/core/GridListTile';
import ImageList from '@material-ui/core/ImageList';
import ImageListTile from '@material-ui/core/ImageListTile';
import tileData from './tileData';

const styles = theme => ({
Expand Down Expand Up @@ -37,24 +37,24 @@ const styles = theme => ({
* },
* ];
*/
function ImageGridList(props) {
function ImageOnlyList(props) {
const { classes } = props;

return (
<div className={classes.root}>
<GridList cellHeight={160} className={classes.gridList} cols={3}>
<ImageList cellHeight={160} className={classes.gridList} cols={3}>
{tileData.map(tile => (
<GridListTile key={tile.img} cols={tile.cols || 1}>
<ImageListTile key={tile.img} cols={tile.cols || 1}>
<img src={tile.img} alt={tile.title} />
</GridListTile>
</ImageListTile>
))}
</GridList>
</ImageList>
</div>
);
}

ImageGridList.propTypes = {
ImageOnlyList.propTypes = {
classes: PropTypes.object.isRequired,
};

export default withStyles(styles)(ImageGridList);
export default withStyles(styles)(ImageOnlyList);
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import GridList from '@material-ui/core/GridList';
import GridListTile from '@material-ui/core/GridListTile';
import GridListTileBar from '@material-ui/core/GridListTileBar';
import ImageList from '@material-ui/core/ImageList';
import ImageListTile from '@material-ui/core/ImageListTile';
import ImageListTileBar from '@material-ui/core/ImageListTileBar';
import IconButton from '@material-ui/core/IconButton';
import StarBorderIcon from '@material-ui/icons/StarBorder';
import tileData from './tileData';
Expand Down Expand Up @@ -47,16 +47,16 @@ const styles = theme => ({
* },
* ];
*/
function SingleLineGridList(props) {
function SingleLineImageList(props) {
const { classes } = props;

return (
<div className={classes.root}>
<GridList className={classes.gridList} cols={2.5}>
<ImageList className={classes.gridList} cols={2.5}>
{tileData.map(tile => (
<GridListTile key={tile.img}>
<ImageListTile key={tile.img}>
<img src={tile.img} alt={tile.title} />
<GridListTileBar
<ImageListTileBar
title={tile.title}
classes={{
root: classes.titleBar,
Expand All @@ -68,15 +68,15 @@ function SingleLineGridList(props) {
</IconButton>
}
/>
</GridListTile>
</ImageListTile>
))}
</GridList>
</ImageList>
</div>
);
}

SingleLineGridList.propTypes = {
SingleLineImageList.propTypes = {
classes: PropTypes.object.isRequired,
};

export default withStyles(styles)(SingleLineGridList);
export default withStyles(styles)(SingleLineImageList);
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import GridList from '@material-ui/core/GridList';
import GridListTile from '@material-ui/core/GridListTile';
import GridListTileBar from '@material-ui/core/GridListTileBar';
import ImageList from '@material-ui/core/ImageList';
import ImageListTile from '@material-ui/core/ImageListTile';
import ImageListTileBar from '@material-ui/core/ImageListTileBar';
import ListSubheader from '@material-ui/core/ListSubheader';
import IconButton from '@material-ui/core/IconButton';
import InfoIcon from '@material-ui/icons/Info';
Expand Down Expand Up @@ -43,19 +43,19 @@ const styles = theme => ({
* },
* ];
*/
function TitlebarGridList(props) {
function TitlebarImageList(props) {
const { classes } = props;

return (
<div className={classes.root}>
<GridList cellHeight={180} className={classes.gridList}>
<GridListTile key="Subheader" cols={2} style={{ height: 'auto' }}>
<ImageList cellHeight={180} className={classes.gridList}>
<ImageListTile key="Subheader" cols={2} style={{ height: 'auto' }}>
<ListSubheader component="div">December</ListSubheader>
</GridListTile>
</ImageListTile>
{tileData.map(tile => (
<GridListTile key={tile.img}>
<ImageListTile key={tile.img}>
<img src={tile.img} alt={tile.title} />
<GridListTileBar
<ImageListTileBar
title={tile.title}
subtitle={<span>by: {tile.author}</span>}
actionIcon={
Expand All @@ -64,15 +64,15 @@ function TitlebarGridList(props) {
</IconButton>
}
/>
</GridListTile>
</ImageListTile>
))}
</GridList>
</ImageList>
</div>
);
}

TitlebarGridList.propTypes = {
TitlebarImageList.propTypes = {
classes: PropTypes.object.isRequired,
};

export default withStyles(styles)(TitlebarGridList);
export default withStyles(styles)(TitlebarImageList);
39 changes: 39 additions & 0 deletions docs/src/pages/demos/image-list/image-list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: Image list React component
components: ImageList, ImageListTile, ImageListTileBar, ListSubheader, IconButton
---

# Image list

<p class="description">Image lists display a collection of images in an organized grid.</p>

[Image lists](https://material.io/design/components/image-lists.html) represent a collection of items in a repeated pattern. They help improve the visual comprehension of the content they hold.

## Image only list

A simple example of a scrollable image `ImageList`.

{{"demo": "pages/demos/image-list/ImageOnlyList.js", "hideEditButton": true}}

## Image list with titlebars

This example demonstrates the use of the `ImageListTileBar` to add an overlay to each `ImageListTile`.
The overlay can accommodate a `title`, `subtitle` and secondary action - in this example an `IconButton`.

{{"demo": "pages/demos/image-list/TitlebarImageList.js", "hideEditButton": true}}

## Single line Image list

This example demonstrates a horizontal scrollable single-line grid list of images.
Horizontally scrolling grid lists are discouraged because the scrolling interferes with typical reading patterns, affecting comprehension.
One notable exception is a horizontally-scrolling, single-line grid list of images, such as a gallery.

{{"demo": "pages/demos/image-list/SingleLineImageList.js", "hideEditButton": true}}

## Advanced Image list

This example demonstrates "featured" tiles, using the `rows` and `cols` props to adjust the size of the tile, and the `padding` prop to adjust the spacing.
The tiles have a customized titlebar, positioned at the top and with a custom gradient `titleBackground`.
The secondary action `IconButton` is positioned on the left.

{{"demo": "pages/demos/image-list/AdvancedImageList.js", "hideEditButton": true}}
File renamed without changes.
2 changes: 2 additions & 0 deletions docs/static/_redirects
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/inbox / 301
/trash / 301
/spam / 301
# Temporary, added in 2019
/page-layout-examples/* /getting-started/page-layout-examples/:splat 301
/guides/csp/ /css-in-js/advanced/#what-is-csp-and-why-is-it-useful 301
/utils/modals/ /utils/modal/ 301
Expand All @@ -12,6 +13,7 @@
/guides/migration-v0.x /guides/migration-v0x/ 301
/size-snapshot https://s3.eu-central-1.amazonaws.com/eps1lon-material-ui/artifacts/next/latest/size-snapshot.json 200
/customization/css-in-js/ /css-in-js/basics/ 301
/demos/grid-list/ /demos/image-list/ 301

# Legacy
/v0.20.0 https://v0.material-ui.com/v0.20.0
Expand Down
16 changes: 0 additions & 16 deletions packages/material-ui/src/GridList/GridList.d.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/material-ui/src/GridList/index.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/material-ui/src/GridList/index.js

This file was deleted.

15 changes: 0 additions & 15 deletions packages/material-ui/src/GridListTile/GridListTile.d.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/material-ui/src/GridListTile/index.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/material-ui/src/GridListTile/index.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/material-ui/src/GridListTileBar/index.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/material-ui/src/GridListTileBar/index.js

This file was deleted.

16 changes: 16 additions & 0 deletions packages/material-ui/src/ImageList/ImageList.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import * as React from 'react';
import { StandardProps } from '..';

export interface ImageListProps
extends StandardProps<React.HTMLAttributes<HTMLUListElement>, ImageListClassKey> {
cellHeight?: number | 'auto';
cols?: number;
component?: React.ElementType<ImageListProps>;
spacing?: number;
}

export type ImageListClassKey = 'root';

declare const ImageList: React.ComponentType<ImageListProps>;

export default ImageList;
Loading

0 comments on commit 4b52faa

Please sign in to comment.