{"size": 1388, "ext": "js", "max_stars_repo_path": "src/components/layout/section-with-text-and-image/section-with-text-and-image.js", "max_stars_repo_name": "DB-Tax-Wealth/mainsite", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/components/layout/section-with-text-and-image/section-with-text-and-image.js", "max_issues_repo_name": "DB-Tax-Wealth/mainsite", "max_issues_repo_issues_event_min_datetime": "2021-03-09T16:30:17.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-26T17:19:42.000Z", "max_forks_repo_path": "src/components/layout/section-with-text-and-image/section-with-text-and-image.js", "max_forks_repo_name": "DB-Tax-Wealth/mainsite", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 5, "max_forks_count": null, "avg_line_length": 30.1739130435, "max_line_length": 100, "alphanum_fraction": 0.6700288184}
import { CHILDREN_PROP_TYPE } from 'constants/children-prop-type';
import { HeadingWithSubtitle } from 'components/layout/heading-with-subtitle/heading-with-subtitle';
import PropTypes from 'prop-types';
import React from 'react';
import { Section } from 'components/layout/section/section';
import styles from './section-with-text-and-image.style.scss';

export const SectionWithTextAndImage = (props) => {
  const { children, image, subtitle, subtitleColor, title } = props;
  const imageExists = Boolean(image);

  return (
    <Section className={styles.root} color="primary">
      <div className={styles.content}>
        <div className={styles.primary}>
          <HeadingWithSubtitle subtitle={subtitle} subtitleColor={subtitleColor}>
            {title}
          </HeadingWithSubtitle>
          {children}
        </div>
        {imageExists && (
          <div className={styles.imageContainer}>
            <div className={styles.image} style={{ backgroundImage: `url(${image})` }} />
          </div>
        )}
      </div>
    </Section>
  );
};

SectionWithTextAndImage.propTypes = {
  children: CHILDREN_PROP_TYPE,
  image: PropTypes.node,
  subtitle: PropTypes.string,
  subtitleColor: PropTypes.string,
  title: PropTypes.string,
};

SectionWithTextAndImage.defaultProps = {
  children: null,
  image: null,
  subtitle: '',
  subtitleColor: undefined,
  title: '',
};
