/ui-components

A collection of reusable ui components for composing p44's interface - Moved to https://project44.github.io/portal-v2-ui/

Primary LanguageJavaScript

ui-components

This project has been archived and moved into the portal-v2-ui repo. The example page has been moved to https://project44.github.io/portal-v2-ui/

NPM JavaScript Style Guide

Install

We are using GitHub as our registry for the time being, so the correct way to add ui-components to your project is using the following syntax:

yarn add project44/ui-components#0.0.2

Change the version number to support your needs

Usage

You will need to reference the bundled styles in your application:

@import '~ui-components/dist/ant.css';
@import '~ui-components/dist/build.css';

Note: the ordering is important! Make sure build.css follows ant.css.

import React, { Component } from 'react';

import { MyComponent } from 'ui-components';

class Example extends Component {
  render() {
    return <MyComponent />;
  }
}

Publishing

When you are ready to publish a new version of ui-components, follow the directions on the site, and and your new version should be published directly to GitHub, and viewable from the releases page of this repo.

  • Run yarn start to generate the static assets. Once finished and termainl shows "waiting for changes", CMD+C to kill the process.
  • commit the generated /dist files, and push them up to master
  • Run yarn version --patch | --minor | --major | --new-version <version>
  • Run git push and git push --tags
  • Run yarn deploy to publish new gh-pages

Local Development

  1. Run yarn start to build library in watch mode
  2. Run yarn example:start to serve example site on http://localhost:4000

yalc can be used to test in a different project.

Contribution Guidelines

Code Style

Code style is enforced via prettier and eslint. Prettier and ESLint will automatically run on staged files every commit.

CSS Styles

Components should use styled-components for styles. Existing components that still use .scss should be moved to use styled-components.

TypeScript

Currently types are exported in dist/index.d.ts and should be updated as needed.

Adding New Components

  1. Create your component in src/components
  2. Export your component in src/index.js
  3. Add component typings to dist/index.d.ts
  4. Add an example of your component
    1. Create example component in example/src/components/components
    2. Add a new route for your example component in example/routes.js
    3. Add your example component's route to example/components/common/Components
    4. Add a link to your example component in example/components/common/SideNav.js