Commit afd73d91 authored by Lyza Danger Gardner's avatar Lyza Danger Gardner Committed by Lyza Gardner

Use shared `Panel` component

parent 47ecae4c
import Panel from './Panel';
import { Panel } from '@hypothesis/frontend-shared';
/**
* @typedef LaunchErrorPanelProps
......@@ -16,9 +16,7 @@ import Panel from './Panel';
export default function LaunchErrorPanel({ error }) {
return (
<div className="LaunchErrorPanel">
<Panel title="Unable to start Hypothesis">
<p>{error.message}</p>
</Panel>
<Panel title="Unable to start Hypothesis">{error.message}</Panel>
</div>
);
}
import { IconButton } from '@hypothesis/frontend-shared';
import { IconButton, Panel } from '@hypothesis/frontend-shared';
import { useEffect, useLayoutEffect, useRef, useState } from 'preact/hooks';
import scrollIntoView from 'scroll-into-view';
......@@ -8,7 +8,6 @@ import { useStoreProxy } from '../store/use-store';
import NotebookFilters from './NotebookFilters';
import NotebookResultCount from './NotebookResultCount';
import Panel from './Panel';
import PaginatedThreadList from './PaginatedThreadList';
import useRootThread from './hooks/use-root-thread';
......
import { LabeledButton } from '@hypothesis/frontend-shared';
import { LabeledButton, Panel } from '@hypothesis/frontend-shared';
import { useStoreProxy } from '../store/use-store';
import Panel from './Panel';
/**
* @typedef SidebarContentErrorProps
* @prop {'annotation'|'group'} errorType
......@@ -42,23 +40,25 @@ export default function SidebarContentError({
})();
return (
<Panel icon="restricted" title={errorTitle}>
<p>{errorMessage}</p>
<div className="u-layout-row--justify-right u-horizontal-rhythm">
{showClearSelection && (
<LabeledButton
variant={isLoggedIn ? 'primary' : undefined}
onClick={() => store.clearSelection()}
>
Show all annotations
</LabeledButton>
)}
{!isLoggedIn && (
<LabeledButton variant="primary" onClick={onLoginRequest}>
Log in
</LabeledButton>
)}
</div>
</Panel>
<div className="u-sidebar-container">
<Panel icon="restricted" title={errorTitle}>
<p>{errorMessage}</p>
<div className="u-layout-row--justify-right u-horizontal-rhythm">
{showClearSelection && (
<LabeledButton
variant={isLoggedIn ? 'primary' : undefined}
onClick={() => store.clearSelection()}
>
Show all annotations
</LabeledButton>
)}
{!isLoggedIn && (
<LabeledButton variant="primary" onClick={onLoginRequest}>
Log in
</LabeledButton>
)}
</div>
</Panel>
</div>
);
}
import { Panel } from '@hypothesis/frontend-shared';
import { useCallback, useEffect, useRef } from 'preact/hooks';
import scrollIntoView from 'scroll-into-view';
import { useStoreProxy } from '../store/use-store';
import Panel from './Panel';
import Slider from './Slider';
/**
......@@ -60,7 +60,7 @@ export default function SidebarPanel({
return (
<Slider visible={panelIsActive}>
<div ref={panelElement}>
<div ref={panelElement} className="u-sidebar-container">
<Panel title={title} icon={icon} onClose={closePanel}>
{children}
</Panel>
......
.LaunchErrorPanel {
// Top margin ensures that the error notice appears below the Notebook's
// "Close" button.
margin-top: 50px;
margin-left: 5px;
margin-right: 5px;
margin: 0.5rem;
margin-top: 3rem;
}
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