{"size": 1470, "ext": "js", "max_stars_repo_path": "src/components/ProductBanner/ProductBanner.js", "max_stars_repo_name": "mikulskee/ChangingRoom", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/components/ProductBanner/ProductBanner.js", "max_issues_repo_name": "mikulskee/ChangingRoom", "max_issues_repo_issues_event_min_datetime": "2020-09-07T04:29:01.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-26T17:30:37.000Z", "max_forks_repo_path": "src/components/ProductBanner/ProductBanner.js", "max_forks_repo_name": "mikulskee/ChangingRoom", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 7, "max_forks_count": null, "avg_line_length": 22.2727272727, "max_line_length": 64, "alphanum_fraction": 0.6421768707}
import React, { useContext } from "react";
import styled from "styled-components";
import { withRouter } from "react-router-dom";
import { ShopContext } from "../../contexts/ShopContext";

const Wrapper = styled.aside`
  position: fixed;
  top: 0;
  left: 0;
  display: none;
  height: 100%;
  width: 17%;
  background-image: url(${({ bg }) => (bg ? bg : null)});
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  overflow: hidden;
  margin-right: 50px;
  z-index: -1;
  @media only screen and (min-width: 1024px) {
    display: block;
  }
  ::before {
    content: "";
    display: block;
    position: absolute;
    height: 100%;
    width: 100%;
    top: 0;
    left: 0;
    background-color: #171717;
    opacity: 0.35;
  }
`;
const TitleBanner = styled.h1`
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  text-align: center;
  color: white;
  font-weight: 400;
  letter-spacing: 2px;
  font-size: 30px;
  transform: translate(-50%, -50%);
`;
const ProductBanner = props => {
  const { shopItems } = useContext(ShopContext);

  const bgBanner = shopItems.filter(
    section => section.section === props.match.params.section_id
  )[0].mainImg;

  const title = shopItems.filter(
    section => section.section === props.match.params.section_id
  )[0].sectionPL;

  return (
    <Wrapper bg={bgBanner}>
      <TitleBanner>{title}</TitleBanner>
    </Wrapper>
  );
};

export default withRouter(ProductBanner);
