import { CommonProps } from '@/@types/common'
import { Meta } from '@/@types/routes'
import Container from '@/components/shared/Container'
import { useParams, useSearchParams } from 'react-router-dom'
import Grid from './Grid'

export interface FormProps extends CommonProps, Meta {
  listFormCode?: string
}

const List = (props?: FormProps) => {
  const params = useParams()
  const _listFormCode = props?.listFormCode ?? params?.listFormCode ?? ''
  const [searchParams] = useSearchParams()

  return _listFormCode ? (
    <Container>
      <Grid listFormCode={_listFormCode} searchParams={searchParams} isSubForm={false}></Grid>
    </Container>
  ) : (
    <></>
  )
}

export default List
