netzo / fresh-netzo

Full-stack Deno Fresh meta-framework for building business web apps like internal tools, dashboards, admin panels and automated workflows.
https://netzo.io
MIT License
52 stars 2 forks source link

[ui] expose a `ui` prop to allow passing props to child components #82

Closed miguelrk closed 7 months ago

miguelrk commented 8 months ago

Currently, the user has no way to customize the individual sub-components being used/injected by the ui module. All submodules of the ui module should expose a ui prop, which allows passing props to each individual component, for example:

export const netzo = await Netzo({
  ui: {
    nav: {
      // ...{title, image, items}
      ui: { Nav: { className: "bg-blue-500" }, NavItem: { className: "px-4 font-semibold" } },
    },
    header: {
      // ...{title, description}
      ui: { Header: { className: "bg-blue-500" }, HeaderAuth: { className: "mr-4" } },
    },
    footer: {
      // ...{innerHTMLLeft, innerHTMLRight}
      ui: { Footer: { className: "bg-blue-500" } },
    },
  },
});
miguelrk commented 7 months ago

Closing as done. Each layout component now supports a ui prop to allow tapping into the indivudual (sub-)components. This however no longer happens via the plugin, but by explicitly using layout components in an _app.tsx. For example:

import * as Layout from "netzo/components/layout/mod.ts";

export default defineApp((req, ctx) => {
  return (
    ...
    <Layout.Nav ui={ root: { className: "bg-red-500" } } />
    ...
  );
})