Coder Social home page Coder Social logo

eduardtrutsyk / travix-ui-kit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from travix-international/travix-ui-kit

0.0 2.0 0.0 187 KB

Travix UI Components' repository.

License: MIT License

Makefile 0.28% JavaScript 85.23% CSS 14.22% HTML 0.27%

travix-ui-kit's Introduction

Travix UI-kit

npm Build Status Coverage NSP Status

Travix UI Components' repository.

UI-Kit

How to install and setup

  • npm i travix-ui-kit -S install as a dependency

Usage

CLI

The UI Kit comes with a CLI tool to help you build your UI bundles (JS and CSS).

To see the options available:

$ node_modules/.bin/travix-ui-kit -h

  Usage: travix-ui-kit [options]

  Options:

    -h, --help                       output usage information
    -V, --version                    output the version number
    -c, --css-dir <directory>        Destination directory of the ui-kit.css
    -e, --environment <environment>  Environment in which to run the build
    -j, --js-dir <directory>         Destination directory of the ui-kit.js
    -t, --theme-file <path>          Path to a theme file to override default UI Kit styles
    -w, --watch                      Enables file-watcher functionality

For example, if we want to generate our UI Bundles, with the default styling, on ./js/ and ./css/ folders, we do:

$ node_modules/.bin/travix-ui-kit -j ./js/ -c ./css/

If we want to pass our own YAML file for styling, we also can do it:

$ node_modules/.bin/travix-ui-kit -j ./js/ -c ./css/ -t ./myDefaultStyle.yml

And for development purposes, we tend to want to watch for changes on the files. That's possible too:

$ node_modules/.bin/travix-ui-kit -j ./js/ -c ./css/ -t ./myDefaultStyle.yml -w

For simplicity purposes we suggest to add a task/script to your package.json, which simplifies the usage of the CLI. E.g.:

{
  "scripts": {
    "build:ui": "travix-ui-kit -j ./js/ -c ./css/ -t ./myDefaultStyle.yml",
    "build:ui-watch": "travix-ui-kit -j ./js/ -c ./css/ -t ./myDefaultStyle.yml -w",
  }
}

The components

JS
const Button = require('travix-ui-kit').Button;
// or
import { Button } from 'travix-ui-kit';

function renderSomething({onAdd}) {
  return (
    <Button size="s" onClick={onAdd}>Add value</Button>
  );
}
CSS

use file node_modules/travix-ui-kit/dist/bundle.css

  • you can create an alias in your webpack plugin
  • or inject it in your page current styles bundle
  • or copy to public folder and add as separate style file with <link>

Warning: Directly using file components/index.scss not recommended. We're not promising that we will use SCSS in future or will keep file's structure


Living style guide

Before installation

  • Soon we will add a public web service. For now you need to install it on your local machine
  • We are using default styling theme. If you need to adjust it, you can do it by passing proper theme YAML file as env var: THEME_PATH=/some/path/to/theme.yaml npm run build

How install

Prereqs

Installing

  • git clone this repo
  • npm i to install dependencies
  • npm run build to build theme, styles and javascript

How to run living style guide

  • npm run styleguide-build to build web service with living style guide
  • npm run styleguide-server to run web service with living style guide
  • open localhost:3000

Development

Start developing

  • npm run build:watch to build the themes, styles and javascript on each file change
  • npm run build:watch -- -t "./path/to/my/theme.yml" to build using a custom theme (also can use the other options as well).
  • npm run styleguide-server to run web service with livingstyle guide and review changes

Testing

  • npm run test to run unit test
  • npm run cov to run unit test with coverage report
  • npm run update-snapshots to update current unit test snapshots
  • npm run lint to check ES-lint errors

Requirements

  • Developer must follow the sturcture of the project
    • every component must contain own directory with its own .js, .scss and .md files
  • 100% unit test coverage of components and helpers
  • 0 ES lint errors

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.