npm

@kjam/next-ui
TypeScript icon, indicating that this package has built-in type declarations

1.6.11 • Public • Published

@kjam/next-ui

React components within the kjam tooling for git (github) based headless CMS + next.js projects.

Usage

In one of your pages, e.g. pages/[slug].ts

import { kjam, KjamProps } from "@kjam/next";
import { PageDebug } from "@kjam/next-ui";
import { serialize } from "next-mdx-remote/serialize";
// import { mdComponents } from "../md-components";

type Data = {
  title: string;
};

type Params = {
  slug: string[];
};

type Props = KjamProps<Data, Params> & {};

export default function PagesPage({
  mdx,
  entry,
}: PageStatic<typeof getStaticProps>) {
  return (
    <PageDebug
      tpl="[slug]"
      entry={entry}
      mdx={mdx}
      // mdComponents={mdComponents}
    />
  );
}

export const getStaticPaths: DataStaticPaths<Params> = async (ctx) => {
  return await kjam.getStaticPaths<Params>(ctx, "blocking", "pages");
};

export const getStaticProps: DataStatic<Props, Params> = async (ctx) => {
  return await kjam.getStaticProps<Params, Data>(ctx, serialize, "");
};

This repo is automatically deployed by @kjam monorepo. Issues and development happen there.

Readme

Keywords

none

Package Sidebar

Install

npm i @kjam/next-ui

Weekly Downloads

2

Version

1.6.11

License

none

Unpacked Size

65 kB

Total Files

6

Last publish

Collaborators

  • knitkoder
  • kuus