5.1.2 • Published 1 year ago

@lighting-beetle/lighter-styleguide v5.1.2

Weekly downloads
47
License
MIT
Repository
github
Last release
1 year ago

Styleguide

Live demo & docs

Set of components to build styleguides and design systems.

Quick start

import React from "react";
import { Styleguide } from "@lighting-beetle/lighter-styleguide";

const DesignSystemPage = ({ children }) => {
  return (
    <Styleguide
      routes={[
        {
          title: "Design system",
          href: "/",
        },
        {
          title: "Components",
          routes: [
            {
              title: "Button",
              href: "/buttons",
            },
          ],
        },
      ]}
      currentPage="Title"
      logoSrc="/logo.svg"
    >
      {children}
    </Styleguide>
  );
};

export default DesignSystemPage;

Local development

npm run dev in this package to run Next.js dev environment which also serves as documentation for this project.

Build

This will build both: components package and docs.

  • npm run build in this package
  • npm run build:styleguide in the root of this project

Principles

Headless UI components

Components are build in headless way where all logic is encapsulated in one or more React hooks. Great example of this is Downshift, React Table or React Aria.

Compound components

Addtion to the headless components pattern with compound components are able to share components logic to children and with that build entairly custom UI without need to replicate the components logic. This is important when there is need to customize styelguide UI, but not redo base components like Props or Preview because they are fairly complex. See more at React Hooks: Compound Components.

Example of compound component

import { Props, usePropsContext } from "@lighting-beetle/lighter-styleguide";

const MyPropsTable = () => {
  const { props, displayName, description } = usePropsContext();

  return <div />; // Custom UI
};

const MyProps = () => (
  <Props component={Component}>
    <MyPropsTable />
  </Props>
);
5.1.2

1 year ago

5.1.1

2 years ago

5.1.0

2 years ago

6.0.0-next.1

2 years ago

5.0.1

2 years ago

5.0.0

3 years ago

4.1.2

3 years ago

5.0.0-beta.1

3 years ago

4.1.1

4 years ago

4.1.0

4 years ago

4.0.0

4 years ago

3.3.5

4 years ago

3.3.4

4 years ago

3.3.3

4 years ago

3.3.2

4 years ago

3.3.1

4 years ago

3.3.0

4 years ago

3.2.0

4 years ago

3.1.1

4 years ago

3.1.0

4 years ago

3.0.1

5 years ago

3.0.0

5 years ago

3.0.0-beta.2

5 years ago

3.0.0-beta.1

5 years ago

2.3.2

5 years ago

2.3.1

5 years ago

2.3.0

5 years ago

2.2.0

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.4.2

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago