CardDetailProvider wraps the content part of the GalleryCard. (#1556)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
parent
5204e2d080
commit
b5a194b62c
1 changed files with 22 additions and 19 deletions
|
@ -28,6 +28,7 @@ import {getCardContents} from '../../store/contents'
|
||||||
import {getCardComments} from '../../store/comments'
|
import {getCardComments} from '../../store/comments'
|
||||||
|
|
||||||
import './galleryCard.scss'
|
import './galleryCard.scss'
|
||||||
|
import {CardDetailProvider} from '../cardDetail/cardDetailContext'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
board: Board
|
board: Board
|
||||||
|
@ -120,29 +121,31 @@ const GalleryCard = React.memo((props: Props) => {
|
||||||
<ImageElement block={image}/>
|
<ImageElement block={image}/>
|
||||||
</div>}
|
</div>}
|
||||||
{!image &&
|
{!image &&
|
||||||
<div className='gallery-item'>
|
<CardDetailProvider card={card}>
|
||||||
{contents.map((block) => {
|
<div className='gallery-item'>
|
||||||
if (Array.isArray(block)) {
|
{contents.map((block) => {
|
||||||
return block.map((b) => (
|
if (Array.isArray(block)) {
|
||||||
|
return block.map((b) => (
|
||||||
|
<ContentElement
|
||||||
|
key={b.id}
|
||||||
|
block={b}
|
||||||
|
readonly={true}
|
||||||
|
cords={{x: 0}}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
<ContentElement
|
<ContentElement
|
||||||
key={b.id}
|
key={block.id}
|
||||||
block={b}
|
block={block}
|
||||||
readonly={true}
|
readonly={true}
|
||||||
cords={{x: 0}}
|
cords={{x: 0}}
|
||||||
/>
|
/>
|
||||||
))
|
)
|
||||||
}
|
})}
|
||||||
|
</div>
|
||||||
return (
|
</CardDetailProvider>}
|
||||||
<ContentElement
|
|
||||||
key={block.id}
|
|
||||||
block={block}
|
|
||||||
readonly={true}
|
|
||||||
cords={{x: 0}}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
})}
|
|
||||||
</div>}
|
|
||||||
{props.visibleTitle &&
|
{props.visibleTitle &&
|
||||||
<div className='gallery-title'>
|
<div className='gallery-title'>
|
||||||
{ card.fields.icon ? <div className='octo-icon'>{card.fields.icon}</div> : undefined }
|
{ card.fields.icon ? <div className='octo-icon'>{card.fields.icon}</div> : undefined }
|
||||||
|
|
Loading…
Reference in a new issue