This commit is contained in:
Rizky 2023-12-12 00:29:17 +07:00
parent 8579cdcc6e
commit 5cf979c882
2 changed files with 9 additions and 11 deletions

View File

@ -19,7 +19,13 @@ export const viParts = (meta: IMeta, arg?: ViParts) => {
const props: React.DetailedHTMLProps<
React.HTMLAttributes<HTMLDivElement>,
HTMLDivElement
> = {};
> = {
className: produceCSS(item, {
mode: arg?.mode || "desktop",
hover: arg?.hover,
active: arg?.active,
}),
};
let shouldRenderChild = true;
if (content.type === "text") {
@ -28,11 +34,6 @@ export const viParts = (meta: IMeta, arg?: ViParts) => {
}
return {
className: produceCSS(item, {
mode: arg?.mode || "desktop",
hover: arg?.hover,
active: arg?.active,
}),
shouldRenderChild,
props,
};

View File

@ -28,6 +28,7 @@ export const ViRender: FC<{
: meta.item.childs?.map((item) => {
if (!item) return null;
const { id } = item;
return (
<ErrorBox key={id}>
<ViRender ctx={ctx} meta={ctx.meta[id]} />
@ -36,9 +37,5 @@ export const ViRender: FC<{
});
}
return (
<div {...parts.props} className={parts.className}>
{renderChild}
</div>
);
return <div {...parts.props}>{renderChild}</div>;
};