2.2.0 • Published 2 years ago

@virtualcapital/utogi-ui-library v2.2.0

Weekly downloads
306
License
MIT
Repository
-
Last release
2 years ago

Utogi UI Library

To Install

npm install @virtualcapital/utogi-ui-library or yarn add @virtualcapital/utogi-ui-library

To Use

Currently there are two ways to use this library depending of your needs and configuration:

  • Basic: You import from the main module the components and include the css yourself (No treeshaking by default, no variables override)
  • Advanced: You import from the lib folder the components you need, this is the more versatile way but need some extra configuration (See Advanced Setup section)

Basic

This configuration will allow you to start fast but with one drawback, by default will include all components (no treeshaking) and will use the default variables.

import React from "react";
import { Button } from "@virtualcapital/utogi-ui-library";

export default () => <Button color="primary">My Button</Button>;

Advanced

This configuration is recommended if you answer yes to one of the following questions:

  • I'm worried about the final size of my bundle?
  • I need to override the default variables?

In your main scss/sass file you will need to include the generic css classes use, please ensure you do this on your main scss file (App.scss fox example) and do not add this inside the _variables file (see below)

You can start using the library like this

import React from "react";
import Button from "@virtualcapital/utogi-ui-library/dist/components/button";

export default () => <Button color="primary">My Button</Button>;

Before you use this configuration you need to setup a _variables.sass file somewhere in your project (I recommend inside your src folder). This file will allow you to override variables if need it like:

$primary: #c3c3c3

Note Use this file only for variables, do not include any css rule in it because that rule will be duplicated every time you include a component from this library.

Depending of your project configuration you will need to setup your framework to use this file:

Raw Webpack

Configure your webpack to handle sass files.

Inside the resolve directive setup your webpack to use modules from the folder where you put the _variables.sass file

{
  // ...
  resolve: {
    modules: ['node_modules', 'src'],
    // ...
  }
}

CRA

Install node-sass to enable the sass compiles on your project.

After that update your scripts in the package.json to add the folder to your path

"scripts": {
  "start": "NODE_PATH=./src react-scripts start",
  "build": "NODE_PATH=./src react-scripts build",
  "test": "NODE_PATH=./src react-scripts test",
  ...
}

where ./src is the folder where you put your _variables.sass

Gatsby

Follow the instructions to enable Sass compiling in project, and configure the sass plugin to include the path where you put the _variables.sass file, for example:

plugins: [
    {
      resolve: `gatsby-plugin-sass`,
      options: {
        includePaths: ["./src"],
      },
    }
    ...
]

Next.js

Follow the instructions to enable sass in the project. You will also need to configure the transpiled modules plugin next-plugin-transpile-modules so install it npm i --save-dev next-plugin-transpile-modules.

Now on your next.config.js configure your sass to include the directory where you put your _variables.sass file and add @virtualcapital/utogi-ui-library to the transpiled modules

const withSass = require("@zeit/next-sass");
const withTM = require("next-plugin-transpile-modules");

module.exports = withTM(
  withSass({
    transpileModules: ["@virtualcapital/utogi-ui-library"],
    sassLoaderOptions: {
      includePaths: ["./src"]
    }
  })
);
2.2.0

2 years ago

0.84.0

3 years ago

0.83.0

3 years ago

0.78.0

3 years ago

2.1.9

3 years ago

0.79.0

3 years ago

2.1.8

3 years ago

0.76.0

3 years ago

0.75.0

3 years ago

0.0.3059

3 years ago

0.0.3058

3 years ago

0.0.3008

3 years ago

0.0.2462

3 years ago

0.0.2463

3 years ago

0.0.2464

3 years ago

0.0.2465

3 years ago

0.0.2901

3 years ago

0.0.2899

3 years ago

0.0.2649

3 years ago

0.0.2650

3 years ago

0.0.2651

3 years ago

0.0.2652

3 years ago

0.0.2654

3 years ago

0.0.2881

3 years ago

0.0.2882

3 years ago

0.0.2900

3 years ago

0.0.2648

3 years ago

0.0.2842

3 years ago

0.0.2800

3 years ago

0.0.2642

3 years ago

0.73.0

3 years ago

2.1.4

3 years ago

2.1.3

