-
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.
Also: - Add retry icon and tweak other icons - Update text button according to last spec - Support disabling preload in avatar
- Loading branch information
Showing
41 changed files
with
1,497 additions
and
401 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
@import "mixins/typography"; | ||
|
||
.author { | ||
display: flex; | ||
align-items: center; | ||
|
||
& .name { | ||
@mixin typography-caption rem; | ||
margin-left: 1.5rem; | ||
flex: 1 1; | ||
} | ||
} |
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 Avatar from '../avatar'; | ||
import styles from './Author.css'; | ||
|
||
const Author = ({ author, myself, preloadAvatarImage, className }) => ( | ||
<div className={ classNames(styles.author, className) }> | ||
<Avatar | ||
name={ author.name } | ||
image={ author.avatar } | ||
preloadImage={ preloadAvatarImage } /> | ||
|
||
<span className={ styles.name }> | ||
{ author.name } | ||
{ myself && ' (You)' } | ||
</span> | ||
</div> | ||
); | ||
|
||
Author.propTypes = { | ||
author: PropTypes.object.isRequired, | ||
myself: PropTypes.bool, | ||
preloadAvatarImage: PropTypes.bool, | ||
className: PropTypes.string, | ||
}; | ||
|
||
export default Author; |
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,24 @@ | ||
@import "colors"; | ||
|
||
.authorPlaceholder { | ||
display: flex; | ||
flex: 1 0; | ||
align-items: center; | ||
|
||
& .dummyAvatar { | ||
width: 3rem; | ||
height: 3rem; | ||
display: inline-block; | ||
background-color: var(--color-seashell); | ||
border-radius: 50%; | ||
} | ||
|
||
& .dummyNameText { | ||
max-width: 14rem; | ||
height: 1rem; | ||
margin-left: 1.5rem; | ||
flex: 1 1; | ||
background-color: var(--color-seashell); | ||
border-radius: 0.6rem; | ||
} | ||
} |
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,17 @@ | ||
import React from 'react'; | ||
import classNames from 'classnames'; | ||
import PropTypes from 'prop-types'; | ||
import styles from './AuthorPlaceholder.css'; | ||
|
||
const AuthorPlaceholder = ({ className }) => ( | ||
<div className={ classNames(styles.authorPlaceholder, className) }> | ||
<div className={ styles.dummyAvatar } /> | ||
<div className={ styles.dummyNameText } /> | ||
</div> | ||
); | ||
|
||
AuthorPlaceholder.propTypes = { | ||
className: PropTypes.string, | ||
}; | ||
|
||
export default AuthorPlaceholder; |
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,43 @@ | ||
@import "colors"; | ||
@import "mixins/typography"; | ||
|
||
.bottomBarPlaceholder { | ||
margin-top: 1.5rem; | ||
display: flex; | ||
justify-content: space-between; | ||
|
||
& .author { | ||
width: 45%; | ||
margin-right: 1rem; | ||
} | ||
|
||
& .details { | ||
display: flex; | ||
align-items: center; | ||
line-height: 1; | ||
|
||
& .dummyDateText { | ||
width: 3rem; | ||
height: 1rem; | ||
background-color: var(--color-seashell); | ||
border-radius: 0.6rem; | ||
} | ||
|
||
& .dummySeparator { | ||
margin: 0 1rem; | ||
color: var(--color-seashell); | ||
@mixin typography-overline rem, no-line-height; | ||
|
||
&::after { | ||
content: "•"; | ||
} | ||
} | ||
|
||
& .dummyActionsText { | ||
width: 6.1rem; | ||
height: 1rem; | ||
background-color: var(--color-seashell); | ||
border-radius: 0.6rem; | ||
} | ||
} | ||
} |
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,23 @@ | ||
import React from 'react'; | ||
import classNames from 'classnames'; | ||
import PropTypes from 'prop-types'; | ||
import AuthorPlaceholder from './AuthorPlaceholder'; | ||
import styles from './BottomBarPlaceholder.css'; | ||
|
||
const BottomBarPlaceholder = ({ className }) => ( | ||
<div className={ classNames(styles.bottomBarPlaceholder, className) }> | ||
<AuthorPlaceholder className={ styles.author } /> | ||
|
||
<div className={ styles.details }> | ||
<span className={ styles.dummyDateText } /> | ||
<span className={ styles.dummySeparator } /> | ||
<span className={ styles.dummyActionsText } /> | ||
</div> | ||
</div> | ||
); | ||
|
||
BottomBarPlaceholder.propTypes = { | ||
className: PropTypes.string, | ||
}; | ||
|
||
export default BottomBarPlaceholder; |
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,3 @@ | ||
export { default as Author } from './Author'; | ||
export { default as AuthorPlaceholder } from './AuthorPlaceholder'; | ||
export { default as BottomBarPlaceholder } from './BottomBarPlaceholder'; |
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,45 @@ | ||
@import "colors"; | ||
@import "mixins/typography"; | ||
|
||
.commentError { | ||
min-width: 35rem; | ||
|
||
& .content { | ||
position: relative; | ||
|
||
& .message { | ||
padding: 1.8rem 2rem; | ||
@mixin typography-body-2 rem; | ||
background-color: var(--color-seashell); | ||
border-radius: 0.8rem 0.8rem 0.8rem 0; | ||
} | ||
|
||
& .actions { | ||
position: absolute; | ||
right: 0; | ||
bottom: 0; | ||
padding: 1rem; | ||
display: flex; /* Remove extra space because of inline-block of children */ | ||
background-color: var(--color-seashell); | ||
border-radius: 0.8rem; | ||
|
||
& .icon { | ||
width: 1.6rem; | ||
height: 1.6rem; | ||
color: var(--color-gray); | ||
|
||
&:not(:last-child) { | ||
margin-right: 1rem; | ||
} | ||
} | ||
} | ||
|
||
&:hover .actions .icon { | ||
fill: var(--color-science-blue); | ||
} | ||
} | ||
|
||
& .bottomBar { | ||
margin-top: 1rem; | ||
} | ||
} |
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,33 @@ | ||
import React from 'react'; | ||
import classNames from 'classnames'; | ||
import PropTypes from 'prop-types'; | ||
import { RetryIcon } from '../icon'; | ||
import { BottomBarPlaceholder } from '../comment-common'; | ||
import styles from './CommentError.css'; | ||
|
||
const CommentError = ({ onRetry, className, ...rest }) => ( | ||
<div { ...rest } className={ classNames(styles.commentError, className) }> | ||
<div className={ styles.content }> | ||
<pre className={ styles.message }> | ||
This comment couldn't be loaded. | ||
{ '\n\n' } | ||
</pre> | ||
|
||
<div className={ styles.actions }> | ||
<RetryIcon | ||
interactive | ||
onClick={ onRetry } | ||
className={ styles.icon } /> | ||
</div> | ||
</div> | ||
|
||
<BottomBarPlaceholder className={ styles.bottomBar } /> | ||
</div> | ||
); | ||
|
||
CommentError.propTypes = { | ||
onRetry: PropTypes.func.isRequired, | ||
className: PropTypes.string, | ||
}; | ||
|
||
export default CommentError; |
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,19 @@ | ||
# CommentError | ||
|
||
A component to be used when a comment failed to load. | ||
|
||
## Usage | ||
|
||
```jsx | ||
import { CommentError } from '@discussify/styleguide'; | ||
|
||
<CommentError /> | ||
``` | ||
|
||
## Props | ||
|
||
| name | type | default | description | | ||
| ---- | ---- | ------- | ----------- | | ||
| onRetry | func | *required* | Function to call when retry is clicked | | ||
|
||
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 './CommentError'; |
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,45 @@ | ||
@import "colors"; | ||
@import "mixins/typography"; | ||
|
||
.commentInput { | ||
min-width: 350px; | ||
|
||
& .textarea { | ||
width: 100%; | ||
padding: 1.7rem 1.9rem; | ||
display: block; /* Remove extra space at the bottom */ | ||
border: none; | ||
border: 1px solid var(--color-gray); | ||
background-color: var(--color-white); | ||
border-radius: 0.8rem 0.8rem 0.8rem 0; | ||
@mixin typography-body-2 rem; | ||
} | ||
|
||
& .bottomBar { | ||
margin-top: 1rem; | ||
display: flex; | ||
align-items: center; | ||
line-height: 1; | ||
|
||
& .author { | ||
margin-right: 1rem; | ||
flex: 1 0; | ||
} | ||
|
||
& .actions { | ||
display: inline-flex; | ||
align-items: center; | ||
|
||
& .separator { | ||
margin: 0 1rem; | ||
font-size: 1.2rem; | ||
|
||
&::after { | ||
content: "•"; | ||
opacity: 0.5; | ||
color: var(--color-gray); | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.