6.1.0 • Published 3 years ago

@comparaonline/ui-offer-details v6.1.0

Weekly downloads
27
License
MIT
Repository
-
Last release
3 years ago

@comparaonline/ui-offer-details

Package purpose

Installation

yarn add @comparaonline/ui-offer-details

Usage

This package will show details of each offer that is passing down to the component.

import OfferDetail from '@comparaonline/ui-offer-details';
import { Offer } from '@comparaonline/offers-models';

class ContentArea extends React.Component {
  state = {
    open: false,
    offerSelected: undefined
  };

  toggleDetailDrawer() {
    this.setState({ open: !this.state.open });
  }

  openDetail(offer: Offer) {
    this.setState({ open: true, offerSelected: offer });
  }

  renderPrice(offer: Offer) {
    const { product } = offer;
    const { mainAttribute } = product;
    const { value } = mainAttribute;

    return <PriceParserComponent price={value.amount} />;
  }

  goToNextScreen(offer: Offer) {
    this.props.history.push('paymentScreen', { offer });
  }

  render() {
    const { open, offer, translate } = this.state;
    return (
      <Layout>
        <Button onClick={(offer: Offer) => this.openDetail(offer)}>
          See Product
        </Button>

        <OfferDetail
          open={open}
          offer={offer}
          renderPrice={this.renderPrice}
          onClose={this.toggleDetailDrawer}
          onSelectOffer={this.goToNextScreen}
          detailTranslate={translate('results:details:attributeDetails')}
          detailTranslate={(offer: Offer) =>
            translate('results:details:about', {
              name: offer.product.division.name
            })
          }
        />
      </Layout>
    );
  }
}

Props

This components is composed by some properties that are listed below.

Prop NameDescriptionDefault ValueExpected Type Value
openThis will open/close the drawerundefinedboolean
renderPricethis function will execute to show the price as desired(offer: Offfer) =>Function
onSelectOfferthis function will execute when buy button is pressed(offer: Offer) => voidFunction
onClosethis function will execute on drawer close(offer: Offer) => voidFunction
detailTranslatestring to be set as a title of details tabundefinedstring(offer: Offer) => string
aboutTranslatestring to be set as a title of about tabundefinedstring(offer: Offer) => string
hideBuyButtonif true won't render the buttonfalsebooleanboolean
6.1.0

3 years ago

5.8.0

4 years ago

5.4.14

4 years ago

5.4.12

4 years ago

5.4.11

4 years ago

5.4.9

4 years ago

5.4.10

4 years ago

5.4.8

4 years ago

5.4.4

5 years ago

5.4.3

5 years ago

5.4.2

5 years ago

5.1.2

5 years ago

5.1.1

5 years ago

5.0.0

5 years ago

4.10.2

5 years ago

4.9.1

5 years ago

4.9.0

5 years ago

4.8.7

5 years ago

4.8.5

5 years ago

4.8.4

5 years ago

4.8.3

5 years ago

4.8.2

5 years ago

4.8.1

5 years ago

4.8.0

5 years ago

4.7.4

5 years ago

4.7.1

5 years ago

4.7.0

5 years ago

4.6.0

5 years ago

4.5.0

5 years ago

4.4.3

5 years ago

4.4.2

5 years ago

4.4.1

5 years ago

4.3.6

5 years ago

4.3.3

5 years ago

4.0.5

5 years ago

4.0.0

5 years ago

3.6.5

5 years ago

3.5.6

5 years ago

3.4.6

5 years ago

3.4.5

5 years ago

3.4.4

5 years ago

3.4.3

5 years ago

3.4.1

5 years ago

3.4.0

5 years ago

3.0.0

5 years ago

2.2.1

5 years ago

2.1.8

5 years ago

2.1.8-staging

5 years ago

2.1.5

5 years ago

2.1.0

5 years ago

2.0.10-0

5 years ago

2.0.9-0

5 years ago

2.0.8-0

5 years ago

2.0.7-0

5 years ago

2.0.6-0

5 years ago

2.0.5-0

5 years ago

2.0.4-0

5 years ago

2.0.3-0

5 years ago

2.0.2-0

5 years ago

2.0.1-0

5 years ago

2.0.0-0

5 years ago

1.6.31

6 years ago

1.6.29

6 years ago

1.6.28

6 years ago

1.6.26

6 years ago

1.6.24

6 years ago

1.6.23

6 years ago

1.6.20

6 years ago

1.6.17

6 years ago

1.6.16

6 years ago

1.6.14

6 years ago

1.6.11

6 years ago

1.6.11-alpha.0

6 years ago

1.6.10

6 years ago

1.6.9

6 years ago

1.6.8

6 years ago

1.6.7

6 years ago

1.6.6

6 years ago

1.6.6-0

6 years ago

1.6.5-0

6 years ago

1.6.4

6 years ago

1.6.3

6 years ago

1.6.2

6 years ago

1.6.0

6 years ago

1.6.0-0

6 years ago