-
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.
feature(Like Dislike and Get single Article): implement feedback [Fix…
…es #167484555]
- Loading branch information
Musinda Kadhuwa
committed
Oct 29, 2019
1 parent
86d078f
commit 4a85fcc
Showing
16 changed files
with
119 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.commentCount-box { | ||
height: 100px; | ||
margin: 0 0 0 1em; | ||
float: left; | ||
} | ||
.comment { | ||
color: black; | ||
&_box { | ||
display: inline-flex; | ||
height: 30px; | ||
justify-content: space-between; | ||
width: fit-content; | ||
&:hover { | ||
cursor: pointer; | ||
} | ||
} | ||
} |
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,15 @@ | ||
import React from 'react'; | ||
import './CommentCount.scss'; | ||
|
||
export default function CommentCount({ count }) { | ||
return ( | ||
<div className="commentCount-box"> | ||
<div className="comment"> | ||
<span className="comment_count"> | ||
{count} | ||
{count === 1 ? ' comment' : ' comments'} | ||
</span> | ||
</div> | ||
</div> | ||
); | ||
} |
21 changes: 21 additions & 0 deletions
21
src/app/common/CommentCount/__tests__/CommentCountComponent.test.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,21 @@ | ||
|
||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import CommentCount from '../CommentCountComponent'; | ||
|
||
describe('Comment Count Components tests', () => { | ||
const wrapper = shallow(<CommentCount count={1} />); | ||
it('Should render tags', () => { | ||
expect(wrapper.find('div').length).toBe(2); | ||
expect(wrapper.find('span').length).toBe(1); | ||
}); | ||
it('Should render 1 comment', () => { | ||
expect(wrapper.text()).toEqual('1 comment'); | ||
}); | ||
}); | ||
describe('Comment Count Components tests', () => { | ||
const wrapper = shallow(<CommentCount count={2} />); | ||
it('Should render 2 comments', () => { | ||
expect(wrapper.text()).toEqual('2 comments'); | ||
}); | ||
}); |
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,10 +1,12 @@ | ||
const token = localStorage.getItem('token'); | ||
|
||
const axiosConfig = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: token | ||
} | ||
export const getToken = () => localStorage.getItem('token'); | ||
const setAxiosConfig = () => { | ||
const axiosConfig = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: getToken() | ||
} | ||
}; | ||
return axiosConfig; | ||
}; | ||
|
||
export default axiosConfig; | ||
export default setAxiosConfig; |
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 |
---|---|---|
|
@@ -125,6 +125,7 @@ | |
} | ||
.likeDislike-box { | ||
height: 40px; | ||
pointer-events: none; | ||
} | ||
} | ||
} | ||
|
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
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 |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
} | ||
.likes, | ||
.dislikes { | ||
color: black; | ||
display: flex; | ||
height: 30px; | ||
justify-content: space-between; | ||
|
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