Git Product home page Git Product logo

dai-ui's Introduction

Dai-UI Styleguide

Getting Started

  1. Install theme-ui

yarn add theme-ui

  1. Install our default theme

yarn add @makerdao/dai-ui-theme-maker

  1. Or create your own
// theme.js
export default {
  sizes: [0, 4, 8, 16, 32],
  colors: {
    primary: "#1AAB9B",
    secondary: "#F4B731",
  },
  // ...add your design tokens here
};
  1. Import the theme provider from theme-ui and wrap your app, passing the theme object as prop to the provider.
// app.js
import React from "react";
import { ThemeProvider } from "theme-ui";
import theme from "./theme";

export default (props) => (
  <ThemeProvider theme={theme}>{props.children}</ThemeProvider>
);
  1. Use the component primitives provided by theme-ui to build your frontend.
// Form.js
<Card>
  <Box>
    <Label>Ethereum Address</Label>
    <Input defaultValue="Default Text"></Input>
    <Button>Submit</Button>
  </Box>
</Card>
  1. See our recipes page for more examples and inspiration!

How to Contribute a Recipe

  1. Open the Dai UI sandbox and create your recipe using the component library.

  2. Create a new file in the recipes folder of our github repo and copy in the template below.

  3. Copy your recipe from the sandbox editor into the template below. Don't forget to include the query string from the URL.

// MyRecipe.js
const title = "My Recipe";
const description = "Add a detailed description.";
const playroomHash = "#?code="; // Add the entire query string from the URL.

// Be sure to wrap your recipe in backticks like the example.
const component = `
<MyComponent />
`;

export default {
  component,
  title,
  description,
  playroomHash,
};

Publishing a package

In the root directory run:

yarn lerna publish

This will bump the package versions and publish all packages together.

dai-ui's People

Contributors

b-pmcg avatar adrianleb avatar pacxiu avatar dependabot[bot] avatar peculiarity avatar fenris85 avatar padraic-o-mhuiris avatar

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.