{"size": 1031, "ext": "js", "max_stars_repo_path": "frontend/src/components/recipes/edit/components/Step2/components/SourceSection/SourceSection.js", "max_stars_repo_name": "jf248/scrape-the-plate", "max_stars_repo_stars_event_min_datetime": "2018-08-19T10:58:21.000Z", "max_stars_repo_stars_event_max_datetime": "2019-03-31T17:19:29.000Z", "max_issues_repo_path": "frontend/src/components/recipes/edit/components/Step2/components/SourceSection/SourceSection.js", "max_issues_repo_name": "jf248/scrape-the-plate", "max_issues_repo_issues_event_min_datetime": "2020-02-11T21:59:38.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-08T22:47:52.000Z", "max_forks_repo_path": "frontend/src/components/recipes/edit/components/Step2/components/SourceSection/SourceSection.js", "max_forks_repo_name": "jf248/scrape-the-plate", "max_forks_repo_forks_event_min_datetime": "2018-08-19T10:58:23.000Z", "max_forks_repo_forks_event_max_datetime": "2018-08-19T10:58:23.000Z"}
{"max_stars_count": 3, "max_issues_count": 16, "max_forks_count": 1, "avg_line_length": 19.8269230769, "max_line_length": 52, "alphanum_fraction": 0.6120271581}
import React from 'react';

import SourceSectionPres from './SourceSectionPres';

SourceSection.defaultProps = {
  sourceInputProps: {},
  sourceTypeInputProps: {},
};
function SourceSection(props) {
  const {
    bookInputProps,
    pageInputProps,
    sourceInputProps,
    sourceTypeInputProps,
    urlInputProps,
    ...rest
  } = props;

  const types = [
    { label: 'My own', value: 'user' },
    { label: 'Book', value: 'book' },
    { label: 'Website', value: 'website' },
  ];

  const isScraped = !!sourceInputProps.value;
  const type = sourceTypeInputProps.value;
  const error =
    !!bookInputProps.error ||
    !!pageInputProps.error ||
    !!sourceInputProps.error ||
    !!sourceTypeInputProps.error ||
    !!urlInputProps.error;

  return (
    <SourceSectionPres
      {...{
        error,
        type,
        types,
        isScraped,
        urlInputProps,
        bookInputProps,
        pageInputProps,
        sourceTypeInputProps,
        ...rest,
      }}
    />
  );
}

export default SourceSection;
