-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
227 additions
and
14 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
54 changes: 54 additions & 0 deletions
54
src/components/comment-replies-header-placeholder/CommentRepliesHeaderPlaceholder.css
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,54 @@ | ||
@import "colors"; | ||
@import "mixins/typography"; | ||
|
||
.commentRepliesHeaderPlaceholder { | ||
min-width: 350px; | ||
display: flex; | ||
align-items: center; | ||
|
||
& .replyingTo { | ||
overflow: hidden; | ||
display: flex; | ||
flex: 1 0; | ||
align-items: center; | ||
|
||
& .replyIcon { | ||
width: 1.6rem; | ||
height: 1.6rem; | ||
color: var(--color-seashell); | ||
} | ||
|
||
& .dummyText { | ||
width: 14rem; | ||
height: 1rem; | ||
margin-left: 0.8rem; | ||
background-color: var(--color-seashell); | ||
border-radius: 0.6rem; | ||
} | ||
|
||
& .fakeText { | ||
position: relative; | ||
left: -1rem; | ||
@mixin typography-overline rem; | ||
color: var(--color-seashell); | ||
|
||
&::after { | ||
content: "-"; | ||
} | ||
|
||
} | ||
} | ||
|
||
& .viewMore { | ||
display: flex; | ||
align-items: center; | ||
|
||
& .dummyButton { | ||
width: 13rem; | ||
height: 1rem; | ||
margin-left: 0.8rem; | ||
background-color: var(--color-seashell); | ||
border-radius: 0.6rem; | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/components/comment-replies-header-placeholder/CommentRepliesHeaderPlaceholder.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,28 @@ | ||
import React from 'react'; | ||
import classNames from 'classnames'; | ||
import PropTypes from 'prop-types'; | ||
import { ReplyIcon } from '../icon'; | ||
import styles from './CommentRepliesHeaderPlaceholder.css'; | ||
|
||
const CommentRepliesHeaderPlaceholder = ({ withViewMore, className, ...rest }) => ( | ||
<div { ...rest } className={ classNames(styles.commentRepliesHeaderPlaceholder, className) }> | ||
<div className={ styles.replyingTo }> | ||
<ReplyIcon className={ styles.replyIcon } /> | ||
<span className={ styles.dummyText } /> | ||
<span className={ styles.fakeText } /> | ||
</div> | ||
|
||
{ withViewMore && ( | ||
<div className={ styles.viewMore }> | ||
<div className={ styles.dummyButton } /> | ||
</div> | ||
) } | ||
</div> | ||
); | ||
|
||
CommentRepliesHeaderPlaceholder.propTypes = { | ||
withViewMore: PropTypes.bool, | ||
className: PropTypes.string, | ||
}; | ||
|
||
export default CommentRepliesHeaderPlaceholder; |
20 changes: 20 additions & 0 deletions
20
src/components/comment-replies-header-placeholder/README.md
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 @@ | ||
# CommentRepliesHeaderPlaceholder | ||
|
||
A placeholder for the replies header to be used while a comment is loading. | ||
|
||
## Usage | ||
|
||
```jsx | ||
import { CommentRepliesHeaderPlaceholder } from '@discussify/styleguide'; | ||
|
||
<CommentRepliesHeaderPlaceholder /> | ||
``` | ||
|
||
## Props | ||
|
||
| name | type | default | description | | ||
| ---- | ---- | ------- | ----------- | | ||
| author | object | *required* | The author of the comment that the replies refer to | | ||
| withViewMore | bool | false | Show the right that contains the number of remaining comments | | ||
|
||
Any other properties supplied will be spread to the root element. |
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 @@ | ||
export { default } from './CommentRepliesHeaderPlaceholder'; |
47 changes: 47 additions & 0 deletions
47
src/components/comment-replies-header/CommentRepliesHeader.css
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,47 @@ | ||
@import "colors"; | ||
@import "mixins/typography"; | ||
|
||
.commentRepliesHeader { | ||
min-width: 350px; | ||
display: flex; | ||
align-items: center; | ||
|
||
& .replyingTo { | ||
display: flex; | ||
flex: 1 0; | ||
align-items: center; | ||
color: var(--color-gray); | ||
|
||
& .replyIcon { | ||
width: 1.6rem; | ||
height: 1.6rem; | ||
} | ||
|
||
& .text { | ||
@mixin typography-overline rem; | ||
margin-left: 0.8rem; | ||
} | ||
} | ||
|
||
& .viewMore { | ||
margin-left: 1rem; | ||
display: flex; | ||
align-items: center; | ||
|
||
& .button { | ||
margin: 0; | ||
padding: 0; | ||
border: 0; | ||
@mixin typography-overline rem; | ||
opacity: 0.5; | ||
background: none; | ||
color: var(--color-gray); | ||
cursor: pointer; | ||
transition: opacity 0.2s ease; | ||
|
||
&:hover { | ||
opacity: 1; | ||
} | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/components/comment-replies-header/CommentRepliesHeader.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,31 @@ | ||
import React from 'react'; | ||
import classNames from 'classnames'; | ||
import PropTypes from 'prop-types'; | ||
import { ReplyIcon } from '../icon'; | ||
import styles from './CommentRepliesHeader.css'; | ||
|
||
const CommentRepliesHeader = ({ author, viewMoreCount, onViewMore, className, ...rest }) => ( | ||
<div { ...rest } className={ classNames(styles.commentRepliesHeader, className) }> | ||
<div className={ styles.replyingTo }> | ||
<ReplyIcon className={ styles.replyIcon } /> | ||
<span className={ styles.text }>Replying to: { author.name || 'Unnamed' }</span> | ||
</div> | ||
|
||
{ viewMoreCount > 0 && onViewMore && ( | ||
<div className={ styles.viewMore }> | ||
<button onClick={ onViewMore } className={ styles.button }> | ||
View more replies ({ viewMoreCount }) | ||
</button> | ||
</div> | ||
) } | ||
</div> | ||
); | ||
|
||
CommentRepliesHeader.propTypes = { | ||
author: PropTypes.object.isRequired, | ||
viewMoreCount: PropTypes.number, | ||
onViewMore: PropTypes.func, | ||
className: PropTypes.string, | ||
}; | ||
|
||
export default CommentRepliesHeader; |
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,32 @@ | ||
# CommentRepliesHeader | ||
|
||
A header to be rendered whenever showing replies to a comment. | ||
|
||
## Usage | ||
|
||
```jsx | ||
import { CommentRepliesHeader } from '@discussify/styleguide'; | ||
|
||
const author: { | ||
did: 'did:uport:2odP6zYTh8K95xztx3qpf3RishNXdUFCkH6', | ||
avatar: 'https://ipfs.infura.io/ipfs/Qme2BurB5BFTLxTqmjUBu7qgsE96iCpf6iJD9MurhBRoSC', | ||
name: 'André Cruz', | ||
}; | ||
|
||
<CommentRepliesHeader | ||
author={ author } | ||
viewMoreCount={ 10 } | ||
onViewMore={ handleViewMore } /> | ||
``` | ||
|
||
## Props | ||
|
||
| name | type | default | description | | ||
| ---- | ---- | ------- | ----------- | | ||
| author | object | *required* | The author of the comment that the replies refer to | | ||
| viewMoreCount | number | 0 | The number of replies that are hidden, where 0 hides the counter | | ||
| onViewMore | bool | | Function to be called when onViewMore is clicked | | ||
|
||
Any other properties supplied will be spread to the root element. | ||
|
||
Note that if `onViewMore` is not set, the counter will be hidden. |
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 @@ | ||
export { default } from './CommentRepliesHeader'; |
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