Git Product home page Git Product logo

work-co's Introduction

Work & Co Exercise

Running application

yarn install // added axios and react router dom for api request and custom route.
yarn start

Decision Making

The example consists of mainly two parts; Cart and Products. I figured out that Cart and Product shares same component (Product), it was hard to maintain different styling while keeping one another. Also, since cart component has different functionalities with product component, (i.e. remove item, update qty) I decided to build separate component which provide view and dedicated functions for added item in the cart (CartItem).

Components and Functions Overview

Product

  • The only function for this component is "Add To Cart". It simply adds product into cart when clicked.
  • Stock remainder indicates how many of them left.
  • "Add To Cart" button disables when the stock marked as 0.

Cart

  • It has two main functions; Remove and Update Qty.
  • "Remove" button simply removes whole item from cart and updates stock in the product.
  • Users can update qty in cart by pressing either "+" or "-" to increment or decrement the qty. Both buttons disables when the value between these buttons is reached to max stock or 1.
  • Total, tax and grand total section updates on decrement / increment of qty.

Update Cart

  • Alerts user that cart has been updated.

TODO / Final thoughts

  • Using bootstrap is nice if there is short time to build. I think the downside is it is hard to reproduce styling when the app has to satisfy with multiple devices. (i.e. mobile and tablet)
  • Create test module for CartItem component.

Thank you!

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.