<commit_before>import React, { PropTypes } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { Map } from 'immutable';
import styled from 'styled-components';

import Image from './Image';

const Wrapper = styled.div`
  height: 605px;
  width: 405px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  cursor: pointer;
  font-size:0;
  &>div {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 33px;
  }
`;

const Name = styled.div`
  line-height: 32px;
  font-size: 20px;
  font-family: LeroyMerlinSans Bold;
  text-transform: uppercase;
  text-align: center;
  margin: 10px 0;
`;

const Price = styled.div`
  font-size: 16px;
  line-height: 20px;
  width: 100%;
  margin-top: auto;
  margin-bottom: 83px;
`;

const ProductBadge = ({ productInfo, handleClick }) => {
  if (productInfo.isEmpty()) {
    return null;
  }
  const imageID = productInfo.get('mainImage');
  const imageOptions = { width: 405, height: 405 };
  const name = productInfo.get('name');
  const price = productInfo.getIn(['price', 'selling', 'gross']).toFixed(2);
  const currency = productInfo.getIn(['price', 'currency']);
  const displayPrice = `${price} ${currency}`;

  return (
    <Wrapper onClick={handleClick}>
      <Image
        imageID={imageID}
        imageOptions={imageOptions}
        alt={name}
      />
      <Name>{name}</Name>
      <Price>{displayPrice}</Price>
    </Wrapper>
  );
};

ProductBadge.propTypes = {
  productInfo: ImmutablePropTypes.map,
  handleClick: PropTypes.func
};

ProductBadge.defaultProps = {
  productInfo: Map(),
  handleClick: () => null
};

export default ProductBadge;
<commit_msg>fix #374<commit_after>import React, { PropTypes } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { Map } from 'immutable';
import styled from 'styled-components';

import Image from './Image';

const Wrapper = styled.div`
  height: 605px;
  width: 405px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  position: relative;
  cursor: pointer;
  font-size:0;
  &>div {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 33px;
  }
`;

const Name = styled.div`
  line-height: 32px;
  font-size: 20px;
  font-family: LeroyMerlinSans Bold;
  text-transform: uppercase;
  text-align: center;
  margin: 10px 0;
`;

const Price = styled.div`
  font-size: 16px;
  line-height: 20px;
  width: 100%;
  margin-top: auto;
  margin-bottom: 83px;
`;

const Available = styled.div`
  color: #339900;
  display: flex;
  justify-content: center;
  align-items: center;
  position: absolute;
  height: 40px;
  bottom: 200px;
  &>p {
    font-family: LeroyMerlinSans Bold;
    font-size: 16px;
  }
  background: rgba(255, 255, 255, 0.8);
`;

const ProductBadge = ({ productInfo, handleClick }) => {
  if (productInfo.isEmpty()) {
    return null;
  }
  const imageID = productInfo.get('mainImage');
  const imageOptions = { width: 405, height: 405 };
  const name = productInfo.get('name');
  const price = productInfo.getIn(['price', 'selling', 'gross']).toFixed(2);
  const currency = productInfo.getIn(['price', 'currency']);
  const displayPrice = `${price} ${currency}`;
  const isInStock = (productInfo.get('storeStock') - 2) > 0;

  return (
    <Wrapper onClick={handleClick}>
      <Image
        imageID={imageID}
        imageOptions={imageOptions}
        alt={name}
      />
      <Name>{name}</Name>
      <Price>{displayPrice}</Price>
      {isInStock &&
      <Available>
        <p>Disponibile in Negozio</p>
      </Available>}
    </Wrapper>
  );
};

ProductBadge.propTypes = {
  productInfo: ImmutablePropTypes.map,
  handleClick: PropTypes.func
};

ProductBadge.defaultProps = {
  productInfo: Map(),
  handleClick: () => null
};

export default ProductBadge;

{'fraction_non_alphanumeric': 0.14696813977389517, 'fraction_numerical': 0.025950668036998973, 'mean_word_length': 3.5478971962616823, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5604334', 'n_tokens_mistral': 1407, 'n_tokens_neox': 1322, 'n_words': 312}