Skip to content

Commit

Permalink
Address seeAlso label rendering issue. (#94)
Browse files Browse the repository at this point in the history
* Address seeAlso label rendering issue.

* Fix manifest id render, make homepage render label.
  • Loading branch information
mathewjordan authored Sep 23, 2022
1 parent 320fa3d commit 564183a
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/components/Navigator/About.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ const About: React.FC<Props> = () => {

const [manifest, setManifest] = useState<ManifestNormalized>();

const [homepage, setHomepage] = useState<IIIFExternalWebResource[] | []>([]);
const [seeAlso, setSeeAlso] = useState<IIIFExternalWebResource[] | []>([]);
const [thumbnail, setThumbnail] = useState<IIIFExternalWebResource[] | []>(
[],
);
Expand All @@ -33,6 +35,8 @@ const About: React.FC<Props> = () => {
const data = vault.get(activeManifest);
setManifest(data);

if (data.homepage?.length > 0) setHomepage(vault.get(data.homepage));
if (data.seeAlso?.length > 0) setSeeAlso(vault.get(data.seeAlso));
if (data.thumbnail?.length > 0) setThumbnail(vault.get(data.thumbnail));
}, [activeManifest, vault]);

Expand Down Expand Up @@ -76,7 +80,7 @@ const About: React.FC<Props> = () => {
</>
)}

{manifest.homepage?.length > 0 && (
{homepage?.length > 0 && (
<>
<label
className="manifest-property-title"
Expand All @@ -85,17 +89,13 @@ const About: React.FC<Props> = () => {
Homepage
</label>
<Homepage
homepage={
manifest.homepage as unknown as NectarExternalWebResource[]
}
homepage={homepage as unknown as NectarExternalWebResource[]}
id="iiif-manifest-homepage"
>
View <Label label={manifest.label as InternationalString} />
</Homepage>
/>
</>
)}

{manifest.seeAlso?.length > 0 && (
{seeAlso?.length > 0 && (
<>
<label
className="manifest-property-title"
Expand All @@ -104,16 +104,13 @@ const About: React.FC<Props> = () => {
See Also
</label>
<SeeAlso
seeAlso={
manifest.seeAlso as unknown as NectarExternalWebResource[]
}
seeAlso={seeAlso as unknown as NectarExternalWebResource[]}
id="iiif-manifest-see-also"
as="ul"
/>
</>
)}

{manifest.seeAlso?.length > 0 && (
{manifest.id && (
<>
<label
className="manifest-property-title"
Expand Down

0 comments on commit 564183a

Please sign in to comment.