import React, { FC } from 'react'

import { PublicLayout } from './public'
import { AdminLayout } from './admin'

import { ILayout } from './interfaces'

import 'bootstrap/dist/css/bootstrap.min.css'
import './scss/style.scss'

interface ILayouts {
  [key: string]: React.FC<ILayout>;
}

const layouts: ILayouts = {
  PublicLayout,
  AdminLayout
}

interface IDynamicLayout {
  tag: string,
  children: React.ReactNode
}

const DynamicLayout: FC<IDynamicLayout> = (props) => {
  const { tag, children } = props

  const TagName = layouts[tag]
  return <TagName>{children}</TagName>
}

export {
  DynamicLayout
}


