Skip to content

Commit

Permalink
adding back grid-list code examples
Browse files Browse the repository at this point in the history
  • Loading branch information
igorbt committed Oct 27, 2015
1 parent 1169058 commit 6e93319
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 70 deletions.
108 changes: 38 additions & 70 deletions docs/src/app/components/pages/components/grid-list.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,14 @@ let StarBorder = require('svg-icons/toggle/star-border');
let IconButton = require('icon-button');

let ComponentDoc = require('../../component-doc');

let Code = require('grid-list-code');
let CodeExample = require('../../code-example/code-example');

class GridListPage extends React.Component {

constructor(props) {
super(props);

this.code = `
{/* Basic grid list with mostly default options */}
<GridList
cellHeight={200}
style={{width: 320, height: 640, overflowY: 'auto'}}
>
{
tilesData.map(tile => <GridTile
title={tile.title}
subtitle={<span>by <b>{tile.author}</b></span>}
actionIcon={<IconButton><StarBorder color="white"/></IconButton>}
><img src={tile.img} /></GridTile>)
}
</GridList>
{/* Grid list with all possible overrides */}
<GridList
cols={2}
cellHeight={200}
padding={1}
style={{width: 320, height: 640, overflowY: 'auto'}}
>
{
tilesData.map(tile => <GridTile
title={tile.title}
actionIcon={<IconButton><StarBorder color="white"/></IconButton>}
actionPosition="left"
titlePosition="top"
titleBackground={gradientBg}
cols={tile.featured ? 2 : 1}
rows={tile.featured ? 2 : 1}
><img src={tile.img} /></GridTile>)
}
</GridList>
`;

this.desc = <p>Simple flex-box based <a
href="https://www.google.com/design/spec/components/grid-lists.html"
>Grid List</a> implementation. Support tiles with arbitrary cell size,
Expand Down Expand Up @@ -207,40 +173,42 @@ class GridListPage extends React.Component {
code={this.code}
desc={this.desc}
componentInfo={this.componentInfo}>
<div style={{display: 'flex', flexWrap: 'wrap', justifyContent: 'space-around'}}>
{/* Basic grid list with mostly default options */}
<GridList
cellHeight={200}
style={{width: 320, height: 640, overflowY: 'auto', marginBottom: 24}}
>
{
tilesData.map(tile => <GridTile
title={tile.title}
subtitle={<span>by <b>{tile.author}</b></span>}
actionIcon={<IconButton><StarBorder color="white"/></IconButton>}
><img src={tile.img} /></GridTile>)
}
</GridList>
{/* Grid list with all possible overrides */}
<GridList
cols={2}
cellHeight={200}
padding={1}
style={{width: 320, height: 640, overflowY: 'auto', marginBottom: 24}}
>
{
tilesData.map(tile => <GridTile
title={tile.title}
actionIcon={<IconButton><StarBorder color="white"/></IconButton>}
actionPosition="left"
titlePosition="top"
titleBackground={gradientBg}
cols={tile.featured ? 2 : 1}
rows={tile.featured ? 2 : 1}
><img src={tile.img} /></GridTile>)
}
</GridList>
</div>
<CodeExample code={Code}>
<div style={{display: 'flex', flexWrap: 'wrap', justifyContent: 'space-around'}}>
{/* Basic grid list with mostly default options */}
<GridList
cellHeight={200}
style={{width: 320, height: 640, overflowY: 'auto', marginBottom: 24}}
>
{
tilesData.map(tile => <GridTile
title={tile.title}
subtitle={<span>by <b>{tile.author}</b></span>}
actionIcon={<IconButton><StarBorder color="white"/></IconButton>}
><img src={tile.img} /></GridTile>)
}
</GridList>
{/* Grid list with all possible overrides */}
<GridList
cols={2}
cellHeight={200}
padding={1}
style={{width: 320, height: 640, overflowY: 'auto', marginBottom: 24}}
>
{
tilesData.map(tile => <GridTile
title={tile.title}
actionIcon={<IconButton><StarBorder color="white"/></IconButton>}
actionPosition="left"
titlePosition="top"
titleBackground={gradientBg}
cols={tile.featured ? 2 : 1}
rows={tile.featured ? 2 : 1}
><img src={tile.img} /></GridTile>)
}
</GridList>
</div>
</CodeExample>
</ComponentDoc>
);
}
Expand Down
32 changes: 32 additions & 0 deletions docs/src/app/components/raw-code/grid-list-code.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{/* Basic grid list with mostly default options */}
<GridList
cellHeight={200}
style={{width: 320, height: 640, overflowY: 'auto'}}
>
{
tilesData.map(tile => <GridTile
title={tile.title}
subtitle={<span>by <b>{tile.author}</b></span>}
actionIcon={<IconButton><StarBorder color="white"/></IconButton>}
><img src={tile.img} /></GridTile>)
}
</GridList>
{/* Grid list with all possible overrides */}
<GridList
cols={2}
cellHeight={200}
padding={1}
style={{width: 320, height: 640, overflowY: 'auto'}}
>
{
tilesData.map(tile => <GridTile
title={tile.title}
actionIcon={<IconButton><StarBorder color="white"/></IconButton>}
actionPosition="left"
titlePosition="top"
titleBackground={gradientBg}
cols={tile.featured ? 2 : 1}
rows={tile.featured ? 2 : 1}
><img src={tile.img} /></GridTile>)
}
</GridList>

0 comments on commit 6e93319

Please sign in to comment.