Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import React from 'react';
import {GridList, GridTile} from 'material-ui/GridList';
import IconButton from 'material-ui/IconButton';
import StarBorder from 'material-ui/svg-icons/toggle/star-border';

const styles = {
root: {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my own test. This node seems useless.

display: 'flex',
flexWrap: 'wrap',
justifyContent: 'space-around',
},
gridList: {
Copy link
Copy Markdown
Member

@oliviertassinari oliviertassinari Oct 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was working fine with:

    display: flex;
    margin: auto;
    width: 500px;
    overflow-x: auto;

width: 500,
height: 200,
flexWrap: 'nowrap',
overflowX: 'auto',
marginBottom: 24,
},
};

const tilesData = [
{
img: 'images/grid-list/00-52-29-429_640.jpg',
title: 'Breakfast',
author: 'jill111',
},
{
img: 'images/grid-list/burger-827309_640.jpg',
title: 'Tasty burger',
author: 'pashminu',
},
{
img: 'images/grid-list/camera-813814_640.jpg',
title: 'Camera',
author: 'Danson67',
},
{
img: 'images/grid-list/morning-819362_640.jpg',
title: 'Morning',
author: 'fancycrave1',
},
{
img: 'images/grid-list/hats-829509_640.jpg',
title: 'Hats',
author: 'Hans',
},
{
img: 'images/grid-list/honey-823614_640.jpg',
title: 'Honey',
author: 'fancycravel',
},
{
img: 'images/grid-list/vegetables-790022_640.jpg',
title: 'Vegetables',
author: 'jill111',
},
{
img: 'images/grid-list/water-plant-821293_640.jpg',
title: 'Water plant',
author: 'BkrmadtyaKarki',
},
];

const GridListExampleOneLined = () => (
Copy link
Copy Markdown
Member

@oliviertassinari oliviertassinari Oct 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be better to add the description like this:

/**
 * A example of arrange tiles for horizontal scrol...
 */
const GridListExampleOneLined = () => (

<div style={styles.root}>
<GridList
style={styles.gridList}
cols="2.2"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be a number: cols={2.2}.

>
{tilesData.map((tile) => (
<GridTile
key={tile.img}
title={tile.title}
actionIcon={<IconButton><StarBorder color="white" /></IconButton>}
>
<img src={tile.img} />
</GridTile>
))}
</GridList>
</div>
);

export default GridListExampleOneLined;
11 changes: 11 additions & 0 deletions docs/src/app/components/pages/components/GridList/Page.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ import gridListExampleSimpleCode from '!raw!./ExampleSimple';
import GridListExampleSimple from './ExampleSimple';
import gridListExampleComplexCode from '!raw!./ExampleComplex';
import GridListExampleComplex from './ExampleComplex';
import gridListExampleOneLinedCode from '!raw!./ExampleOneLined';
import GridListExampleOneLined from './ExampleOneLined';
import gridListCode from '!raw!material-ui/GridList/GridList';
import gridTileCode from '!raw!material-ui/GridList/GridTile';

const descriptions = {
simple: 'A simple example of a scrollable `GridList` containing a [Subheader](/#/components/subheader).',
complex: 'This example demonstrates "featured" tiles, using the `rows` and `cols` props to adjust the size of the ' +
'tile. The tiles have a customised title, positioned at the top and with a custom gradient `titleBackground`.',
onelined: 'A example of arrange tiles for horizontal scrollable one line, using the `cols` props to adjust ' +
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can move the example description above the component definition.

'first view of tiles.',
};

const GridListPage = () => (
Expand All @@ -37,6 +41,13 @@ const GridListPage = () => (
>
<GridListExampleComplex />
</CodeExample>
<CodeExample
title="OneLined example"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if title="One line example" wording isn't better.

description={descriptions.onelined}
code={gridListExampleOneLinedCode}
>
<GridListExampleOneLined />
</CodeExample>
<PropTypeDescription header="### GridList Properties" code={gridListCode} />
<PropTypeDescription header="### GridTile Properties" code={gridTileCode} />
</div>
Expand Down