diff --git a/docs/app/Examples/views/Comment/Types/CommentCommentsExample.js b/docs/app/Examples/views/Comment/Types/CommentCommentsExample.js new file mode 100644 index 0000000000..72c16fb09d --- /dev/null +++ b/docs/app/Examples/views/Comment/Types/CommentCommentsExample.js @@ -0,0 +1,78 @@ +import React from 'react' +import { Comment } from 'stardust' + +const CommentCommentsExample = () => ( + +
Comments
+ + + + + + Matt + + Today at 5:42PM + + + How artistic! + + + Reply + + + + + + + + + Elliot Fu + + Yesterday at 12:30AM + + +

This has been very useful for my research. Thanks as well!

+
+ + Reply + +
+ + + + + + + Jenny Hess + + Just now + + + Elliot you are always so right :) + + + Reply + + + + +
+ + + + + + Joe Henderson + + 5 days ago + + + Dude, this is awesome. Thanks so much + + + Reply + + + +
+) diff --git a/src/views/Comment/Comment.js b/src/views/Comment/Comment.js new file mode 100644 index 0000000000..d96e3fd660 --- /dev/null +++ b/src/views/Comment/Comment.js @@ -0,0 +1,39 @@ +import React, { PropTypes } from 'react' +import cx from 'classnames' +import { META, getUnhandledProps } from '../../lib' +import CommentActions from './CommentActions' +import CommentAuthor from './CommentAuthor' +import CommentAvatar from './CommentAvatar' +import CommentContent from './CommentContent' +import CommentMeta from './CommentMeta' +import CommentText from './CommentText' + +const _meta = { + name: 'Comment', + type: META.TYPES.VIEW, +} + +function Comment(props) { + const { className, children } = props + const rest = getUnhandledProps(Comment, props) + const classes = cx( + 'comment', + className + ) + return ( +
+ {children} +
+ ) +} + +Comment._meta = _meta + +Comment.Actions = CommentActions +Comment.Author = CommentAuthor +Comment.Avatar = CommentAvatar +Comment.Content = CommentContent +Comment.Meta = CommentMeta +Comment.Text = CommentText + +export default Comment diff --git a/src/views/Comment/CommentActions.js b/src/views/Comment/CommentActions.js new file mode 100644 index 0000000000..db87f3508d --- /dev/null +++ b/src/views/Comment/CommentActions.js @@ -0,0 +1,22 @@ +import React from 'react' + +import { META, getUnhandledProps } from '../../lib' + +const _meta = { + name: 'CommentActions', + type: META.TYPES.VIEW, +} + +function CommentActions(props) { + const rest = getUnhandledProps(CommentActions, props) + return ( +
+ +
+ ) +} + +CommentActions._meta = _meta + + +export default CommentActions diff --git a/src/views/Comment/CommentAuthor.js b/src/views/Comment/CommentAuthor.js new file mode 100644 index 0000000000..948e52ca06 --- /dev/null +++ b/src/views/Comment/CommentAuthor.js @@ -0,0 +1,21 @@ +import React from 'react' + +import { META, getUnhandledProps } from '../../lib' + +const _meta = { + name: 'CommentAuthor', + type: META.TYPES.VIEW, +} + +function CommentAuthor(props) { + const rest = getUnhandledProps(CommentAuthor, props) + return ( +
+
+ ) +} + +CommentAuthor._meta = _meta + + +export default CommentAuthor diff --git a/src/views/Comment/CommentAvatar.js b/src/views/Comment/CommentAvatar.js new file mode 100644 index 0000000000..f4ae223904 --- /dev/null +++ b/src/views/Comment/CommentAvatar.js @@ -0,0 +1,22 @@ +import React from 'react' + +import { META, getUnhandledProps } from '../../lib' + +const _meta = { + name: 'CommentAvatar', + type: META.TYPES.VIEW, +} + +function CommentAvatar(props) { + const rest = getUnhandledProps(CommentAvatar, props) + return ( +
+ +
+ ) +} + +CommentAvatar._meta = _meta + + +export default CommentAvatar diff --git a/src/views/Comment/CommentContent.js b/src/views/Comment/CommentContent.js new file mode 100644 index 0000000000..79f8cf10a9 --- /dev/null +++ b/src/views/Comment/CommentContent.js @@ -0,0 +1,22 @@ +import React from 'react' + +import { META, getUnhandledProps } from '../../lib' + +const _meta = { + name: 'CommentContent', + type: META.TYPES.VIEW, +} + +function CommentContent(props) { + const rest = getUnhandledProps(CommentContent, props) + return ( +
+ +
+ ) +} + +CommentContent._meta = _meta + + +export default CommentContent diff --git a/src/views/Comment/CommentGroup.js b/src/views/Comment/CommentGroup.js new file mode 100644 index 0000000000..732d006c8f --- /dev/null +++ b/src/views/Comment/CommentGroup.js @@ -0,0 +1,22 @@ +import React from 'react' + +import { META, getUnhandledProps } from '../../lib' + +const _meta = { + name: 'CommentGroup', + type: META.TYPES.VIEW, +} + +function CommentGroup(props) { + const rest = getUnhandledProps(CommentGroup, props) + return ( +
+ +
+ ) +} + +CommentGroup._meta = _meta + + +export default CommentGroup diff --git a/src/views/Comment/CommentMeta.js b/src/views/Comment/CommentMeta.js new file mode 100644 index 0000000000..a2eb747edb --- /dev/null +++ b/src/views/Comment/CommentMeta.js @@ -0,0 +1,22 @@ +import React from 'react' + +import { META, getUnhandledProps } from '../../lib' + +const _meta = { + name: 'CommentMeta', + type: META.TYPES.VIEW, +} + +function CommentMeta(props) { + const rest = getUnhandledProps(CommentMeta, props) + return ( +
+ +
+ ) +} + +CommentMeta._meta = _meta + + +export default CommentMeta diff --git a/src/views/Comment/CommentText.js b/src/views/Comment/CommentText.js new file mode 100644 index 0000000000..edadb56044 --- /dev/null +++ b/src/views/Comment/CommentText.js @@ -0,0 +1,21 @@ +import React from 'react' + +import { META, getUnhandledProps } from '../../lib' + +const _meta = { + name: 'CommentText', + type: META.TYPES.VIEW, +} + +function CommentText(props) { + const rest = getUnhandledProps(CommentText, props) + return ( +
+ +
+ ) +} + +CommentText._meta = _meta + +export default CommentText diff --git a/src/views/index.js b/src/views/index.js index 43a1b0d17a..7f40e697bd 100644 --- a/src/views/index.js +++ b/src/views/index.js @@ -1,2 +1,3 @@ export { default as Item } from './Item/Item' export { default as Statistic } from './Statistic/Statistic' +export { default as Comment } from './Comment/Comment' diff --git a/test/specs/commonTests.js b/test/specs/commonTests.js index 55ab6c91e0..18fce22219 100644 --- a/test/specs/commonTests.js +++ b/test/specs/commonTests.js @@ -26,8 +26,8 @@ const componentCtx = require.context( const componentInfo = componentCtx.keys().map(key => { const Component = componentCtx(key).default - const componentType = typeof Component + if (componentType !== 'function') { throw new Error([ `${key} is not properly exported.`, diff --git a/test/specs/views/Comment/Comment-test.js b/test/specs/views/Comment/Comment-test.js new file mode 100644 index 0000000000..0d780308b2 --- /dev/null +++ b/test/specs/views/Comment/Comment-test.js @@ -0,0 +1,20 @@ +import Comment from 'src/views/Comment/Comment' +import CommentActions from 'src/views/Comment/CommentActions' +import CommentAuthor from 'src/views/Comment/CommentAuthor' +import CommentAvatar from 'src/views/Comment/CommentAvatar' +import CommentContent from 'src/views/Comment/CommentContent' +import CommentMeta from 'src/views/Comment/CommentMeta' +import CommentText from 'src/views/Comment/CommentText' +import * as common from 'test/specs/commonTests' +describe.only('Comment', () => { + common.isConformant(Comment) + common.rendersChildren(Comment) + common.hasSubComponents(Comment, [ + CommentActions, + CommentAuthor, + CommentAvatar, + CommentContent, + CommentMeta, + CommentText, + ]) +}) diff --git a/test/specs/views/Comment/CommentActions-test.js b/test/specs/views/Comment/CommentActions-test.js new file mode 100644 index 0000000000..d74139b820 --- /dev/null +++ b/test/specs/views/Comment/CommentActions-test.js @@ -0,0 +1,6 @@ +import CommentActions from 'src/views/CommentActions/CommentActions' +import * as common from 'test/specs/commonTests' +describe.only('CommentActions', () => { + common.isConformant(CommentActions) + common.rendersChildren(CommentActions) +}) diff --git a/test/specs/views/Comment/CommentAuthor-test.js b/test/specs/views/Comment/CommentAuthor-test.js new file mode 100644 index 0000000000..24caf0d064 --- /dev/null +++ b/test/specs/views/Comment/CommentAuthor-test.js @@ -0,0 +1,6 @@ +import CommentAuthor from 'src/views/CommentAuthor/CommentAuthor' +import * as common from 'test/specs/commonTests' +describe.only('CommentAuthor', () => { + common.isConformant(CommentAuthor) + common.rendersChildren(CommentAuthor) +}) diff --git a/test/specs/views/Comment/CommentAvatar-test.js b/test/specs/views/Comment/CommentAvatar-test.js new file mode 100644 index 0000000000..91f972a483 --- /dev/null +++ b/test/specs/views/Comment/CommentAvatar-test.js @@ -0,0 +1,6 @@ +import CommentAvatar from 'src/views/CommentAvatar/CommentAvatar' +import * as common from 'test/specs/commonTests' +describe.only('CommentAvatar', () => { + common.isConformant(CommentAvatar) + common.rendersChildren(CommentAvatar) +}) diff --git a/test/specs/views/Comment/CommentContent-test.js b/test/specs/views/Comment/CommentContent-test.js new file mode 100644 index 0000000000..45989985a0 --- /dev/null +++ b/test/specs/views/Comment/CommentContent-test.js @@ -0,0 +1,6 @@ +import CommentContent from 'src/views/CommentContent/CommentContent' +import * as common from 'test/specs/commonTests' +describe.only('CommentContent', () => { + common.isConformant(CommentContent) + common.rendersChildren(CommentContent) +}) diff --git a/test/specs/views/Comment/CommentGroup-test.js b/test/specs/views/Comment/CommentGroup-test.js new file mode 100644 index 0000000000..38c3e03ce8 --- /dev/null +++ b/test/specs/views/Comment/CommentGroup-test.js @@ -0,0 +1,6 @@ +import CommentGroup from 'src/views/CommentGroup/CommentGroup' +import * as common from 'test/specs/commonTests' +describe.only('CommentGroup', () => { + common.isConformant(CommentGroup) + common.rendersChildren(CommentGroup) +}) diff --git a/test/specs/views/Comment/CommentMeta-test.js b/test/specs/views/Comment/CommentMeta-test.js new file mode 100644 index 0000000000..899b28c45b --- /dev/null +++ b/test/specs/views/Comment/CommentMeta-test.js @@ -0,0 +1,6 @@ +import CommentMeta from 'src/views/CommentMeta/CommentMeta' +import * as common from 'test/specs/commonTests' +describe.only('CommentMeta', () => { + common.isConformant(CommentMeta) + common.rendersChildren(CommentMeta) +}) diff --git a/test/specs/views/Comment/CommentText-test.js b/test/specs/views/Comment/CommentText-test.js new file mode 100644 index 0000000000..47849acede --- /dev/null +++ b/test/specs/views/Comment/CommentText-test.js @@ -0,0 +1,6 @@ +import CommentText from 'src/views/CommentText/CommentText' +import * as common from 'test/specs/commonTests' +describe.only('CommentText', () => { + common.isConformant(CommentText) + common.rendersChildren(CommentText) +})