@@ -17,6 +17,7 @@ type LikeButtonProps = {
1717 addThreadReaction : Function ,
1818 removeThreadReaction : Function ,
1919 currentUser : ?Object ,
20+ tipLocation ?: string ,
2021 dispatch : Dispatch < Object > ,
2122} ;
2223
@@ -45,15 +46,15 @@ class LikeButtonPure extends React.Component<LikeButtonProps> {
4546 } ;
4647
4748 render ( ) {
48- const { thread } = this . props ;
49+ const { thread , tipLocation = 'bottom-left' } = this . props ;
4950 const { hasReacted , count } = thread . reactions ;
5051
5152 return (
5253 < LikeButtonWrapper hasReacted = { hasReacted } >
5354 < IconButton
54- glyph = { hasReacted ? 'thumbsup-fill' : 'thumbsup' }
55+ glyph = { 'thumbsup' }
5556 tipText = { hasReacted ? 'Unlike thread' : 'Like thread' }
56- tipLocation = { 'bottom-left' }
57+ tipLocation = { tipLocation }
5758 onClick = { this . handleClick }
5859 />
5960 < CurrentCount > { count } </ CurrentCount >
@@ -80,20 +81,15 @@ type LikeCountProps = {
8081export const LikeCount = ( props : LikeCountProps ) => {
8182 const { active, thread } = props ;
8283 const { count } = thread . reactions ;
83-
84- if ( count > 0 ) {
85- return (
86- < LikeCountWrapper active = { active } >
87- < Icon
88- glyph = { 'thumbsup-fill' }
89- size = { 24 }
90- tipText = { `${ count } likes` }
91- tipLocation = { 'top-right' }
92- />
93- < CurrentCount > { count } </ CurrentCount >
94- </ LikeCountWrapper >
95- ) ;
96- } else {
97- return null ;
98- }
84+ return (
85+ < LikeCountWrapper active = { active } >
86+ < Icon
87+ glyph = { 'thumbsup' }
88+ size = { 24 }
89+ tipText = { `${ count } likes` }
90+ tipLocation = { 'top-right' }
91+ />
92+ < CurrentCount > { count || '0' } </ CurrentCount >
93+ </ LikeCountWrapper >
94+ ) ;
9995} ;
0 commit comments