import Filter from './filter';
import {FC, ReactNode} from 'react';
import {context, pageContext, useContextReducer} from './context';
import TableList from './table';
import {PageProvider} from '@components';

const MenuProvider: FC<{children: ReactNode}> = function({children}) {
  const state = useContextReducer();

  const {Provider} = context;

  return <Provider value={state}>{children}</Provider>;
};

const Menu: FC = function() {
  return (
    <MenuProvider>
      <PageProvider context={pageContext}>
        <section className='content-main'>
          <Filter />
          <TableList />
        </section>
      </PageProvider>
    </MenuProvider>
  );
};

export default Menu;
