Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | 1x 1x 18x 1x 13x 13x 13x 1x 2x | import React from 'react'; import Lect from './Lect/Lect'; export const TIME_CODE_FUDGE = 0.1; export const getShouldHighlight = (lect, readTime) => ( (lect.start - TIME_CODE_FUDGE) <= readTime && readTime <= (lect.end + TIME_CODE_FUDGE) ); export const renderLect = (lect, idx, readTime, showModal) => { const shouldHighlight = getShouldHighlight(lect, readTime); const key = idx; return ( <Lect lect={ lect } shouldHighlight={ shouldHighlight } key={ key } readTime={ readTime } showModal={ showModal } /> ); }; const Paragraph = ( { paragraph: { header, lects } = {}, idx, readTime, showModal, }, ) => ( <div className='paragraph' key={ idx }> <div className='Lectorem-paragraph-header'> { !!header?.imagePath && ( <div> <img src={ header?.imagePath } alt='Logo' width='150px' /> </div> )} { header?.lects?.map( /* istanbul ignore next */ (lect, idx2) => renderLect(lect, idx2, readTime, showModal) ) } </div> <div> { lects?.map( /* istanbul ignore next */ (lect, idx2) => renderLect(lect, idx2, readTime, showModal) ) } </div> </div> ); export default Paragraph; |