docs: hide banner (#46730)

* docs: hide banner

* chore: code clean

* Update GlobalLayout.tsx

Signed-off-by: lijianan <574980606@qq.com>

---------

Signed-off-by: lijianan <574980606@qq.com>
Co-authored-by: afc163 <afc163@gmail.com>
Co-authored-by: lijianan <574980606@qq.com>
This commit is contained in:
MadCcc 2024-01-02 17:01:08 +08:00 committed by GitHub
parent 17a634b6a2
commit 4920955741
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 7 deletions

View File

@ -1,5 +1,4 @@
import React, { useCallback, useEffect, useMemo, Suspense } from 'react';
import dayjs from 'dayjs';
import {
createCache,
extractStyle,
@ -102,15 +101,15 @@ const GlobalLayout: React.FC = () => {
useEffect(() => {
const _theme = searchParams.getAll('theme') as ThemeName[];
const _direction = searchParams.get('direction') as DirectionType;
const storedBannerVisibleLastTime =
localStorage && localStorage.getItem(ANT_DESIGN_NOT_SHOW_BANNER);
const storedBannerVisible =
storedBannerVisibleLastTime && dayjs().diff(dayjs(storedBannerVisibleLastTime), 'day') >= 1;
// const storedBannerVisibleLastTime =
// localStorage && localStorage.getItem(ANT_DESIGN_NOT_SHOW_BANNER);
// const storedBannerVisible =
// storedBannerVisibleLastTime && dayjs().diff(dayjs(storedBannerVisibleLastTime), 'day') >= 1;
setSiteState({
theme: _theme,
direction: _direction === 'rtl' ? 'rtl' : 'ltr',
bannerVisible: storedBannerVisibleLastTime ? !!storedBannerVisible : true,
// bannerVisible: storedBannerVisibleLastTime ? !!storedBannerVisible : true,
});
// Handle isMobile
updateMobileMode();

View File

@ -12,7 +12,7 @@ export interface SiteContextProps {
const SiteContext = React.createContext<SiteContextProps>({
isMobile: false,
bannerVisible: true,
bannerVisible: false,
direction: 'ltr',
theme: ['light'],
updateSiteConfig: () => {},