Commit 7a1721dc authored by Lyza Danger Gardner's avatar Lyza Danger Gardner Committed by Lyza Gardner

Update shared components in `NotebookView`

Convert an `<a>` element to use the `Link` component, and make it
underlined.
parent 6ad2f0d0
import { IconButton, Panel } from '@hypothesis/frontend-shared'; import {
IconButton,
Link,
Panel,
RefreshIcon,
} from '@hypothesis/frontend-shared/lib/next';
import { useEffect, useLayoutEffect, useRef, useState } from 'preact/hooks'; import { useEffect, useLayoutEffect, useRef, useState } from 'preact/hooks';
import scrollIntoView from 'scroll-into-view'; import scrollIntoView from 'scroll-into-view';
...@@ -140,7 +145,8 @@ function NotebookView({ loadAnnotationsService, streamer }: NotebookViewProps) { ...@@ -140,7 +145,8 @@ function NotebookView({ loadAnnotationsService, streamer }: NotebookViewProps) {
<div className="flex items-center lg:justify-self-end text-md font-medium"> <div className="flex items-center lg:justify-self-end text-md font-medium">
{pendingUpdateCount > 0 && !hasAppliedFilter && ( {pendingUpdateCount > 0 && !hasAppliedFilter && (
<IconButton <IconButton
icon="refresh" data-testid="refresh-button"
icon={RefreshIcon}
onClick={() => streamer.applyPendingUpdates()} onClick={() => streamer.applyPendingUpdates()}
variant="primary" variant="primary"
title={tooltip} title={tooltip}
...@@ -157,14 +163,21 @@ function NotebookView({ loadAnnotationsService, streamer }: NotebookViewProps) { ...@@ -157,14 +163,21 @@ function NotebookView({ loadAnnotationsService, streamer }: NotebookViewProps) {
{hasTooManyAnnotationsError && ( {hasTooManyAnnotationsError && (
<div className="py-4" data-testid="notebook-messages"> <div className="py-4" data-testid="notebook-messages">
<Panel title="Too many results to show"> <Panel title="Too many results to show">
This preview of the Notebook can show{' '} <p>
<strong>up to {maxResults} results</strong> at a time (there are{' '} This preview of the Notebook can show{' '}
{resultCount} to show here).{' '} <strong>up to {maxResults} results</strong> at a time (there are{' '}
<a href="mailto:support@hypothes.is?subject=Hypothesis%20Notebook&body=Please%20notify%20me%20when%20the%20Hypothesis%20Notebook%20is%20updated%20to%20support%20more%20than%205000%20annotations"> {resultCount} to show here).
Contact us </p>
</a>{' '} <p>
if you would like to be notified when support for more annotations <Link
is available. href="mailto:support@hypothes.is?subject=Hypothesis%20Notebook&body=Please%20notify%20me%20when%20the%20Hypothesis%20Notebook%20is%20updated%20to%20support%20more%20than%205000%20annotations"
underline="always"
>
Contact us
</Link>{' '}
if you would like to be notified when support for more
annotations is available.
</p>
</Panel> </Panel>
</div> </div>
)} )}
......
...@@ -159,14 +159,14 @@ describe('NotebookView', () => { ...@@ -159,14 +159,14 @@ describe('NotebookView', () => {
fakeStore.hasAppliedFilter.returns(true); fakeStore.hasAppliedFilter.returns(true);
const wrapper = createComponent(); const wrapper = createComponent();
const button = wrapper.find('IconButton[icon="refresh"]'); const button = wrapper.find('button[data-testid="refresh-button"]');
assert.isFalse(button.exists()); assert.isFalse(button.exists());
}); });
it('shows button to synchronize annotations if no filters are applied', () => { it('shows button to synchronize annotations if no filters are applied', () => {
const wrapper = createComponent(); const wrapper = createComponent();
const button = wrapper.find('IconButton[icon="refresh"]'); const button = wrapper.find('button[data-testid="refresh-button"]');
assert.isTrue(button.exists()); assert.isTrue(button.exists());
assert.include(button.prop('title'), 'Show 3 new or updated annotations'); assert.include(button.prop('title'), 'Show 3 new or updated annotations');
}); });
...@@ -174,7 +174,7 @@ describe('NotebookView', () => { ...@@ -174,7 +174,7 @@ describe('NotebookView', () => {
it('synchronizes pending annotations', () => { it('synchronizes pending annotations', () => {
const wrapper = createComponent(); const wrapper = createComponent();
const button = wrapper.find('IconButton[icon="refresh"]'); const button = wrapper.find('button[data-testid="refresh-button"]');
assert.isTrue(button.exists()); assert.isTrue(button.exists());
button.prop('onClick')(); button.prop('onClick')();
assert.called(fakeStreamer.applyPendingUpdates); assert.called(fakeStreamer.applyPendingUpdates);
......
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