-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(Feed): use new component parts
- Loading branch information
1 parent
ccf08f4
commit 8348e40
Showing
6 changed files
with
120 additions
and
110 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
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
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 |
---|---|---|
@@ -1,49 +1,49 @@ | ||
import cx from 'classnames' | ||
import React, { PropTypes } from 'react' | ||
|
||
import { | ||
customPropTypes, | ||
getElementType, | ||
getUnhandledProps, | ||
META, | ||
} from '../../lib' | ||
|
||
function FeedDate(props) { | ||
const { children, className, date } = props | ||
const classes = cx(className, 'date') | ||
const rest = getUnhandledProps(FeedDate, props) | ||
const ElementType = getElementType(FeedDate, props) | ||
|
||
return <ElementType {...rest} className={classes}>{children || date}</ElementType> | ||
} | ||
|
||
FeedDate._meta = { | ||
name: 'FeedDate', | ||
parent: 'Feed', | ||
type: META.TYPES.VIEW, | ||
} | ||
|
||
FeedDate.propTypes = { | ||
/** An element type to render as (string or function). */ | ||
as: PropTypes.oneOfType([ | ||
PropTypes.string, | ||
PropTypes.func, | ||
]), | ||
|
||
/** Primary content of the FeedDate. Mutually exclusive with the date prop. */ | ||
children: customPropTypes.every([ | ||
customPropTypes.disallow(['date']), | ||
PropTypes.node, | ||
]), | ||
|
||
/** Classes that will be added to the FeedDate className. */ | ||
className: PropTypes.string, | ||
|
||
/** Shorthand for primary content of the FeedDate. Mutually exclusive with the children prop. */ | ||
date: customPropTypes.every([ | ||
customPropTypes.disallow(['children']), | ||
PropTypes.string, | ||
]), | ||
} | ||
|
||
export default FeedDate | ||
// import cx from 'classnames' | ||
// import React, { PropTypes } from 'react' | ||
// | ||
// import { | ||
// customPropTypes, | ||
// getElementType, | ||
// getUnhandledProps, | ||
// META, | ||
// } from '../../lib' | ||
// | ||
// function FeedDate(props) { | ||
// const { children, className, date } = props | ||
// const classes = cx(className, 'date') | ||
// const rest = getUnhandledProps(FeedDate, props) | ||
// const ElementType = getElementType(FeedDate, props) | ||
// | ||
// return <ElementType {...rest} className={classes}>{children || date}</ElementType> | ||
// } | ||
// | ||
// FeedDate._meta = { | ||
// name: 'FeedDate', | ||
// parent: 'Feed', | ||
// type: META.TYPES.VIEW, | ||
// } | ||
// | ||
// FeedDate.propTypes = { | ||
// /** An element type to render as (string or function). */ | ||
// as: PropTypes.oneOfType([ | ||
// PropTypes.string, | ||
// PropTypes.func, | ||
// ]), | ||
// | ||
// /** Primary content of the FeedDate. Mutually exclusive with the date prop. */ | ||
// children: customPropTypes.every([ | ||
// customPropTypes.disallow(['date']), | ||
// PropTypes.node, | ||
// ]), | ||
// | ||
// /** Classes that will be added to the FeedDate className. */ | ||
// className: PropTypes.string, | ||
// | ||
// /** Shorthand for primary content of the FeedDate. Mutually exclusive with the children prop. */ | ||
// date: customPropTypes.every([ | ||
// customPropTypes.disallow(['children']), | ||
// PropTypes.string, | ||
// ]), | ||
// } | ||
// | ||
// export default FeedDate |
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 |
---|---|---|
@@ -1,53 +1,53 @@ | ||
import cx from 'classnames' | ||
import React, { PropTypes } from 'react' | ||
|
||
import { | ||
customPropTypes, | ||
getElementType, | ||
getUnhandledProps, | ||
META, | ||
} from '../../lib' | ||
|
||
function FeedUser(props) { | ||
const { children, className, user } = props | ||
const classes = cx(className, 'user') | ||
const rest = getUnhandledProps(FeedUser, props) | ||
const ElementType = getElementType(FeedUser, props) | ||
|
||
return <ElementType {...rest} className={classes}>{children || user}</ElementType> | ||
} | ||
|
||
FeedUser._meta = { | ||
name: 'FeedUser', | ||
parent: 'Feed', | ||
type: META.TYPES.VIEW, | ||
} | ||
|
||
FeedUser.propTypes = { | ||
/** An element type to render as (string or function). */ | ||
as: PropTypes.oneOfType([ | ||
PropTypes.string, | ||
PropTypes.func, | ||
]), | ||
|
||
/** Primary content of the FeedUser. */ | ||
children: customPropTypes.every([ | ||
customPropTypes.disallow(['user']), | ||
PropTypes.node, | ||
]), | ||
|
||
/** Classes that will be added to the FeedUser className. */ | ||
className: PropTypes.string, | ||
|
||
/** Shorthand for primary content of the FeedUser. Mutually exclusive with the children prop. */ | ||
user: customPropTypes.every([ | ||
customPropTypes.disallow(['children']), | ||
PropTypes.string, | ||
]), | ||
} | ||
|
||
FeedUser.defaultProps = { | ||
as: 'a', | ||
} | ||
|
||
export default FeedUser | ||
// import cx from 'classnames' | ||
// import React, { PropTypes } from 'react' | ||
// | ||
// import { | ||
// customPropTypes, | ||
// getElementType, | ||
// getUnhandledProps, | ||
// META, | ||
// } from '../../lib' | ||
// | ||
// function FeedUser(props) { | ||
// const { children, className, user } = props | ||
// const classes = cx(className, 'user') | ||
// const rest = getUnhandledProps(FeedUser, props) | ||
// const ElementType = getElementType(FeedUser, props) | ||
// | ||
// return <ElementType {...rest} className={classes}>{children || user}</ElementType> | ||
// } | ||
// | ||
// FeedUser._meta = { | ||
// name: 'FeedUser', | ||
// parent: 'Feed', | ||
// type: META.TYPES.VIEW, | ||
// } | ||
// | ||
// FeedUser.propTypes = { | ||
// /** An element type to render as (string or function). */ | ||
// as: PropTypes.oneOfType([ | ||
// PropTypes.string, | ||
// PropTypes.func, | ||
// ]), | ||
// | ||
// /** Primary content of the FeedUser. */ | ||
// children: customPropTypes.every([ | ||
// customPropTypes.disallow(['user']), | ||
// PropTypes.node, | ||
// ]), | ||
// | ||
// /** Classes that will be added to the FeedUser className. */ | ||
// className: PropTypes.string, | ||
// | ||
// /** Shorthand for primary content of the FeedUser. Mutually exclusive with the children prop. */ | ||
// user: customPropTypes.every([ | ||
// customPropTypes.disallow(['children']), | ||
// PropTypes.string, | ||
// ]), | ||
// } | ||
// | ||
// FeedUser.defaultProps = { | ||
// as: 'a', | ||
// } | ||
// | ||
// export default FeedUser |