mirror of
https://github.com/acid-info/logos-press-engine.git
synced 2025-02-23 06:38:27 +00:00
feat: add support for quote blocks
This commit is contained in:
parent
cab92f4583
commit
decf053005
@ -7,7 +7,7 @@ import {
|
||||
extractInnerHtml,
|
||||
} from '@/utils/html.utils'
|
||||
import { HeadingElementsRef } from '@/utils/ui.utils'
|
||||
import { Typography } from '@acid-info/lsd-react'
|
||||
import { Quote, Typography } from '@acid-info/lsd-react'
|
||||
import { css } from '@emotion/react'
|
||||
import styled from '@emotion/styled'
|
||||
import clsx from 'clsx'
|
||||
@ -45,9 +45,8 @@ export const RenderArticleBlock = ({
|
||||
}
|
||||
case 'p': {
|
||||
const isIframe = block.embed && block.labels.includes('embed')
|
||||
|
||||
return block.embed && isIframe ? (
|
||||
block.labels.includes('youtube_embed') ? (
|
||||
if (block.embed && isIframe) {
|
||||
return block.labels.includes('youtube_embed') ? (
|
||||
<IframeContainer isSimplecast={false}>
|
||||
<ReactPlayer url={block.embed.src} />
|
||||
</IframeContainer>
|
||||
@ -59,7 +58,29 @@ export const RenderArticleBlock = ({
|
||||
}}
|
||||
/>
|
||||
)
|
||||
) : (
|
||||
}
|
||||
|
||||
if (
|
||||
block.classNames.includes('subtitle') &&
|
||||
block.classNames.includes('u-with-margin-left')
|
||||
) {
|
||||
return (
|
||||
<Quote
|
||||
mode="indented-line"
|
||||
genericFontFamily="serif"
|
||||
id={extractIdFromFirstTag(block.html) || `p-${block.order}`}
|
||||
>
|
||||
<Paragraph
|
||||
variant="body1"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: extractInnerHtml(block.html),
|
||||
}}
|
||||
/>
|
||||
</Quote>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<Paragraph
|
||||
variant="body1"
|
||||
component={block.tagName as any}
|
||||
|
@ -17,7 +17,9 @@ const ArticleBlocks = ({ data }: Props) => {
|
||||
data.content.filter(
|
||||
(b) =>
|
||||
b.labels.length === 0 ||
|
||||
b.labels.includes(LPE.Post.ContentBlockLabels.Embed),
|
||||
b.labels.includes(LPE.Post.ContentBlockLabels.Embed) ||
|
||||
(b.labels.includes(LPE.Post.ContentBlockLabels.Subtitle) &&
|
||||
b.order > 5),
|
||||
),
|
||||
[data.content],
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user