-
Notifications
You must be signed in to change notification settings - Fork 4.1k
feat(List): update to v1 API #311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6197943
6c7a3d6
959aff4
e1f7042
0906e78
5d071df
fdd3113
268c3c8
1e86005
7e24d28
1bd5965
681fa30
057be3a
d83a3c0
202a8b9
cd7171d
bf48ba3
f9ddcd0
8245887
5b6519f
4e7f6c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import React, { Component } from 'react' | ||
| import { List, Image } from 'stardust' | ||
| import faker from 'faker' | ||
|
|
||
| export default class ListSizeLargeExample extends Component { | ||
| render() { | ||
| const helenAvatar = <Image className='avatar' src={faker.image.avatar()} /> | ||
| const christianAvatar = <Image className='avatar' src={faker.image.avatar()} /> | ||
| const danielAvatar = <Image className='avatar' src={faker.image.avatar()} /> | ||
| return ( | ||
| <List size='medium' horizontal divided> | ||
| <List.Item image={helenAvatar} header='Helen' /> | ||
| <List.Item image={christianAvatar} header='Christian' /> | ||
| <List.Item image={danielAvatar} header='Daniel' /> | ||
| </List> | ||
| ) | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import React, { PropTypes } from 'react' | ||
| import cx from 'classnames' | ||
| import META from '../../utils/Meta' | ||
|
|
||
| function Content(props) { | ||
| const { | ||
| children, className, ...rest, | ||
| } = props | ||
|
|
||
| const classes = cx( | ||
| 'content', | ||
| className | ||
| ) | ||
|
|
||
| return ( | ||
| <div className={classes} {...rest}>{children}</div> | ||
| ) | ||
| } | ||
|
|
||
| Content._meta = { | ||
| name: 'Content', | ||
| type: META.type.element, | ||
| } | ||
|
|
||
| Content.propTypes = { | ||
| /** Primary content of the List */ | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I realize my comment says List while it should say Content. I've noticed the typos in the Content and Description files and will fix. |
||
| children: PropTypes.node, | ||
|
|
||
| /** Classes to add to the list className. */ | ||
| className: PropTypes.string, | ||
| } | ||
|
|
||
| export default Content | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import React, { PropTypes } from 'react' | ||
| import cx from 'classnames' | ||
| import META from '../../utils/Meta' | ||
|
|
||
| function Description(props) { | ||
| const { | ||
| children, className, ...rest, | ||
| } = props | ||
|
|
||
| const classes = cx( | ||
| 'description', | ||
| className | ||
| ) | ||
|
|
||
| return ( | ||
| <div className={classes} {...rest}>{children}</div> | ||
| ) | ||
| } | ||
|
|
||
| Description._meta = { | ||
| library: META.library.semanticUI, | ||
| name: 'Description', | ||
| type: META.type.element, | ||
| } | ||
|
|
||
| Description.propTypes = { | ||
| /** Primary content of the List */ | ||
| children: PropTypes.node, | ||
|
|
||
| /** Classes to add to the list className. */ | ||
| className: PropTypes.string, | ||
| } | ||
|
|
||
| export default Description |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import React, { PropTypes } from 'react' | ||
| import cx from 'classnames' | ||
| import META from '../../utils/Meta' | ||
|
|
||
| /** | ||
| * I'm not sure a seperate file is necessary or if there's a better way. | ||
| * Also not sure this is where this file would go. | ||
| */ | ||
|
|
||
| function ItemHeader(props) { | ||
| const { | ||
| children, className, ...rest, | ||
| } = props | ||
|
|
||
| const classes = cx( | ||
| 'header', | ||
| className | ||
| ) | ||
|
|
||
| return ( | ||
| <div className={classes} {...rest}>{children}</div> | ||
| ) | ||
| } | ||
|
|
||
| ItemHeader._meta = { | ||
| name: 'ItemHeader', | ||
| type: META.type.element, | ||
| } | ||
|
|
||
| ItemHeader.propTypes = { | ||
| /** Primary content of the List */ | ||
| children: PropTypes.node, | ||
|
|
||
| /** Classes to add to the list className. */ | ||
| className: PropTypes.string, | ||
| } | ||
|
|
||
| export default ItemHeader | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want this file? Is this where it should be placed or perhaps under views/Item?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've left an analysis and proposal for "component parts" on this PR itself: https://github.com/TechnologyAdvice/stardust/pull/311#issuecomment-231006785 |
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When there is no image/icon do we want to require ItemContent? The current ListItem file suggests no.
ListItem.js:
if (media) content = <div className='content'>{content}</div>There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, no content when there is no icon/image. Reference the SUI docs for the exact markup.
http://semantic-ui.com/elements/list
In the case of the Item view, adding content with no icon/image will actually break the vertically aligned variations.