diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-09-18 18:48:23 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-09-18 18:48:23 +0200 |
| commit | 108d4835d0942faf2305e702d698ae88a45022a5 (patch) | |
| tree | 5d5b0cc006684a950ea32d302d49b8c0942a3413 /animism-align/frontend/app/views/viewer/transcript/components | |
| parent | 688caf7e58e529db5f2b0b1b482e9795be1a1dbc (diff) | |
pullquote paragraph type
Diffstat (limited to 'animism-align/frontend/app/views/viewer/transcript/components')
| -rw-r--r-- | animism-align/frontend/app/views/viewer/transcript/components/elementTypes.text.js | 28 | ||||
| -rw-r--r-- | animism-align/frontend/app/views/viewer/transcript/components/index.js | 3 |
2 files changed, 30 insertions, 1 deletions
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 ( + <div + className={className} + data-startts={paragraph.start_ts} + data-endts={paragraph.end_ts} + > + {paragraph.annotations.map(annotation => ( + <span + key={annotation.id} + className={ + annotation.type === 'pullquote_credit' + ? 'pullquote_credit' + : annotation.id === currentAnnotation + ? 'current' + : '' + } + onClick={e => onAnnotationClick(e, paragraph, annotation)} + dangerouslySetInnerHTML={{ __html: ' ' + annotation.text + ' ' }} + /> + ))} + </div> + ) +} + 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), |
