Skip to content

aspgems/react-ordering

Repository files navigation

Maintainability Test Coverage Build Status dependencies Status

This project was bootstrapped with Create React App.

If you want to read about Create React App you can do it here

You can see a live demo here

Install and setup

Requirements

This project requires:

Install and running

First, you need to install node. The recommended installation is with nvm

If you are using zsh you can use the oh-my-zsh plugin for nvm

Then, install npm libraries

npm install

and start your development server with

npm run start

npm scripts

script description
npm run start Starts your dev server at port 3000
npm test Runs your tests
npm lint Runs your linter
npm run build Builds the app
npm run storybook Runs storybook at port 9001
npm run start-server Runs a json server mocking the API. (Intended to be used from docker)

Project structure

This projects tries to follow a modular development approach.

Components

Under src folder there is components folder conaining all the available components. Right now we have only two of them:

  • OrderItem: Deals with a product in the product list. Contains the button that allows adding it to the shopping cart.
  • ProductItem: To deal with a product added to the shopping cart. Allows increasing/decreasing quantity as well as removing it from the cart.

Every module follows the following convention:

  • It comes with a <Component name>.js file which holds the sources for the component.
  • It optionally comes with a <Component name>.css file which contains the required stylesheet to render the component.
  • It comes with a <Component name>.snapshots.test.js with the snapshot tests for the component.
  • It optionally comes with a <Component name>.test.js with the tests for the component.

API

The api folder contains the required classes to consume data from the backend. Currently only two classes exists:

  • orders.js: Allows loading, creating or updating orders.
  • products.js: Allows retrieving the list of available products.

Docker support:

The project comes with docker-compose support. In order to execute the project you need to first and foremost build the image:

docker-compose build

Now you're ready to execute the application:

docker-compose up

It will start three containers exposing the following services:

Storybook

This project comes with storybook. Place your stories files together with their related components with a .stories.js extension

About

A proof of concept using React

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 6