'use client' // sample code from https://docsearch.algolia.com/docs/docsearch import { DocSearch } from '@docsearch/react'; import {useTheme} from 'next-themes'; import '@docsearch/css'; function AlgoliaSearch () { const {theme, systemTheme} = useTheme(); const darkMode = theme === 'dark' || (theme === 'system' && systemTheme === 'dark'); // console.log("darkMode", darkMode); return ( // DocSearch lets you sanitize results before render. Filter out hits that don’t have a URL and give lvl0 a safe fallback. items .filter((i) => typeof i.url === 'string' && i.url) // drop records with null/empty url .map((i) => ({ ...i, hierarchy: { ...i.hierarchy, // ensure strings for all places DocSearch prints text lvl0: i.hierarchy?.lvl0 ?? i.hierarchy?.lvl1 ?? 'Documentation', }, })) } // END OF CODE GENERATED BY AI /> ); } export default AlgoliaSearch;