Skip to content

Commit

Permalink
Update tooltip for super like button to be separated between the rewa…
Browse files Browse the repository at this point in the history
…rd and like
  • Loading branch information
teodorus-nathaniel committed Mar 14, 2024
1 parent 196c89a commit 55ce94a
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 34 deletions.
10 changes: 10 additions & 0 deletions src/components/voting/SuperLike.module.sass
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,14 @@
&.SuperLikeActive
background: linear-gradient(97deg, #8B55FD 8.3%, #7493FC 91.24%)
color: white

&.SuperLikeDisabled
color: #94a3b8
color: rgba(0, 0, 0, 0.25)
background: #f5f5f5
border-color: #d9d9d9
text-shadow: none
-webkit-box-shadow: none
box-shadow: none
cursor: not-allowed

75 changes: 41 additions & 34 deletions src/components/voting/SuperLike.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,44 +175,51 @@ export default function SuperLike({ post, iconClassName, isComment, ...props }:
else if (!canBeSuperliked) tooltipTitle = `You cannot like ${entity}s that are older than 7 days`
else if (!superLikeMessage.message) tooltipTitle = 'Loading...'

const button = (
<div>
<Button
className={clsx(
'FontSmall',
styles.SuperLike,
isActive && styles.SuperLikeActive,
props.className,
)}
onClick={onClick}
disabled={isDisabled}
>
<IconWithLabel renderZeroCount icon={icon} count={count} />
<PostRewardStatWrapper postId={post.id}>
{({ reward, tooltip }) => (
<Tooltip title={tooltip} className='d-flex align-items-center'>
<div
className='mx-2.5'
style={{ height: '1em', width: '1px', background: '#CBD5E1' }}
/>
<span
className={clsx(
'd-flex align-items-center GapTiny',
isActive ? 'ColorWhite' : 'ColorMuted',
)}
>
{reward}
return (
<>
<div>
<Button
className={clsx(
'FontSmall',
styles.SuperLike,
isActive && styles.SuperLikeActive,
// Can't add disabled to the button itself because tooltip won't work if its disabled
isDisabled && styles.SuperLikeDisabled,
props.className,
)}
onClick={onClick}
title='test'
>
{tooltipTitle ? (
<Tooltip title={tooltipTitle}>
<span className='d-flex align-items-center'>
<IconWithLabel renderZeroCount icon={icon} count={count} />
</span>
</Tooltip>
) : (
<IconWithLabel renderZeroCount icon={icon} count={count} />
)}
</PostRewardStatWrapper>
</Button>
</div>
)
<PostRewardStatWrapper postId={post.id}>
{({ reward, tooltip }) => (
<Tooltip title={tooltip} className='d-flex align-items-center'>
<div
className='mx-2.5'
style={{ height: '1em', width: '1px', background: '#CBD5E1' }}
/>
<span
className={clsx(
'd-flex align-items-center GapTiny',
isActive ? 'ColorWhite' : 'ColorMuted',
)}
>
{reward}
</span>
</Tooltip>
)}
</PostRewardStatWrapper>
</Button>
</div>

return (
<>
{tooltipTitle ? <Tooltip title={tooltipTitle}>{button}</Tooltip> : button}
<ShouldStakeModal
visible={isOpenShouldStakeModal}
onCancel={() => setIsOpenShouldStakeModal(false)}
Expand Down

0 comments on commit 55ce94a

Please sign in to comment.