0.0.66 • Published 4 years ago

@makerdao/dai-ui-icons v0.0.66

Weekly downloads
167
License
Apache-2.0
Repository
github
Last release
4 years ago

Dai-UI Icons

Note: this package is for use with the Dai-UI Design System and assumes this has already been set up in your project.

Getting Started

  1. Install the icons package.

yarn add @makerdao/dai-ui-icons

  1. Import the icons in the same file where you import your theme, and merge the icons with your theme.
// app.js
import { ThemeProvider } from 'theme-ui';
import theme from './theme';
import { icons } from '@makerdao/dai-ui-icons';

const mergedTheme = { ...theme, icons };

export default (props) => (
  <ThemeProvider theme={mergedTheme}>{props.children}</ThemeProvider>
);
  1. Import the Icon component into your project. Pass the name of the desired icon as a prop to the icon component.
// index.js
import { Icon } from '@makerdao/dai-ui-icons';

<Icon name="dai_round_color" />;
  1. Icons can also accept color and size props pulled from your theme, as well as theme-ui sx properties.
<Icon name="maker" color="primary" size={3} sx={{ bg: 'secondary' }} />

Setting Up a Local Dev Environment

While developing a new icons package, you can link it to your frontend project using yalc and monitor for changes with sane.

  1. In the icons package directory, first build the package.

yarn build

  1. Publish the packaging to the yalc registry.

yalc publish

  1. Use sane to monitor the files for changes.

sane "yalc publish --push" . --wait=10

  1. Navigate to your frontend project and add the package with yalc.

yalc add "@makerdao/dai-ui-icons"

You should now see updates to your icons package take effect immediately in your frontend project.

To remove the linked package run yalc remove "@makerdao/dai-ui-icons" and reinstall the package from npm.

Creating an Icons Package

  1. Your package must export an icons object where each icon is keyed by its name, with path and viewBox keys nested inside.

  2. The path must return a valid svg <path> element as JSX, since it will be wrapped in an <svg> element by the Icon component.

  3. Change the fill attribute to "currentColor" so you can set the color with the color prop on the Icon component.

// example icons package
export const icons {
  my_icon: {
    path: (<path fill="currentColor" />),
    viewBox: "0 0 24 24",
  },
};
0.0.66

4 years ago

0.0.62

4 years ago

0.0.61

4 years ago

0.0.60

4 years ago

0.0.59

4 years ago

0.0.58

4 years ago

0.0.57

4 years ago

0.0.56

4 years ago

0.0.55

4 years ago

0.0.54

4 years ago

0.0.53

4 years ago

0.0.51

4 years ago

0.0.52

4 years ago

0.0.50

4 years ago

0.0.49

4 years ago

0.0.47

4 years ago

0.0.44

4 years ago

0.0.46

4 years ago

0.0.41

4 years ago

0.0.40

4 years ago

0.0.39

4 years ago

0.0.38

4 years ago

0.0.37

4 years ago

0.0.36

4 years ago

0.0.33

4 years ago

0.0.34

4 years ago

0.0.35

4 years ago

0.0.32

4 years ago

0.0.29

4 years ago

0.0.28

4 years ago

0.0.27

4 years ago

0.0.26

4 years ago

0.0.25

4 years ago

0.0.23

4 years ago

0.0.24

4 years ago

0.0.22

4 years ago

0.0.21

4 years ago

0.0.12

4 years ago

0.0.13

4 years ago

0.0.14

4 years ago

0.0.15

4 years ago

0.0.16

4 years ago

0.0.17

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago