CardDetailProvider wraps the content part of the GalleryCard. (#1556)

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
kamre 2021-10-16 04:34:30 +07:00 committed by GitHub
parent 5204e2d080
commit b5a194b62c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,6 +28,7 @@ import {getCardContents} from '../../store/contents'
import {getCardComments} from '../../store/comments'
import './galleryCard.scss'
import {CardDetailProvider} from '../cardDetail/cardDetailContext'
type Props = {
board: Board
@ -120,29 +121,31 @@ const GalleryCard = React.memo((props: Props) => {
<ImageElement block={image}/>
</div>}
{!image &&
<div className='gallery-item'>
{contents.map((block) => {
if (Array.isArray(block)) {
return block.map((b) => (
<CardDetailProvider card={card}>
<div className='gallery-item'>
{contents.map((block) => {
if (Array.isArray(block)) {
return block.map((b) => (
<ContentElement
key={b.id}
block={b}
readonly={true}
cords={{x: 0}}
/>
))
}
return (
<ContentElement
key={b.id}
block={b}
key={block.id}
block={block}
readonly={true}
cords={{x: 0}}
/>
))
}
return (
<ContentElement
key={block.id}
block={block}
readonly={true}
cords={{x: 0}}
/>
)
})}
</div>}
)
})}
</div>
</CardDetailProvider>}
{props.visibleTitle &&
<div className='gallery-title'>
{ card.fields.icon ? <div className='octo-icon'>{card.fields.icon}</div> : undefined }