Skip to content

Commit

Permalink
Merge pull request #10938 from wellcomecollection/render-exhibition-t…
Browse files Browse the repository at this point in the history
…ext-field

Render exhibition text field
  • Loading branch information
gestchild authored Jun 14, 2024
2 parents 829ae94 + 9b5b83a commit 57bfd59
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
1 change: 1 addition & 0 deletions common/views/slices/GuideTextItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const GuideTextItem: FunctionComponent<GuideTextItemProps> = ({
title={transformedSlice.title}
tombstone={transformedSlice.tombstone}
caption={transformedSlice.caption}
additionalNotes={transformedSlice.additional_notes}
/>
);
};
Expand Down
20 changes: 12 additions & 8 deletions content/webapp/components/GuideTextItem/GuideTextItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Container } from '@weco/common/views/components/styled/Container';
import {
TombstoneTitle,
Tombstone,
CaptionTranscription as CaptionWrapper,
CaptionTranscription as Wrapper,
Caption,
} from '@weco/content/components/ExhibitionCaptions/ExhibitionCaptions.Stop';

Expand All @@ -16,7 +16,8 @@ const GuideTextItem: FunctionComponent<{
title: string;
tombstone?: prismic.RichTextField;
caption?: prismic.RichTextField;
}> = ({ number, title, tombstone, caption }) => {
additionalNotes?: prismic.RichTextField;
}> = ({ number, title, tombstone, caption, additionalNotes }) => {
return (
<Space
id={number ? `stop-${number}` : undefined}
Expand All @@ -33,12 +34,15 @@ const GuideTextItem: FunctionComponent<{
)}
</Tombstone>

{caption && (
<CaptionWrapper>
<Caption>
<PrismicHtmlBlock html={caption} />
</Caption>
</CaptionWrapper>
{(caption || additionalNotes) && (
<Wrapper>
{additionalNotes && <PrismicHtmlBlock html={additionalNotes} />}
{caption && (
<Caption>
<PrismicHtmlBlock html={caption} />
</Caption>
)}
</Wrapper>
)}
</Container>
</Space>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ type GuideTextItem = {
title: string;
caption: prismic.RichTextField | undefined;
tombstone: prismic.RichTextField | undefined;
additional_notes: prismic.RichTextField | undefined;
};

export function transformGuideTextItemSlice(
Expand All @@ -102,6 +103,9 @@ export function transformGuideTextItemSlice(
caption: slice.primary.caption
? asRichText(slice.primary.caption)
: undefined,
additional_notes: slice.primary.additional_notes
? asRichText(slice.primary.additional_notes)
: undefined,
};
}

Expand Down

0 comments on commit 57bfd59

Please sign in to comment.