diff --git a/.dumi/hooks/useLayoutState.ts b/.dumi/hooks/useLayoutState.ts index e69486fcc6..45b3bec518 100644 --- a/.dumi/hooks/useLayoutState.ts +++ b/.dumi/hooks/useLayoutState.ts @@ -1,6 +1,6 @@ import { startTransition, useState } from 'react'; -const useLayoutState = ( +const useLayoutState: typeof useState = ( ...args: Parameters> ): ReturnType> => { const [state, setState] = useState(...args); diff --git a/.dumi/pages/index/components/Theme/ThemePicker.tsx b/.dumi/pages/index/components/Theme/ThemePicker.tsx index 328adcd625..7e73594b65 100644 --- a/.dumi/pages/index/components/Theme/ThemePicker.tsx +++ b/.dumi/pages/index/components/Theme/ThemePicker.tsx @@ -101,7 +101,7 @@ export default function ThemePicker(props: ThemePickerProps) { onChange?.(theme); }} > - + {theme} {locale[theme as keyof typeof locale]} diff --git a/.dumi/theme/common/Color/ColorStyle.tsx b/.dumi/theme/common/Color/ColorStyle.tsx index 12c05ec7d1..218cde0f46 100644 --- a/.dumi/theme/common/Color/ColorStyle.tsx +++ b/.dumi/theme/common/Color/ColorStyle.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { Global, css } from '@emotion/react'; import { useTheme } from 'antd-style'; -const gray = { +const gray: { [key: number]: string } = { 1: '#fff', 2: '#fafafa', 3: '#f5f5f5', @@ -25,7 +25,7 @@ const ColorStyle = () => { if (index <= 10) { return ` .palette-${color}-${index} { - background: ${token[`${color}-${index}`]}; + background: ${(token as any)[`${color}-${index}`]}; } ${makePalette(color, index + 1)} `; diff --git a/.dumi/theme/common/DirectionIcon.tsx b/.dumi/theme/common/DirectionIcon.tsx index 786d35de8a..07f0aa6ac0 100644 --- a/.dumi/theme/common/DirectionIcon.tsx +++ b/.dumi/theme/common/DirectionIcon.tsx @@ -7,7 +7,7 @@ const ltrD = const rtlD = 'M256 64l512 0 0 128-128 0 0 768-128 0 0-768-128 0 0 768-128 0 0-448c-123.712 0-224-100.288-224-224s100.288-224 224-224zM960 896l-256-224 256-224z'; -const DirectionIcon: React.FC<{ direction: DirectionType }> = (props) => ( +const DirectionIcon: React.FC<{ direction: DirectionType; className?: string }> = (props) => ( diff --git a/.dumi/theme/layouts/GlobalLayout.tsx b/.dumi/theme/layouts/GlobalLayout.tsx index 6425b54d1d..9a93813a2c 100644 --- a/.dumi/theme/layouts/GlobalLayout.tsx +++ b/.dumi/theme/layouts/GlobalLayout.tsx @@ -45,7 +45,7 @@ const getAlgorithm = (themes: ThemeName[] = []) => } return null; }) - .filter((item) => item); + .filter((item) => item) as typeof antdTheme.darkAlgorithm[]; const GlobalLayout: React.FC = () => { const outlet = useOutlet(); @@ -109,7 +109,7 @@ const GlobalLayout: React.FC = () => { setSiteState({ theme: _theme, direction: _direction === 'rtl' ? 'rtl' : 'ltr', - bannerVisible: storedBannerVisibleLastTime ? storedBannerVisible : true, + bannerVisible: storedBannerVisibleLastTime ? !!storedBannerVisible : true, }); // Handle isMobile updateMobileMode(); diff --git a/.dumi/theme/layouts/ResourceLayout/AffixTabs.tsx b/.dumi/theme/layouts/ResourceLayout/AffixTabs.tsx index 69d8ef1e6a..f5c32e483a 100644 --- a/.dumi/theme/layouts/ResourceLayout/AffixTabs.tsx +++ b/.dumi/theme/layouts/ResourceLayout/AffixTabs.tsx @@ -57,7 +57,7 @@ const AffixTabs: React.FC = () => { const containerRef = React.useRef(null); const idsRef = React.useRef([]); const [loaded, setLoaded] = React.useState(false); - const [fixedId, setFixedId] = React.useState(null); + const [fixedId, setFixedId] = React.useState(undefined); const { styles: { affixTabs, affixTabsFixed, span }, @@ -100,7 +100,7 @@ const AffixTabs: React.FC = () => { } } - setFixedId(null); + setFixedId(undefined); } return throttle(doSync); diff --git a/.dumi/theme/slots/Header/More.tsx b/.dumi/theme/slots/Header/More.tsx index 93904239fd..d1abf2f5c0 100644 --- a/.dumi/theme/slots/Header/More.tsx +++ b/.dumi/theme/slots/Header/More.tsx @@ -37,7 +37,7 @@ const Community: React.FC = () => { ); }; -export const getEcosystemGroup = (): MenuProps['items'] => [ +export const getEcosystemGroup = (): Exclude => [ { label: ( diff --git a/.dumi/theme/slots/Header/Navigation.tsx b/.dumi/theme/slots/Header/Navigation.tsx index 597dc1fd31..61860b721a 100644 --- a/.dumi/theme/slots/Header/Navigation.tsx +++ b/.dumi/theme/slots/Header/Navigation.tsx @@ -215,7 +215,8 @@ export default ({ label: ( (a.frontmatter.date > b.frontmatter.date ? -1 : 1))[0].link, + blogList.sort((a, b) => (a.frontmatter?.date > b.frontmatter?.date ? -1 : 1))[0] + .link, isZhCN, search, )} diff --git a/.dumi/theme/slots/Header/SwitchBtn.tsx b/.dumi/theme/slots/Header/SwitchBtn.tsx index c670de349c..c54d2e0d4c 100644 --- a/.dumi/theme/slots/Header/SwitchBtn.tsx +++ b/.dumi/theme/slots/Header/SwitchBtn.tsx @@ -11,6 +11,7 @@ export interface LangBtnProps { value: 1 | 2; pure?: boolean; onClick?: React.MouseEventHandler; + ['aria-label']?: string; } const BASE_SIZE = '1.2em'; diff --git a/.dumi/theme/slots/Header/index.tsx b/.dumi/theme/slots/Header/index.tsx index 39852aa649..9850087a01 100644 --- a/.dumi/theme/slots/Header/index.tsx +++ b/.dumi/theme/slots/Header/index.tsx @@ -30,6 +30,11 @@ const locales = { shortMessage: '支付宝语雀 · 大学生公益计划火热进行中!', more: '了解更多', }, + en: { + message: '', + shortMessage: '', + more: '', + }, }; const useStyle = createStyles(({ token, css }) => {