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

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

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

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

export default Goods;
