Commit 50a70015 authored by Lyza Danger Gardner's avatar Lyza Danger Gardner Committed by Lyza Gardner

Update shared components in `AnnotationHeader`

Visual change: hover on expand-replies is `brand` instead of
`brand-dark`—this is a standard hover color for a light-colored link.
parent 7706b6b4
import { Icon, LinkButton } from '@hypothesis/frontend-shared'; import {
LinkButton,
HighlightIcon,
LockIcon,
} from '@hypothesis/frontend-shared/lib/next';
import { useMemo } from 'preact/hooks'; import { useMemo } from 'preact/hooks';
import { withServices } from '../../service-context'; import { withServices } from '../../service-context';
...@@ -116,15 +120,19 @@ function AnnotationHeader({ ...@@ -116,15 +120,19 @@ function AnnotationHeader({
<header> <header>
<HeaderRow> <HeaderRow>
{isPrivate(annotation.permissions) && !isEditing && ( {isPrivate(annotation.permissions) && !isEditing && (
<Icon <LockIcon
classes="text-tiny" className="text-tiny w-em h-em"
name="lock"
title="This annotation is visible only to you" title="This annotation is visible only to you"
/> />
)} )}
<AnnotationUser authorLink={authorLink} displayName={authorName} /> <AnnotationUser authorLink={authorLink} displayName={authorName} />
{replyCount > 0 && isCollapsedReply && ( {replyCount > 0 && isCollapsedReply && (
<LinkButton onClick={onReplyCountClick} title="Expand replies"> <LinkButton
color="text-light"
onClick={onReplyCountClick}
title="Expand replies"
underline="hover"
>
{`${replyCount} ${replyCount > 1 ? 'replies' : 'reply'}`} {`${replyCount} ${replyCount > 1 ? 'replies' : 'reply'}`}
</LinkButton> </LinkButton>
)} )}
...@@ -150,10 +158,9 @@ function AnnotationHeader({ ...@@ -150,10 +158,9 @@ function AnnotationHeader({
/> />
)} )}
{!isEditing && isHighlight(annotation) && ( {!isEditing && isHighlight(annotation) && (
<Icon <HighlightIcon
name="highlight"
title="This is a highlight. Click 'edit' to add a note or tag." title="This is a highlight. Click 'edit' to add a note or tag."
classes="text-tiny text-color-text-light" className="text-tiny w-em h-em text-color-text-light"
/> />
)} )}
{showDocumentInfo && ( {showDocumentInfo && (
......
...@@ -96,7 +96,7 @@ describe('AnnotationHeader', () => { ...@@ -96,7 +96,7 @@ describe('AnnotationHeader', () => {
const wrapper = createAnnotationHeader(); const wrapper = createAnnotationHeader();
assert.isTrue(wrapper.find('Icon').filter({ name: 'lock' }).exists()); assert.isTrue(wrapper.find('LockIcon').exists());
}); });
it('should not render an "Only Me" icon if the annotation is being edited', () => { it('should not render an "Only Me" icon if the annotation is being edited', () => {
...@@ -104,7 +104,7 @@ describe('AnnotationHeader', () => { ...@@ -104,7 +104,7 @@ describe('AnnotationHeader', () => {
const wrapper = createAnnotationHeader({ isEditing: true }); const wrapper = createAnnotationHeader({ isEditing: true });
assert.isFalse(wrapper.find('Icon').filter({ name: 'lock' }).exists()); assert.isFalse(wrapper.find('LockIcon').exists());
}); });
it('should not render an "Only Me" icon if the annotation is not private', () => { it('should not render an "Only Me" icon if the annotation is not private', () => {
...@@ -303,9 +303,8 @@ describe('AnnotationHeader', () => { ...@@ -303,9 +303,8 @@ describe('AnnotationHeader', () => {
const wrapper = createAnnotationHeader({ const wrapper = createAnnotationHeader({
isEditing: false, isEditing: false,
}); });
const highlightIcon = wrapper.find('Icon[name="highlight"]');
assert.isTrue(highlightIcon.exists()); assert.isTrue(wrapper.find('HighlightIcon').exists());
}); });
it('should not display the is-highlight icon if annotation is not a highlight', () => { it('should not display the is-highlight icon if annotation is not a highlight', () => {
...@@ -313,9 +312,8 @@ describe('AnnotationHeader', () => { ...@@ -313,9 +312,8 @@ describe('AnnotationHeader', () => {
const wrapper = createAnnotationHeader({ const wrapper = createAnnotationHeader({
isEditing: false, isEditing: false,
}); });
const highlightIcon = wrapper.find('Icon[name="highlight"]');
assert.isFalse(highlightIcon.exists()); assert.isFalse(wrapper.find('HighlightIcon').exists());
}); });
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment