From 4901e036eed35971228b95072aeccd8f6273113d Mon Sep 17 00:00:00 2001 From: Anastasiia Date: Thu, 18 Apr 2024 10:53:50 +0300 Subject: [PATCH] MSP-3105 add holderRender for theme in Layout for message --- src/components/Layout/index.tsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/components/Layout/index.tsx b/src/components/Layout/index.tsx index fbaaaeb..9a5aa6e 100644 --- a/src/components/Layout/index.tsx +++ b/src/components/Layout/index.tsx @@ -1,6 +1,6 @@ import { LockOutlined, ProfileOutlined } from '@ant-design/icons' -import { Divider, Layout, Menu, Spin } from 'antd' -import { useEffect, useState } from 'react' +import { ConfigProvider, Divider, Layout, Menu, Spin } from 'antd' +import { useContext, useEffect, useState } from 'react' import { Navigate, Outlet, useLocation, useNavigate } from 'react-router-dom' import { localStorageKeys } from '@constants/localStorageKeys.ts' @@ -38,6 +38,7 @@ const LayoutComponent = () => { const { status } = useAppSelector((state) => state.profileReducer) const location = useLocation() const { hasPermission } = useRole() + const { theme } = useContext(ConfigProvider.ConfigContext) const userToken = LocalStorage.get(localStorageKeys.USER_TOKEN) @@ -73,6 +74,16 @@ const LayoutComponent = () => { } ] + useEffect(() => { + ConfigProvider.config({ + holderRender: (children) => ( + + {children} + + ), + }) + }, [theme]) + useEffect(() => { if (userToken) { dispatch(fetchProfile())