mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 20:27:23 +00:00
Render link with an image and a description as card
This commit is contained in:
@@ -277,6 +277,7 @@ function Article({resource}: { resource: ResourceDetails }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log(props.children)
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
if (props.children?.length === 2) {
|
if (props.children?.length === 2) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@@ -284,7 +285,7 @@ function Article({resource}: { resource: ResourceDetails }) {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const second = props.children[1] as ReactNode
|
const second = props.children[1] as ReactNode
|
||||||
|
|
||||||
if (typeof first === "object" && typeof second === "string") {
|
if (typeof first === "object" && (typeof second === "string" || typeof second === "object")) {
|
||||||
const img = first as ReactElement
|
const img = first as ReactElement
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
if (img.type === "img") {
|
if (img.type === "img") {
|
||||||
@@ -292,7 +293,7 @@ function Article({resource}: { resource: ResourceDetails }) {
|
|||||||
<figure className={"max-h-72 max-w-96"}>
|
<figure className={"max-h-72 max-w-96"}>
|
||||||
{img}
|
{img}
|
||||||
</figure>
|
</figure>
|
||||||
<div className={"card-body text-base-content"}>
|
<div className={"card-body text-base-content text-lg"}>
|
||||||
{second}
|
{second}
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
Reference in New Issue
Block a user