Browse Source

fix : use the search param in url for searching duas

master
sina_sajjadi 2 weeks ago
parent
commit
9fca93b5a3
  1. 26
      src/components/context/search-context.tsx
  2. 2
      src/pages/_app.tsx

26
src/components/context/search-context.tsx

@ -1,26 +0,0 @@
import React, { createContext, useContext, useState, ReactNode } from 'react';
interface SearchContextProps {
searchTerm: string;
setSearchTerm: (term: string) => void;
}
const SearchContext = createContext<SearchContextProps | undefined>(undefined);
export const SearchProvider: React.FC<{ children: ReactNode }> = ({ children }) => {
const [searchTerm, setSearchTerm] = useState<string>('');
return (
<SearchContext.Provider value={{ searchTerm, setSearchTerm }}>
{children}
</SearchContext.Provider>
);
};
export const useSearch = (): SearchContextProps => {
const context = useContext(SearchContext);
if (!context) {
throw new Error('useSearch must be used within a SearchProvider');
}
return context;
};

2
src/pages/_app.tsx

@ -24,7 +24,6 @@ function App({ Component, pageProps }: AppProps) {
<FontSettingsProvider>
<UIProvider>
<AudioProvider>
<SearchProvider>
<DefaultSeo />
<div dir={isRtl ? "rtl" : "ltr"}>
{" "}
@ -43,7 +42,6 @@ function App({ Component, pageProps }: AppProps) {
</div>
<ManagedModal />
</div>
</SearchProvider>
</AudioProvider>
</UIProvider>
</FontSettingsProvider>

Loading…
Cancel
Save