Socket
Socket
Sign inDemoInstall

cms-client-dane

Package Overview
Dependencies
15
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cms-client-dane

Visually edit your react components with end-to-end type safe schemas.


Version published
Weekly downloads
1
Maintainers
1
Created
Weekly downloads
 

Readme

Source

cms-client

Visually edit your react components with end-to-end type safe schemas.

Installation

pnpm add cms-client-dane

npm i cms-client-dane

yarn add cms-client-dane

Usage

Build a component

import { z } from "zod";

export default function Button({ children }: ButtonProps) {
  return <button type="button">{children}</button>;
}

export type ButtonProps = z.infer<typeof ButtonProps>;
export const ButtonProps = z.object({
  children: z.string().default("Click me!"),
});

Define your CMS

import { C, loadable } from "cms-client-dane";

export const cms = new C();

// Link your component
cms.define(
  loadable(() => import(`~/components/Button`)),
  {
    name: "Button",
    icon: `mdi:button`,
    schema: ButtonProps,
  }
);

Render a page with remix.run

import { json, LoaderArgs } from "@remix-run/node";
import Button from "~/components/Button";
import { Page } from "cms-client-dane";

export const loader = async ({ request }: LoaderArgs) => {
  const pageData = await cms.getPageData(request);
  return json({ pageData });
};

export default function Index() {
  const { pageData } = useLoaderData<typeof loader>();
  return <Page data={pageData} />;
}

Keywords

FAQs

Last updated on 24 Feb 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc