GithubHelp home page GithubHelp logo

saleor / macaw-ui Goto Github PK

View Code? Open in Web Editor NEW
95.0 24.0 32.0 12.34 MB

MacawUI: an official UI design kit for Saleor

Home Page: https://macaw-ui.vercel.app

TypeScript 96.63% JavaScript 0.84% Shell 0.06% HTML 0.11% CSS 0.01% MDX 2.35%
react-components react typescript hacktoberfest

macaw-ui's Introduction

MacawUI logo

npm package npm download Bundle Size

MacawUI

Official React UI components kit for Saleor โ€” an open-source GraphQL-first and Next.js ready e-commerce platform. You can find most of the elements used in the creation of Saleor's dashboard interface and use it to create Saleor Apps. Have a great time working on your projects and empowering your users. If you have any questions, feel free to let us know on GitHub Discussions.

Installation

npm i @saleor/macaw-ui

Usage

You need to import the styles into your app. You can do it in your main entry point, for example index.tsx`:

import "@saleor/macaw-ui/style";

Next, you need to add the ThemeProvider to your app. It will provide the theme to the components:

import { ThemeProvider } from "@saleor/macaw-ui";

const App = () => (
  <ThemeProvider>
    <App />
  </ThemeProvider>
);

Usage with Next.js

If you need to render styles on the server we recommend that you use getCSSVariables helper to get the CSS variables that can be injected in _document.tsx:

import { getCSSVariables } from "@saleor/macaw-ui";
import Document, { Head, Html, Main, NextScript } from "next/document";

const css = getCSSVariables("defaultLight"); // or "defaultDark"

export default class AppDocument extends Document {
  render() {
    return (
      <Html style={css}>
        <Head />
        <body>
          <Main />
          <NextScript />
        </body>
      </Html>
    );
  }
}

Usage with form libraries

React Hook Form

You need to wrap the MacawUI component with Controller. For example:

import { Input } from "@saleor/macaw-ui";

<Controller
  control={control}
  name="name-input"
  render={({ field }) => <Input {...field} />}
/>;

Usage with Sentry

Add following configuration to Sentry.Integrations.Breadcrumbs:

{
  dom: {
    serializeAttribute: ["macaw-ui-component"];
  }
}

Right now sentry will display MacawUI components names in breadcrumbs.

Development

To begin, you need to install dependencies:

pnpm install

Then, you can run the Storybook:

pnpm dev

You can run build in watch mode (useful for real-time development with e.g Dashboard):

pnpm watch

When you finish woking, you can add new changeset

pnpm change:add

License

Distributed under the Creative Common Attribution 4.0 International License https://creativecommons.org/licenses/by/4.0/

Thanks

Chromatic

Thanks to Chromatic for providing the visual testing platform that helps us review UI changes and catch visual regressions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.