Skip to content

kherP/react-components

 
 

Repository files navigation

SEB React Components

Deployment Github Pages Commitizen friendly semantic-release Coverage Status Dependabot Status

This is a set of react components some of which are based on SEB's bootstrap. The plan for this project is to increase and improve components for future usage.

Minimum requirements

This version of components has been developed with:

  • React ^16.12
  • Typescript ^3.7
  • SEB Bootstrap ^5.1

Installation

You should be able to install the NPM package.

npm install @sebgroup/react-components --save

This project is based on SEB Bootstrap which includes fonts, colors and variables, to make sure everything works fine, please install these dependencies on your project:

npm install @sebgroup/bootstrap --save

Then make sure you add the Main SEB bootstrap package in your main style.SCSS or index.ts as follows @import '~@sebgroup/bootstrap/scss/bootstrap';.

For Visual Studio Code users, please install the recommended plugins

Development

This project uses prettier for a more consistent (less annoying) coding. We are using 4 different builds for this project. The src folder is where the actual components exist with all their necessary dependencies. and develop folder is where we develop and test those components. Unit tests are based on jest and enzyme.

  1. Development: npm start
  2. Check formatting rules, Compile components and Create Docs folder: npm run build
  3. Build and create the Documentation pages only: npm run docs
  4. To run the unit tests, run: npm test
  5. To run a unit test for a specific component you have to pass the name of the component, example: npm test Button. It can also be chained with multiple specific components, e.g. npm test Button RadioGroup
  6. To commit your changes run: npm run commit and follow the steps

Usage

For performance benefits we are not combining all the components into single Index rather they are chunked into their subpackage. Therefore, to use a component, you need to import the Component submodule from the dist folder, in whichever Class you want to use it. Here is a sample of how to import a Button component in a page.

import { Button } from "@sebgroup/react-components/dist/Button";

const Comp = () => {
    const onClick = (e) => {
        console.log("Im Clicked");
    }

    return (
        <div>
            <Button label="a button" onClick={onClick} />
        </div>
    );
}

export default Comp;

Packages

No packages published

Languages

  • TypeScript 80.6%
  • SCSS 17.6%
  • JavaScript 1.7%
  • HTML 0.1%