refactor: add interface each component to define props config in JSON file

This commit is contained in:
Nam Doan
2025-11-26 11:22:08 +07:00
parent 3e5a88f42d
commit 60700ee11e
7 changed files with 100 additions and 26 deletions
@@ -1,11 +1,17 @@
import { DynamicLayoutRenderer } from "vibentec/renderer"
import { LayoutComponentDefinition, LayoutContext } from "vibentec/component-map";
interface BannerNavProps {
className?: string;
left?: LayoutComponentDefinition[];
center?: LayoutComponentDefinition[];
right?: LayoutComponentDefinition[];
}
export default function VtNav({ nodes, context }: { nodes: LayoutComponentDefinition; context: LayoutContext }) {
const props = nodes.config ?? {}
const props = nodes.config as BannerNavProps ?? {}
return (
<div className="relative h-16 mx-auto border-b duration-200 bg-white border-ui-border-base">
<div className="relative mx-auto border-b duration-200 bg-white border-ui-border-base">
<nav className="content-container txt-xsmall-plus text-ui-fg-subtle flex items-center justify-between w-full h-full text-small-regular">
<div className="flex items-center gap-x-4">
{props.left && <DynamicLayoutRenderer nodes={props.left} context={context} />}