import { FilterRenderingContextProvider } from '../FilterRenderingContext';
import React, { ReactNode, useState } from 'react';
import { WixStyleReactDefaultsOverrideProvider } from '@wix/design-system';

export interface CollectionTableToolbarsProviderProps {
  children?: ReactNode;
}

export function CollectionToolbarsProvider({
  children,
}: CollectionTableToolbarsProviderProps) {
  const [filterRenderingContext] = useState(() => ({
    location: 'toolbar' as const,
  }));

  const [wsrDefaults] = useState(() => ({
    input: {
      size: 'small' as const,
    },
    button: {
      size: 'small' as const,
    },
  }));

  return (
    <FilterRenderingContextProvider value={filterRenderingContext}>
      <WixStyleReactDefaultsOverrideProvider value={wsrDefaults}>
        {children}
      </WixStyleReactDefaultsOverrideProvider>
    </FilterRenderingContextProvider>
  );
}
