Giter VIP home page Giter VIP logo

gravitee-ui-components's Introduction

Welcome to Gravitee.io UI Components

User guide

If you want to use our awesome Gravitee components to your webapp

npm install --save @gravitee/ui-components

Configuration

Our components are based on a set of files to manage icons, images, i18n or even for CSS. When we publish the dist folder, we also publish the assets, you can get them in folder @gravitee/ui-components/assets. To use them in an application, it’s necessary to add some configuration to expose the folders on the correct paths

webpack.conf.js

const CopyPlugin = require("copy-webpack-plugin");

module.exports = {
  plugins: [
    new CopyPlugin({
      patterns: [
        { from: "node_modules/@gravitee/ui-components/assets/images", to: "images" },
        { from: "node_modules/@gravitee/ui-components/assets/css", to: "css" },
        { from: "node_modules/@gravitee/ui-components/assets/svg", to: "svg" },
        { from: "node_modules/@gravitee/ui-components/assets/i18n", to: "i18n" },
      ],
    }),
  ],
};

angular.json

  "architect": {
    "build": {
      "builder": "@angular-devkit/build-angular:browser",
      "options": {
        "index": "src/index.html",
        "main": "src/main.ts",
        "assets": [
          "src/favicon.ico",
          "src/favicon.png",
          "src/assets",
          {
            "glob": "**/*",
            "input": "node_modules/@gravitee/ui-components/assets/images",
            "output": "images/"
          },
          {
            "glob": "**/*.css",
            "input": "node_modules/@gravitee/ui-components/assets/css",
            "output": "css/"
          },
          {
            "glob": "**/*.svg",
            "input": "node_modules/@gravitee/ui-components/assets/icons",
             "output": "icons/"
          },
          {
            "glob": "**/*.json",
            "input": "node_modules/@gravitee/ui-components/assets/i18n",
            "output": "i18n/"
          }

I18n

Some components use i18n, if you didn’t need it, you can load the default EN translations when your app starts.

import { loadDefaultTranslations } from '@gravitee/ui-components/src/lib/i18n';

loadDefaultTranslations();

Using in Angular app

First import the component

import { FormGroup, FormControl } from '@angular/forms';

import '@gravitee/ui-components/wc/gv-input';
import '@gravitee/ui-components/wc/gv-button';

Use in template, like an simple HTML element

<form [formGroup]="loginForm" (ngSubmit)="login()">
    <div>
      <gv-input
          autofocus
          name="username"
          formControlName="username"
          ngDefaultControl
          gvControl
          icon-left="communication:shield-user">
      </gv-input>
      <gv-input
          type="password"
          name="password"
          formControlName="password"
          ngDefaultControl
          gvControl
          icon-left="general:shield-protected">
      </gv-input>
    </div>

    <div>
      <gv-button
          class="signin"
          primary
          icon="navigation:sign-in"
          type="submit">Login</gv-button>
    </div>

</form>

Upgrade

Read the changelog and be careful with breaking changes or notes about upgrade of dependencies.

And install the desired {version}:

npm install --save @gravitee/ui-components@{version}
Tip
You can clean the package-lock.json and remove duplicate depencies with npm run dedupe

Developers guide

Install

  • Install nvm

  • Use with nvm use or install with nvm install the node version declared in .nvmrc

  • Then install node modules with:

npm install

Tasks

If you wanna start the storybook on dev mode :

npm run serve

If you wanna generate docs :

npm run docs

If you wanna run test:

npm run test

If you wanna run test with coverage:

npm run test -- --collect-coverage

If you wanna build storybook:

npm run build

If you wanna start storybook on prod mode :

npm run serve:prod

If you wanna build components to use them in your project:

npm run generate:dist

If you wanna build icons component from svg files:

npm run generate:icons

If you wanna lint :

npm run lint

If you wanna fix lint :

npm run lint:fix

If you wanna generate theme :

npm run generate:theme

If you wanna link for use in other local project as dependency:

npm link
cd ../my-project
npm link @gravitee/ui-components

If you wanna link the prod version in other local project:

npm run build
cd dist
npm link
cd ../my-project
npm link @gravitee/ui-components

Contributing

You think Gravitee.io is awesome and want to contribute to the project? Here are few guidelines that should help you get started.

Copyright © 2015 The Gravitee team (http://gravitee.io) Licensed under the Apache License, Version 2.0 (the "License");

See the LICENSE file for details.

Changelog

Refer to the CHANGELOG for a complete list of changes.

gravitee-ui-components's People

Contributors

gcusnieux avatar graviteeio avatar gaetanmaisse avatar aelamrani avatar phiz71 avatar loriepisicchio avatar renovate-bot avatar ytvnr avatar dependabot[bot] avatar leleueri avatar okhelifi avatar jgiovaresco avatar nicolasgeraud avatar jean-baptiste-lasselle avatar jeremy-dubus 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.