-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Item: Update to v1 API #431
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
ffd1a60
wip
layershifter 580d38d
wip
b6426b1
wip
eb3d50a
wip
7f4d672
wip
4414d3e
wip
35b4baa
wip
layershifter a33c3e3
wip
ec44f1b
wip
5260d3e
wip
9610c28
wip
7ca6359
wip
010b00c
feat(Image): configurable ui className
levithomason 40da9fe
fix(Item): use getUnhandledProps
levithomason 4c5cd26
fix (ItemGroup) Fix in prop handling
7ceab96
Merge branch 'fix/item' of https://github.com/TechnologyAdvice/stardu…
bc60ee7
fix(Item) Fix lint issues
cd5085d
fix(Item) Fix key handling
0d34c02
fix(Image): use useKeyOnly for ui class
levithomason File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,22 @@ | ||
import React from 'react' | ||
import { Item } from 'stardust' | ||
|
||
const { Group, Image } = Item | ||
|
||
const Images = () => ( | ||
<Group divided> | ||
<Item> | ||
<Image> | ||
<img src='http://semantic-ui.com/images/wireframe/image.png' /> | ||
</Image> | ||
</Item> | ||
|
||
<Item> | ||
<Image src='http://semantic-ui.com/images/wireframe/image.png' /> | ||
</Item> | ||
|
||
<Item image='http://semantic-ui.com/images/wireframe/image.png' /> | ||
</Group> | ||
) | ||
|
||
export default Images |
This file contains hidden or 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,58 @@ | ||
import React from 'react' | ||
|
||
import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample' | ||
import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection' | ||
|
||
const Content = () => ( | ||
<ExampleSection title='Content'> | ||
<ComponentExample | ||
title='Image' | ||
description='An item can contain an image' | ||
examplePath='views/Item/Content/Images' | ||
/> | ||
|
||
<ComponentExample | ||
title='Content' | ||
description='An item can contain content' | ||
examplePath='views/Item/Content/Content' | ||
/> | ||
|
||
<ComponentExample | ||
title='Header' | ||
description='An item can contain a header' | ||
examplePath='views/Item/Content/Header' | ||
/> | ||
|
||
<ComponentExample | ||
title='Metadata' | ||
description='An item can contain a header' | ||
examplePath='views/Item/Content/Metadata' | ||
/> | ||
|
||
<ComponentExample | ||
title='Link' | ||
description='An item can contain contain links as images, headers, or inside content' | ||
examplePath='views/Item/Content/Link' | ||
/> | ||
|
||
<ComponentExample | ||
title='Description' | ||
description='An item can contain contain links as images, headers, or inside content' | ||
examplePath='views/Item/Content/Description' | ||
/> | ||
|
||
<ComponentExample | ||
title='Extra Content' | ||
description='An item can contain contain links as images, headers, or inside content' | ||
examplePath='views/Item/Content/ExtraContent' | ||
/> | ||
|
||
<ComponentExample | ||
title='Rating' | ||
description='An item can contain icons signifying a "like" or "favorite" action' | ||
examplePath='views/Item/Content/Rating' | ||
/> | ||
</ExampleSection> | ||
) | ||
|
||
export default Content |
This file contains hidden or 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,12 @@ | ||
import React from 'react' | ||
|
||
import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample' | ||
import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection' | ||
|
||
const Types = () => ( | ||
<ExampleSection title='Types'> | ||
|
||
</ExampleSection> | ||
) | ||
|
||
export default Types |
This file contains hidden or 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,12 @@ | ||
import React from 'react' | ||
|
||
import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample' | ||
import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection' | ||
|
||
const Variations = () => ( | ||
<ExampleSection title='Variations'> | ||
|
||
</ExampleSection> | ||
) | ||
|
||
export default Variations |
This file contains hidden or 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,15 @@ | ||
import React from 'react' | ||
|
||
import Content from './Content' | ||
import Types from './Types' | ||
import Variations from './Variations' | ||
|
||
const ItemExamples = () => ( | ||
<div> | ||
<Types /> | ||
<Content /> | ||
<Variations /> | ||
</div> | ||
) | ||
|
||
export default ItemExamples |
This file contains hidden or 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 hidden or 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,49 @@ | ||
import cx from 'classnames' | ||
import React, { PropTypes } from 'react' | ||
|
||
import { | ||
customPropTypes, | ||
getElementType, | ||
getUnhandledProps, | ||
META, | ||
} from '../../lib' | ||
|
||
function ItemContent(props) { | ||
const { children, className, content } = props | ||
const classes = cx(className, 'content') | ||
const rest = getUnhandledProps(ItemContent, props) | ||
const ElementType = getElementType(ItemContent, props) | ||
|
||
return <ElementType {...rest} className={classes}>{children || content}</ElementType> | ||
} | ||
|
||
ItemContent._meta = { | ||
name: 'ItemContent', | ||
parent: 'Item', | ||
type: META.TYPES.VIEW, | ||
} | ||
|
||
ItemContent.propTypes = { | ||
/** An element type to render as (string or function). */ | ||
as: PropTypes.oneOfType([ | ||
PropTypes.string, | ||
PropTypes.func, | ||
]), | ||
|
||
/** Primary content of the ItemContent. */ | ||
children: customPropTypes.every([ | ||
customPropTypes.disallow(['content']), | ||
PropTypes.node, | ||
]), | ||
|
||
/** Classes that will be added to the ItemContent className. */ | ||
className: PropTypes.string, | ||
|
||
/** Primary content of the ItemContent. Mutually exclusive with the children prop. */ | ||
content: customPropTypes.every([ | ||
customPropTypes.disallow(['children']), | ||
PropTypes.string, | ||
]), | ||
} | ||
|
||
export default ItemContent |
This file contains hidden or 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 hidden or 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 hidden or 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,15 @@ | ||
import React, { PropTypes } from 'react' | ||
import { META } from '../../lib' | ||
import Image from '../../elements/Image/Image' | ||
|
||
function ItemImage(props) { | ||
return <Image {...props} /> | ||
} | ||
|
||
ItemImage._meta = { | ||
name: 'ItemImage', | ||
parent: 'Item', | ||
type: META.TYPES.VIEW, | ||
} | ||
|
||
export default ItemImage |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@levithomason I have problem there.
createImage
factory, but will it pass props?ItemImage
doesn't haveui
class by default. How we can deal with this?