This commit is contained in:
Trance-0
2025-10-27 15:12:02 -05:00
parent f634254bca
commit 1476e7f1c2
4 changed files with 16 additions and 17 deletions

View File

@@ -2,16 +2,20 @@
// sample code from https://docsearch.algolia.com/docs/docsearch
import { DocSearch } from '@docsearch/react';
import {useTheme} from 'next-themes';
import '@docsearch/css';
function AlgoliaSearch({ darkMode }: { darkMode: boolean }) {
function AlgoliaSearch () {
const {theme} = useTheme();
const darkMode = theme === 'dark';
console.log("darkMode", darkMode);
return (
<DocSearch
appId={process.env.NEXT_SEARCH_ALGOLIA_APP_ID || 'NKGLZZZUBC'}
indexName={process.env.NEXT_SEARCH_ALGOLIA_INDEX_NAME || 'notenextra_trance_0'}
apiKey={process.env.NEXT_SEARCH_ALGOLIA_API_KEY || '727b389a61e862e590dfab9ce9df31a2'}
theme={darkMode ? 'dark' : 'light'}
theme={darkMode===false ? 'light' : 'dark'}
/>
);
}