File size: 503 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import React from 'react';

import { IndexContext } from '../lib/IndexContext';
import { useIndex } from '../lib/useIndex';

import type { UseIndexProps } from '../lib/useIndex';

export type IndexProps = UseIndexProps & {
  children?: React.ReactNode;
};

export function Index({ children, ...props }: IndexProps) {
  const index = useIndex(props);

  if (index.getHelper() === null) {
    return null;
  }

  return (
    <IndexContext.Provider value={index}>{children}</IndexContext.Provider>
  );
}