[WEB-1597] fix: toast themes. (#4781)

This commit is contained in:
Prateek Shourya 2024-06-12 18:48:45 +05:30 committed by GitHub
parent a0152cab55
commit d64cc44225
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,5 @@
"use client"; "use client";
import { FC, ReactNode } from "react"; import { FC, ReactNode } from "react";
import dynamic from "next/dynamic"; import dynamic from "next/dynamic";
import { AppProgressBar } from "next-nprogress-bar"; import { AppProgressBar } from "next-nprogress-bar";
@ -23,16 +24,20 @@ export interface IAppProvider {
children: ReactNode; children: ReactNode;
} }
const ToastWithTheme = () => {
const { resolvedTheme } = useTheme();
return <Toast theme={resolveGeneralTheme(resolvedTheme)} />;
};
export const AppProvider: FC<IAppProvider> = (props) => { export const AppProvider: FC<IAppProvider> = (props) => {
const { children } = props; const { children } = props;
// themes // themes
const { resolvedTheme } = useTheme();
return ( return (
<> <>
<AppProgressBar height="4px" color="#3F76FF" options={{ showSpinner: false }} shallowRouting /> <AppProgressBar height="4px" color="#3F76FF" options={{ showSpinner: false }} shallowRouting />
<Toast theme={resolveGeneralTheme(resolvedTheme)} />
<StoreProvider> <StoreProvider>
<ThemeProvider themes={["light", "dark", "light-contrast", "dark-contrast", "custom"]} defaultTheme="system"> <ThemeProvider themes={["light", "dark", "light-contrast", "dark-contrast", "custom"]} defaultTheme="system">
<ToastWithTheme />
<InstanceWrapper> <InstanceWrapper>
<StoreWrapper> <StoreWrapper>
<CrispWrapper> <CrispWrapper>