Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions packages/components/docs/docs/theme/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@ import React, { useEffect } from 'react';

import Theme from 'rspress/theme';
import { useDark, useLocation } from 'rspress/runtime';
import { Button } from '@douyinfe/semi-ui';
import { Button, LocaleProvider } from '@douyinfe/semi-ui';
import { zh_CN, en_US } from '@coze-arch/coze-design/locales';
import { CDLocaleProvider, zhCN, enUS } from '@coze-arch/coze-design';
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- 保证css样式顺序和bot一致
const a = Button;

// 以下展示所有的 Props
const Layout = () => {
// for semi dark mode
const dark = useDark();

const currentLocale = navigator.language ?? 'en-US';

useEffect(() => {
if (dark) {
document.body.setAttribute('theme-mode', 'dark');
Expand All @@ -21,15 +26,19 @@ const Layout = () => {
const { pathname } = useLocation();

return (
<Theme.Layout
bottom={
pathname.startsWith('/resource/') ? (
<div className="text-xs text-gray-500 text-center p-1">
部分内容为AI自动生成,注意甄别,如有错误请及时反馈
</div>
) : null
}
/>
<CDLocaleProvider locale={currentLocale === 'en-US' ? en_US : zh_CN}>
<LocaleProvider locale={currentLocale === 'en-US' ? enUS : zhCN}>
<Theme.Layout
bottom={
pathname.startsWith('/resource/') ? (
<div className="text-xs text-gray-500 text-center p-1">
部分内容为AI自动生成,注意甄别,如有错误请及时反馈
</div>
) : null
}
/>
</LocaleProvider>
</CDLocaleProvider>
);
};

Expand Down