-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1202 from cozy/fear/labs/GridItem
feat(GridItem): Expose experimental GridItem
- Loading branch information
Showing
8 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
## Grid Item | ||
|
||
GridItem is currently experimental since its behavior is | ||
not well defined yet. | ||
|
||
``` | ||
const MuiCozyTheme = require('../../MuiCozyTheme').default; | ||
const Grid = require('../../MuiCozyTheme/Grid').default; | ||
const GridItem = require('.').default; | ||
const Card = require('../../Card').default; | ||
<MuiCozyTheme> | ||
<Grid container spacing={24}> | ||
<GridItem> | ||
<Card className="u-ellipsis">Homer Simpson</Card> | ||
</GridItem> | ||
<GridItem> | ||
<Card className="u-ellipsis">Homer Simpson</Card> | ||
</GridItem> | ||
<GridItem> | ||
<Card className="u-ellipsis">Homer Simpson</Card> | ||
</GridItem> | ||
<GridItem> | ||
<Card className="u-ellipsis">Homer Simpson</Card> | ||
</GridItem> | ||
</Grid> | ||
</MuiCozyTheme> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import cx from 'classnames' | ||
import Grid from '../../MuiCozyTheme/Grid' | ||
import styles from './styles.styl' | ||
|
||
const GridItem = ({ onClick, children }) => { | ||
return ( | ||
<Grid | ||
item | ||
xs={3} | ||
sm={2} | ||
onClick={() => onClick && onClick()} | ||
className={cx(styles['gridItem-container'])} | ||
> | ||
{children} | ||
</Grid> | ||
) | ||
} | ||
GridItem.propTypes = { | ||
onClick: PropTypes.func, | ||
children: PropTypes.node.isRequired | ||
} | ||
export default GridItem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.gridItem-container { | ||
text-align center | ||
box-sizing border-box | ||
border-radius 4px | ||
white-space nowrap | ||
overflow hidden | ||
text-overflow ellipsis | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Labs | ||
|
||
In this directory, components you will find are experimental and | ||
subject to API change without creating any breaking change. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters