-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
feat(Comment): add component #392
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
78 changes: 78 additions & 0 deletions
78
docs/app/Examples/views/Comment/Types/CommentCommentsExample.js
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,78 @@ | ||
import React from 'react' | ||
import { Comment } from 'stardust' | ||
|
||
const CommentCommentsExample = () => ( | ||
<Comment.Group> | ||
<Header dividing>Comments</Header> | ||
<Comment> | ||
<Comment.Avatar> | ||
<img src='http://semantic-ui.com/images/avatar/small/matt.jpg' /> | ||
</Comment.Avatar> | ||
<Comment.Content> | ||
<Comment.Author>Matt</Comment.Author> | ||
<Comment.Meta> | ||
<span class="date">Today at 5:42PM</span> | ||
</Comment.Meta> | ||
<Comment.Text> | ||
How artistic! | ||
</Comment.Text> | ||
<Comment.Actions class="actions"> | ||
<a class="reply">Reply</a> | ||
</Comment.Actions> | ||
</Comment.Content> | ||
</Comment> | ||
<Comment> | ||
<Comment.Avatar> | ||
<img src='http://semantic-ui.com/images/avatar/small/matt.jpg' /> | ||
</Comment.Avatar> | ||
<Comment.Content> | ||
<Comment.Author>Elliot Fu</Comment.Author> | ||
<Comment.Meta> | ||
<span class="date">Yesterday at 12:30AM</span> | ||
</Comment.Meta> | ||
<Comment.Text> | ||
<p>This has been very useful for my research. Thanks as well!</p> | ||
</Comment.Text> | ||
<Comment.Actions class="actions"> | ||
<a class="reply">Reply</a> | ||
</Comment.Actions> | ||
</Comment.Content> | ||
<Comment.Group> | ||
<Comment> | ||
<Comment.Avatar> | ||
<img src='http://semantic-ui.com/images/avatar/small/jenny.jpg' /> | ||
</Comment.Avatar> | ||
<Comment.Content> | ||
<Comment.Author>Jenny Hess</Comment.Author> | ||
<Comment.Meta> | ||
<span class="date">Just now</span> | ||
</Comment.Meta> | ||
<Comment.Text> | ||
Elliot you are always so right :) | ||
</Comment.Text> | ||
<Comment.Actions> | ||
<a class="reply">Reply</a> | ||
</Comment.Actions> | ||
</Comment.Content> | ||
</Comment> | ||
</Comment.Group> | ||
</Comment> | ||
<Comment> | ||
<Comment.Avatar> | ||
<img src='http://semantic-ui.com/images/avatar/small/joe.jpg' /> | ||
</Comment.Avatar> | ||
<Comment.Content> | ||
<Comment.Author>Joe Henderson</Comment.Author> | ||
<Comment.Meta> | ||
<span class="date">5 days ago</span> | ||
</Comment.Meta> | ||
<Comment.Text> | ||
Dude, this is awesome. Thanks so much | ||
</Commment.Text> | ||
<Comment.Actions> | ||
<a class="reply">Reply</a> | ||
</Comment.Actions> | ||
</Comment.Conent> | ||
</Comment> | ||
</Comment.Group> | ||
) |
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,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 ( | ||
<div {...rest} className={classes}> | ||
{children} | ||
</div> | ||
) | ||
} | ||
|
||
Comment._meta = _meta | ||
|
||
Comment.Actions = CommentActions | ||
Comment.Author = CommentAuthor | ||
Comment.Avatar = CommentAvatar | ||
Comment.Content = CommentContent | ||
Comment.Meta = CommentMeta | ||
Comment.Text = CommentText | ||
|
||
export default Comment |
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,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 ( | ||
<div {...rest}> | ||
|
||
</div> | ||
) | ||
} | ||
|
||
CommentActions._meta = _meta | ||
|
||
|
||
export default CommentActions |
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,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 ( | ||
<div {...rest}> | ||
</div> | ||
) | ||
} | ||
|
||
CommentAuthor._meta = _meta | ||
|
||
|
||
export default CommentAuthor |
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,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 ( | ||
<div {...rest}> | ||
|
||
</div> | ||
) | ||
} | ||
|
||
CommentAvatar._meta = _meta | ||
|
||
|
||
export default CommentAvatar |
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,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 ( | ||
<div {...rest}> | ||
|
||
</div> | ||
) | ||
} | ||
|
||
CommentContent._meta = _meta | ||
|
||
|
||
export default CommentContent |
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,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 ( | ||
<div {...rest}> | ||
|
||
</div> | ||
) | ||
} | ||
|
||
CommentGroup._meta = _meta | ||
|
||
|
||
export default CommentGroup |
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,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 ( | ||
<div {...rest}> | ||
|
||
</div> | ||
) | ||
} | ||
|
||
CommentMeta._meta = _meta | ||
|
||
|
||
export default CommentMeta |
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,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 ( | ||
<div {...rest}> | ||
|
||
</div> | ||
) | ||
} | ||
|
||
CommentText._meta = _meta | ||
|
||
export default CommentText |
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,2 +1,3 @@ | ||
export { default as Item } from './Item/Item' | ||
export { default as Statistic } from './Statistic/Statistic' | ||
export { default as Comment } from './Comment/Comment' |
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,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, | ||
]) | ||
}) |
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,6 @@ | ||
import CommentActions from 'src/views/CommentActions/CommentActions' | ||
import * as common from 'test/specs/commonTests' | ||
describe.only('CommentActions', () => { | ||
common.isConformant(CommentActions) | ||
common.rendersChildren(CommentActions) | ||
}) |
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,6 @@ | ||
import CommentAuthor from 'src/views/CommentAuthor/CommentAuthor' | ||
import * as common from 'test/specs/commonTests' | ||
describe.only('CommentAuthor', () => { | ||
common.isConformant(CommentAuthor) | ||
common.rendersChildren(CommentAuthor) | ||
}) |
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,6 @@ | ||
import CommentAvatar from 'src/views/CommentAvatar/CommentAvatar' | ||
import * as common from 'test/specs/commonTests' | ||
describe.only('CommentAvatar', () => { | ||
common.isConformant(CommentAvatar) | ||
common.rendersChildren(CommentAvatar) | ||
}) |
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,6 @@ | ||
import CommentContent from 'src/views/CommentContent/CommentContent' | ||
import * as common from 'test/specs/commonTests' | ||
describe.only('CommentContent', () => { | ||
common.isConformant(CommentContent) | ||
common.rendersChildren(CommentContent) | ||
}) |
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,6 @@ | ||
import CommentGroup from 'src/views/CommentGroup/CommentGroup' | ||
import * as common from 'test/specs/commonTests' | ||
describe.only('CommentGroup', () => { | ||
common.isConformant(CommentGroup) | ||
common.rendersChildren(CommentGroup) | ||
}) |
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,6 @@ | ||
import CommentMeta from 'src/views/CommentMeta/CommentMeta' | ||
import * as common from 'test/specs/commonTests' | ||
describe.only('CommentMeta', () => { | ||
common.isConformant(CommentMeta) | ||
common.rendersChildren(CommentMeta) | ||
}) |
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,6 @@ | ||
import CommentText from 'src/views/CommentText/CommentText' | ||
import * as common from 'test/specs/commonTests' | ||
describe.only('CommentText', () => { | ||
common.isConformant(CommentText) | ||
common.rendersChildren(CommentText) | ||
}) |
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.