3 years ago

2.1.2

3 years ago

0.72.1

3 years ago

2.1.1

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

0.0.2289

3 years ago

0.72.0

3 years ago

1.2.0

4 years ago

0.0.1924

3 years ago

0.62.0

4 years ago

0.43.0

4 years ago

0.20.0

4 years ago

0.59.0

4 years ago

0.36.0

4 years ago

0.55.0

4 years ago

0.13.0

4 years ago

0.17.0

4 years ago

0.0.1912

3 years ago

0.32.0

4 years ago

0.51.0

4 years ago

0.70.0

3 years ago

0.29.0

4 years ago

0.48.0

4 years ago

0.3.0

4 years ago

0.67.0

3 years ago

0.25.0

4 years ago

0.44.0

4 years ago

0.7.0

4 years ago

1.1.0

4 years ago

0.63.0

4 years ago

0.21.0

4 years ago

0.40.0

4 years ago

0.0.61

4 years ago

0.37.0

4 years ago

0.56.0

4 years ago

0.33.0

4 years ago

0.0.2284

3 years ago

0.0.2285

3 years ago

0.0.0-beta-2082

4 years ago

0.0.2287

3 years ago

0.14.0

4 years ago

0.0.0-beta-2081

4 years ago

0.18.0

4 years ago

0.0.1978

3 years ago

0.10.0

4 years ago

0.52.0

4 years ago

0.71.0

3 years ago

0.49.0

4 years ago

0.26.0

4 years ago

0.68.0

3 years ago

0.45.0

4 years ago

0.22.0

4 years ago

0.8.0

4 years ago

0.4.0

4 years ago

0.0.1982

3 years ago

1.0.0

4 years ago

1.2.0-beta-2040

4 years ago

0.64.0

3 years ago

0.41.0

4 years ago

0.60.0

4 years ago

0.19.0

4 years ago

0.38.0

4 years ago

0.57.0

4 years ago

0.34.0

4 years ago

0.11.0

4 years ago

0.15.0

4 years ago

0.0.2301

3 years ago

0.53.0

4 years ago

0.30.0

4 years ago

1.2.0-beta-2039

4 years ago

0.1.0

4 years ago

0.27.0

4 years ago

0.46.0

4 years ago

0.69.0

3 years ago

0.23.0

4 years ago

0.9.0

4 years ago

0.5.0

4 years ago

0.42.0

4 years ago

0.65.0

3 years ago

0.61.0

4 years ago

1.3.0

4 years ago

0.39.0

4 years ago

0.58.0

4 years ago

0.35.0

4 years ago

0.12.0

4 years ago

0.0.2363

3 years ago

0.16.0

4 years ago

0.54.0

4 years ago

0.31.0

4 years ago

0.50.0

4 years ago

0.28.0

4 years ago

0.2.0

4 years ago

0.66.0

3 years ago

0.47.0

4 years ago

0.24.0

4 years ago

0.6.0

4 years ago

0.0.60

4 years ago

0.0.59

4 years ago

0.0.58

4 years ago

0.0.56

4 years ago

0.0.55

4 years ago

0.0.53

4 years ago

0.0.54

4 years ago

0.0.52

4 years ago

0.0.51

4 years ago

0.0.50

4 years ago

0.0.49

4 years ago

0.0.48

4 years ago

0.0.47

4 years ago

0.0.46

4 years ago

0.0.45

4 years ago

0.0.44

4 years ago

0.0.43

4 years ago

0.0.42

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.35

4 years ago

0.0.34

4 years ago

0.0.33

4 years ago

0.0.32

4 years ago

0.0.30

4 years ago

0.0.31

4 years ago

0.0.29

4 years ago

0.0.27

4 years ago

0.0.28

4 years ago

0.0.26

4 years ago

0.0.24

4 years ago

0.0.25

4 years ago

0.0.23

4 years ago

0.0.22

4 years ago

0.0.21

4 years ago

0.0.20

4 years ago

0.0.18

4 years ago

0.0.19

4 years ago

0.0.17

4 years ago

0.0.16

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.10

4 years ago

0.0.11

4 years ago

0.0.12

4 years ago

0.0.13

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

0.0.5

4 years ago

0.0.3

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago