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

const UserProvider: ChildrenFC = function({children}) {
  const {Provider} = context;
  const state = useContextReducer();

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

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

export default User;
