import React from 'react';
import styled from 'styled-components';
import RangeDateFilter from './range-date-filter';
import SingleDateFilter from './single-date-filter/SingleDateFilter';

function FilterByType({
  startDate,
  setStartDate,
  setEndDate,
  endDate,
  type,
}: any) {
  if (type === 'single') {
    return (
      <SingleDateFilter
        startDate={startDate}
        setStartDate={setStartDate}
        setEndDate={setEndDate}
      />
    );
  }
  return (
    <RangeDateFilter
      startDate={startDate}
      endDate={endDate}
      setStartDate={setStartDate}
      setEndDate={setEndDate}
    />
  );
}

export default styled(FilterByType)``;
