import { DynamicLayoutRenderer } from "vibentec/renderer"
import { LayoutComponentDefinition, LayoutContext } from "vibentec/component-map";
import { clx } from "@medusajs/ui";

interface BannerNavProps {
  className?: string;
  left?: LayoutComponentDefinition[];
  center?: LayoutComponentDefinition[];
  right?: LayoutComponentDefinition[];
}
export default function VtNav({ nodes, context }: { nodes: LayoutComponentDefinition; context: LayoutContext }) {
  const props = nodes.config as BannerNavProps ?? {}

  return (
    <div className="relative mx-auto border-b duration-200 bg-white border-ui-border-base">
      <nav className={clx("content-container txt-xsmall-plus flex items-center justify-between w-full h-full text-small-regular", props.className)}>
        <div className="flex items-center gap-x-4 h-full">
          {props.left && <DynamicLayoutRenderer nodes={props.left} context={context} />}
        </div>
        <div className="flex items-center gap-x-4 h-full">
          {props.center && <DynamicLayoutRenderer nodes={props.center} context={context} />}
        </div>
        <div className="flex items-center gap-x-4 h-full justify-end">
          {props.right && <DynamicLayoutRenderer nodes={props.right} context={context} />}
        </div>
      </nav>
    </div>
  )
}