import React from 'react';
import { RouteProps } from '../@types';
import SubHead from './SubHead'

interface Props extends RouteProps {
  layer: any,
  currentRoute?: Function
}

function Combination(props: Props) {
  let args = {...props}
  let Layer = args.layer
  let cls = args.className
  delete args.layer
  delete args.className
  delete args.currentRoute

  props.currentRoute && props.currentRoute(props)
  return (
    <div className={cls}>
      <SubHead {...args} />
      <Layer {...args} />
    </div>
  )
}

export default Combination