0.3.2 • Published 2 years ago

@acctglobal/product-tags v0.3.2

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

What does this component do?

This agnostic component is a Category tag inserted into the product page. When clicked, this tag redirects the user to the product category page.

If the product is part of a specific collection, you can also enable a collection tag that will appear next to the category tag.

Download the package

using

  • npm i @acctglobal/product-tags

or

  • yarn add @acctglobal/product-tags

Usage examples

Import the component in your file:

  • import {ProductTags} from '@acctglobal/product-tags

Declare the component and pass your LinkComponent inside of the CustomTagComponent prop.

  • <ProductTags
      tagCategoryLabel="Category"
      urlCategory="/category"
      tagCollectionLabel="Collection"
      urlCollection="/collection"
      CustomTagComponent={Link}
    />

CSS example

  • [data-tags-container] {
      display: flex;
      gap: 12px;
    }
    
    [data-tag-category] {
        background-color: #94E7AD;
        border: 2px solid #40AA60;
        border-radius: 50px;
        padding: 4px 11px 4px 10px;
        text-decoration: none;
        color: #2A7641;
        font-weight: 700;
    }
    
    [data-tag-collection] {
        background-color: #FF8E8E;
        border: 2px solid #FF5050;
        border-radius: 50px;
        padding: 4px 11px 4px 10px;
        text-decoration: none;
        color: black;
        font-weight: 700;
    }

Result

Result

Props

PropValueDescription
tagCategoryLabelstringMandatory. Set the title of the tag
urlCategorystringMandatory. Set the url to your category page
tagCollectionLabelstringOptional. Set the title of the tag
urlCollectionstringOptional. Set the url to your collection page
tagStylesReact.CSSPropertiesOptional. Set the tag styles
CustomTagComponentComponentType< ButtonTag >Mandatory. Set the Link component for the tags

ButtonTag

PropValueDescription
tostringMandatory. Set the url
styleCSSPropertiesOptional. Pass styles as props
childrenReactNodeOptional. It represents anything that can be set as children of a ReactElement
IdentifierDescription
data-tags-containerstyles the container that wraps the component.
data-tag-categorystyles the category tag of the component.
data-tag-collectionstyles the collection tag of the the component.
0.3.2

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago