@groupby/elements-product
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

GroupBy Elements Product Component

<gbe-product product="{}"></gbe-product>

The product component will display information about a given product.

Functionality

The component takes one product attribute (refer to the ProductModel instance for the data format).

{
  "title": "Product Name",
  "price": 3.55,
  "productUrl": "http://example.com/img.jpg",
  "imageSrc": "http://example.com/img.jpg",
  "imageAlt": "Alternative image text"
}

Customizations

Optionally the product can use variants to display different information based on what variant is selected (refer to the ProductVariantsModel instance for the data format).

{
  "variants": {
    "type": "text" // default, can be either "text", "image", "color"
    "items": [
      {
        "text": "Variant Label",
        "product": {
          // Data that will be overwritten in the product component
        }
      }
    ]
  }
}

Any properties that are not identified in the ProductModel, will be rendered as additional <span> tags in the component.

Testing

The test suite for this component is contained in test directory. To run the tests, navigate to this folder and use one of the following commands based on the desired testing flow:

  • To run the tests once:
yarn test
  • To run the tests and watch the src and test directories for changes:
yarn tdd

Dependencies (3)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @groupby/elements-product

    Weekly Downloads

    1

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    45.7 kB

    Total Files

    39

    Last publish

    Collaborators

    • mykola_bova
    • adruzhkin-gbi
    • anton.shakhlovich
    • artem_konstantinov
    • andzinchenko
    • yberkut-gbi
    • romangbi
    • francoisvongue
    • gleb.bondarenko.gb
    • pavel-shakhlovich
    • jonapgar-groupby
    • kseniya.kondrashevich
    • owengbi
    • yanishgbi
    • jasonwelsh
    • groupby-ops
    • groupby-ci
    • groupbyops
    • daniel-moniz-gbi
    • johanntutorgbi
    • dmytro-kyiashko
    • roman.lis