Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/components/Viewer/Viewer/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,21 @@ import { ViewerContextStore, useViewerState } from "src/context/viewer-context";
import Collection from "src/components/Viewer/Collection/Collection";
import CopyText from "src/components/Viewer/CopyText";
import IIIFBadge from "src/components/Viewer/Viewer/IIIFBadge";
import { InternationalString } from "@iiif/presentation-3";
import { InternationalString, ManifestNormalized } from "@iiif/presentation-3";
import { Label } from "src/components/Primitives";
import { Popover } from "src/components/UI";
import React from "react";
import Toggle from "./Toggle";
import ViewerDownload from "./Download";
import { useTranslation } from "react-i18next";

interface Props {
manifestId: string;
manifestLabel: InternationalString;
}

const ViewerHeader: React.FC<Props> = ({ manifestId, manifestLabel }) => {
const ViewerHeader: React.FC = () => {
const viewerState: ViewerContextStore = useViewerState();
const { collection, configOptions } = viewerState;
const { collection, configOptions, activeManifest, vault } = viewerState;

const manifest: ManifestNormalized = vault.get(activeManifest),
manifestLabel = (manifest.label ?? "") as InternationalString,
manifestId = manifest.id;

const { informationPanel, showDownload, showIIIFBadge, showTitle } =
configOptions;
Expand Down
10 changes: 4 additions & 6 deletions src/components/Viewer/Viewer/Viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import * as Collapsible from "@radix-ui/react-collapsible";
import { AnnotationResource, AnnotationResources } from "src/types/annotations";
import {
ExternalResourceTypes,
InternationalString,
ManifestNormalized,
} from "@iiif/presentation-3";
import React, { useCallback, useEffect, useState } from "react";
Expand Down Expand Up @@ -35,7 +34,7 @@ interface ViewerProps {
iiifContentSearchQuery?: ContentSearchQuery;
}

const Viewer: React.FC<ViewerProps> = ({
const Viewer: React.FC<ViewerProps> & { Header: React.FC } = ({
manifest,
theme,
iiifContentSearchQuery,
Expand Down Expand Up @@ -175,10 +174,7 @@ const Viewer: React.FC<ViewerProps> = ({
open={isInformationOpen}
onOpenChange={setInformationOpen}
>
<ViewerHeader
manifestLabel={manifest.label as InternationalString}
manifestId={manifest.id}
/>
<ViewerHeader />
<ViewerContent
activeCanvas={activeCanvas}
painting={painting}
Expand All @@ -195,4 +191,6 @@ const Viewer: React.FC<ViewerProps> = ({
);
};

Viewer.Header = ViewerHeader;

export default Viewer;