From 108d4835d0942faf2305e702d698ae88a45022a5 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 18 Sep 2020 18:48:23 +0200 Subject: pullquote paragraph type --- .../transcript/components/elementTypes.text.js | 28 ++++++++++++++++++++++ .../views/viewer/transcript/components/index.js | 3 ++- 2 files changed, 30 insertions(+), 1 deletion(-) (limited to 'animism-align/frontend/app/views/viewer/transcript/components') diff --git a/animism-align/frontend/app/views/viewer/transcript/components/elementTypes.text.js b/animism-align/frontend/app/views/viewer/transcript/components/elementTypes.text.js index 5ea12da..49cbdd3 100644 --- a/animism-align/frontend/app/views/viewer/transcript/components/elementTypes.text.js +++ b/animism-align/frontend/app/views/viewer/transcript/components/elementTypes.text.js @@ -24,6 +24,34 @@ export const Paragraph = ({ paragraph, currentParagraph, currentAnnotation, onAn ) } +export const Pullquote = ({ paragraph, currentParagraph, currentAnnotation, onAnnotationClick }) => { + let className = paragraph.type + if (className !== 'paragraph') className += ' paragraph' + if (currentParagraph) className += ' current' + return ( +
+ {paragraph.annotations.map(annotation => ( + onAnnotationClick(e, paragraph, annotation)} + dangerouslySetInnerHTML={{ __html: ' ' + annotation.text + ' ' }} + /> + ))} +
+ ) +} + export const ParagraphHeading = ({ paragraph, currentParagraph, currentAnnotation, onAnnotationClick }) => { let className = currentParagraph ? 'section_heading current' : 'section_heading' const text = paragraph.annotations.map(annotation => annotation.text).join(' ') diff --git a/animism-align/frontend/app/views/viewer/transcript/components/index.js b/animism-align/frontend/app/views/viewer/transcript/components/index.js index e71a98f..35084e7 100644 --- a/animism-align/frontend/app/views/viewer/transcript/components/index.js +++ b/animism-align/frontend/app/views/viewer/transcript/components/index.js @@ -1,7 +1,7 @@ import React from 'react' import { - Paragraph, ParagraphHeading, HiddenParagraph + Paragraph, ParagraphHeading, HiddenParagraph, Pullquote } from './elementTypes.text' import { @@ -21,6 +21,7 @@ export const transcriptElementLookup = { intro_paragraph: React.memo(Paragraph), big_text: React.memo(Paragraph), blockquote: React.memo(Paragraph), + pullquote: React.memo(Pullquote), hidden: React.memo(Paragraph), heading_text: React.memo(HiddenParagraph), -- cgit v1.2.3-70-g09d2