6.1.0 • Published 4 years ago

@comparaonline/ui-offer-details v6.1.0

Weekly downloads
27
License
MIT
Repository
-
Last release
4 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

4 years ago

5.8.0

5 years ago

5.4.14

6 years ago

5.4.12

6 years ago

5.4.11

6 years ago

5.4.9

6 years ago

5.4.10

6 years ago

5.4.8

6 years ago

5.4.4

6 years ago

5.4.3

6 years ago

5.4.2

6 years ago

5.1.2

6 years ago

5.1.1

6 years ago

5.0.0

6 years ago

4.10.2

6 years ago

4.9.1

6 years ago

4.9.0

6 years ago

4.8.7

6 years ago

4.8.5

6 years ago

4.8.4

6 years ago

4.8.3

6 years ago

4.8.2

6 years ago

4.8.1

6 years ago

4.8.0

6 years ago

4.7.4

6 years ago

4.7.1

6 years ago

4.7.0

6 years ago

4.6.0

6 years ago

4.5.0

6 years ago

4.4.3

6 years ago

4.4.2

6 years ago

4.4.1

6 years ago

4.3.6

6 years ago

4.3.3

6 years ago

4.0.5

6 years ago

4.0.0

6 years ago

3.6.5

6 years ago

3.5.6

6 years ago

3.4.6

7 years ago

3.4.5

7 years ago

3.4.4

7 years ago

3.4.3

7 years ago

3.4.1

7 years ago

3.4.0

7 years ago

3.0.0

7 years ago

2.2.1

7 years ago

2.1.8

7 years ago

2.1.8-staging

7 years ago

2.1.5

7 years ago

2.1.0

7 years ago

2.0.10-0

7 years ago

2.0.9-0

7 years ago

2.0.8-0

7 years ago

2.0.7-0

7 years ago

2.0.6-0

7 years ago

2.0.5-0

7 years ago

2.0.4-0

7 years ago

2.0.3-0

7 years ago

2.0.2-0

7 years ago

2.0.1-0

7 years ago

2.0.0-0

7 years ago

1.6.31

7 years ago

1.6.29

7 years ago

1.6.28

7 years ago

1.6.26

7 years ago

1.6.24

7 years ago

1.6.23

7 years ago

1.6.20

7 years ago

1.6.17

7 years ago

1.6.16

7 years ago

1.6.14

7 years ago

1.6.11

7 years ago

1.6.11-alpha.0

7 years ago

1.6.10

7 years ago

1.6.9

7 years ago

1.6.8

7 years ago

1.6.7

7 years ago

1.6.6

7 years ago

1.6.6-0

7 years ago

1.6.5-0

7 years ago

1.6.4

7 years ago

1.6.3

7 years ago

1.6.2

7 years ago

1.6.0

7 years ago

1.6.0-0

7 years ago