-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(pull request): button for comments display (#86)
Co-authored-by: itupix <jerome.boukorras@axa.fr>
- Loading branch information
Showing
3 changed files
with
55 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,27 @@ | ||
.skz-comments-counter { | ||
font-size: 0.8rem; | ||
color: #aaa; | ||
animation: fadeIn 0.2s; | ||
font-size: 0.8rem; | ||
color: #aaa; | ||
animation: fadeIn 0.2s; | ||
padding: 0.2rem 0.5rem; | ||
border-radius: 4px; | ||
transition: background-color linear 0.2s; | ||
|
||
&:after { | ||
content: '\EA4C'; | ||
margin-left: 0.25rem; | ||
font-family: 'Icons'; | ||
vertical-align: bottom; | ||
} | ||
&:after { | ||
content: '\EA4C'; | ||
margin-left: 0.25rem; | ||
font-family: 'Icons'; | ||
vertical-align: bottom; | ||
} | ||
|
||
&--all-resolved { | ||
color: #9fd9b4; | ||
} | ||
&--all-resolved { | ||
color: #9fd9b4; | ||
} | ||
|
||
&--responses { | ||
color: #d87c7c; | ||
} | ||
&--responses { | ||
color: #d87c7c; | ||
} | ||
|
||
&:hover { | ||
background-color: #eee; | ||
} | ||
} |
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,23 +1,30 @@ | ||
<script> | ||
export let comments = []; | ||
export let hasResponse; | ||
export let comments = []; | ||
export let hasResponse; | ||
export let action; | ||
const isDisplayed = comments && comments.length > 0; | ||
const isCommentResolved = ({ status }) => | ||
status && status !== 'active' && status !== 'pending'; | ||
const commentsResolved = | ||
comments.filter(isCommentResolved).length === comments.length; | ||
const classModifier = commentsResolved | ||
? 'skz-comments-counter--all-resolved' | ||
: hasResponse | ||
? 'skz-comments-counter--responses' | ||
: ''; | ||
const isDisplayed = comments && comments.length > 0; | ||
const isCommentResolved = ({ status }) => | ||
status && status !== 'active' && status !== 'pending'; | ||
const commentsResolved = | ||
comments.filter(isCommentResolved).length === comments.length; | ||
const classModifier = commentsResolved | ||
? 'skz-comments-counter--all-resolved' | ||
: hasResponse | ||
? 'skz-comments-counter--responses' | ||
: ''; | ||
const onClick = e => { | ||
e.preventDefault(); | ||
action(); | ||
}; | ||
</script> | ||
|
||
<style src="./CommentsCounter.scss"> | ||
</style> | ||
|
||
{#if isDisplayed} | ||
<p class={`skz-comments-counter ${classModifier}`}>{comments.length}</p> | ||
<p on:click={onClick} class={`skz-comments-counter ${classModifier}`}> | ||
{comments.length} | ||
</p> | ||
{/if} |
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