From 444a8147f59df78ebf14222edcebf944226b533e Mon Sep 17 00:00:00 2001 From: MikunoNaka Date: Sat, 17 Apr 2021 16:18:12 +0530 Subject: designed DisplayItem and ItemsDisplay so it now renders a pretty table --- src/components/Display/Display.css | 33 +++++++++++++++-- src/components/Display/Display.scss | 27 ++++++++++++-- src/components/Display/DisplayItem.js | 40 +++++++++++++++++++++ src/components/Display/ItemsDisplay.js | 66 +++++++++++++++++++++++++--------- 4 files changed, 145 insertions(+), 21 deletions(-) create mode 100644 src/components/Display/DisplayItem.js (limited to 'src/components/Display') diff --git a/src/components/Display/Display.css b/src/components/Display/Display.css index 1b89173..a3bc406 100644 --- a/src/components/Display/Display.css +++ b/src/components/Display/Display.css @@ -1,3 +1,32 @@ +@import url("https://fonts.googleapis.com/css2?family=Quicksand:wght@500&display=swap"); +/* Experimental color scheme */ +/* light theme */ +/* +$defBG: #FFFFFF; +$altBG: lightgray; +$defFG: #000000; +$altFG: #232627; +$defLink: brown; +$altLink: brown; + +$defShadow: 0px 0px 4px #232627; +*/ +/* Inspired by Dracula */ +.ItemsDisplay, +.ItemsDisplay table { + width: 100%; } + .ItemsDisplay { - margin-top: 3rem; - margin-bottom: 3rem; } + border-right: 1px dashed lightblue; + border-left: 1px dashed lightblue; + padding: 1rem 0.5rem; } + +.ItemsDisplay td { + text-align: center; + border-bottom: 1px solid lightblue; } + +.ItemsDisplay .leftAlign { + text-align: left; } + +.ItemsDisplay .legend { + background-color: #383A59; } diff --git a/src/components/Display/Display.scss b/src/components/Display/Display.scss index e3d8b7c..25bb331 100644 --- a/src/components/Display/Display.scss +++ b/src/components/Display/Display.scss @@ -1,6 +1,27 @@ +@import "../../styles/theme"; + +.ItemsDisplay, +.ItemsDisplay table { + width: 100%; +} + .ItemsDisplay { - margin-top: 3rem; - margin-bottom: 3rem; + $sideBorder: 1px dashed $tableBorderColor; + border-right: $sideBorder; + border-left: $sideBorder; + + padding: 1rem 0.5rem; +} + +.ItemsDisplay td { + text-align: center; + border-bottom: 1px solid $labelUnderlineColor; +} + +.ItemsDisplay .leftAlign { + text-align: left; +} - +.ItemsDisplay .legend { + background-color: $altBG; } diff --git a/src/components/Display/DisplayItem.js b/src/components/Display/DisplayItem.js new file mode 100644 index 0000000..dae87a3 --- /dev/null +++ b/src/components/Display/DisplayItem.js @@ -0,0 +1,40 @@ +import React from "react"; +import "./Display.css"; + +const DisplayItem = (props) => { + const itemNumber = props.itemNumber; + const item = props.item; + // const ID = props.ID; + // const name = props.Model; + // const desc = props.Description; + // const QTY = props.Quantity; + // const price = props.Price; + // const discount = props.Discount; + // const GST = props.GST; + + return ( + + {itemNumber} + {item.Model} + {item.Description} + {item.Quantity} + {item.Price} + {item.Discount} + {item.GST} + + ); + /*return ( + + );*/ +} + +export default DisplayItem; diff --git a/src/components/Display/ItemsDisplay.js b/src/components/Display/ItemsDisplay.js index 766d16f..7026530 100644 --- a/src/components/Display/ItemsDisplay.js +++ b/src/components/Display/ItemsDisplay.js @@ -1,29 +1,63 @@ import React from "react"; import "./Display.css"; +import DisplayItem from "./DisplayItem"; const ItemsDisplay = (props) => { const items = props.items; + let itemNumber = 0; + return ( -
-
    - {items.map( (item) => { + + + + + + + + + + + + {items.map( + (item) => { + itemNumber++ return ( -
  1. -
      -
    • {item.Model}
    • -
    • {item.Description}
    • -
    • {item.Quantity}
    • -
    • {item.Price}
    • -
    • {item.Discount}
    • -
    • {item.GST}
    • -
    -
  2. + ); - })} - + } + )} +
    S. NumItemDescriptionQuantity(NOS)PriceDiscount(%)GST(%)
    + ) + + + /*return ( +
    +
    +
      +
    • S. Num.
    • +
    • Name
    • +
    • Description
    • +
    • Quantity
    • +
    • Price
    • +
    • Discount
    • +
    • GST
    • +
    +
    + +
    + {items.map( + (item) => { + itemNumber++ + return ( + + ); + } + )} +
    +
    - ); + );*/ } export default ItemsDisplay; -- cgit v1.2.3