Skip to content

Commit 7b12d95

Browse files
authored
fix: add StyleProvider for css (#2666)
1 parent 818dc51 commit 7b12d95

File tree

2 files changed

+11
-27
lines changed

2 files changed

+11
-27
lines changed

src/css/custom.scss

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -372,25 +372,6 @@ textarea {
372372
display: flex;
373373
width: 100%;
374374
}
375-
.ant-btn {
376-
font-size: 14px;
377-
height: 32px;
378-
padding: 0px 15px;
379-
border-radius: 6px;
380-
outline: none;
381-
position: relative;
382-
display: inline-flex;
383-
gap: 8px;
384-
align-items: center;
385-
justify-content: center;
386-
white-space: nowrap;
387-
text-align: center;
388-
background-image: none;
389-
cursor: pointer;
390-
transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
391-
user-select: none;
392-
touch-action: manipulation;
393-
}
394375

395376
.ant-dropdown .ant-dropdown-menu {
396377
background-color: var(--color-bg-1);

src/theme/DocRoot/index.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import DocRootLayout from "@theme/DocRoot/Layout";
1212
import NotFoundContent from "@theme/NotFound/Content";
1313
import type { Props } from "@theme/DocRoot";
1414
import styles from "./style.module.scss";
15-
15+
import { StyleProvider, createCache } from "@ant-design/cssinjs";
16+
const cache = createCache();
1617
export default function DocRoot(props: Props): ReactNode {
1718
const currentDocRouteMetadata = useDocRootMetadata(props);
1819
if (!currentDocRouteMetadata) {
@@ -22,12 +23,14 @@ export default function DocRoot(props: Props): ReactNode {
2223
}
2324
const { docElement, sidebarName, sidebarItems } = currentDocRouteMetadata;
2425
return (
25-
<HtmlClassNameProvider className={clsx(ThemeClassNames.page.docsDocPage)}>
26-
<div className={styles.fakeBg}></div>
27-
<div className={styles.cell}></div>
28-
<DocsSidebarProvider name={sidebarName} items={sidebarItems}>
29-
<DocRootLayout>{docElement}</DocRootLayout>
30-
</DocsSidebarProvider>
31-
</HtmlClassNameProvider>
26+
<StyleProvider hashPriority="high" cache={cache}>
27+
<HtmlClassNameProvider className={clsx(ThemeClassNames.page.docsDocPage)}>
28+
<div className={styles.fakeBg}></div>
29+
<div className={styles.cell}></div>
30+
<DocsSidebarProvider name={sidebarName} items={sidebarItems}>
31+
<DocRootLayout>{docElement}</DocRootLayout>
32+
</DocsSidebarProvider>
33+
</HtmlClassNameProvider>
34+
</StyleProvider>
3235
);
3336
}

0 commit comments

Comments
 (0)