forked from ant-design/ant-design
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Mix style framework support (ant-design#48229)
* chore: add layer mark * docs: enable @layer for test * docs: add doc of third part lib * docs: update order * Update docs/react/compatible-style.zh-CN.md Co-authored-by: lijianan <574980606@qq.com> Signed-off-by: 二货爱吃白萝卜 <smith3816@gmail.com> * Update docs/react/compatible-style.en-US.md Co-authored-by: lijianan <574980606@qq.com> Signed-off-by: 二货爱吃白萝卜 <smith3816@gmail.com> * docs: ssr or reset case --------- Signed-off-by: 二货爱吃白萝卜 <smith3816@gmail.com> Co-authored-by: lijianan <574980606@qq.com>
- Loading branch information
1 parent
a86a277
commit fc4bdd2
Showing
8 changed files
with
305 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,86 @@ | ||
import { css, Global } from '@emotion/react'; | ||
import React from 'react'; | ||
import { css, Global } from '@emotion/react'; | ||
import { useTheme } from 'antd-style'; | ||
import { updateCSS } from 'rc-util/lib/Dom/dynamicCSS'; | ||
|
||
export default () => { | ||
const { anchorTop } = useTheme(); | ||
|
||
React.useInsertionEffect(() => { | ||
updateCSS(`@layer global, antd;`, 'site-global', { | ||
prepend: true, | ||
}); | ||
}, []); | ||
|
||
return ( | ||
<Global | ||
styles={css` | ||
body, | ||
div, | ||
dl, | ||
dt, | ||
dd, | ||
ul, | ||
ol, | ||
li, | ||
h1, | ||
h2, | ||
h3, | ||
h4, | ||
h5, | ||
h6, | ||
pre, | ||
code, | ||
form, | ||
fieldset, | ||
legend, | ||
input, | ||
textarea, | ||
p, | ||
blockquote, | ||
th, | ||
td, | ||
hr, | ||
button, | ||
article, | ||
aside, | ||
details, | ||
figcaption, | ||
figure, | ||
footer, | ||
header, | ||
hgroup, | ||
menu, | ||
nav, | ||
section { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
@layer global { | ||
body, | ||
div, | ||
dl, | ||
dt, | ||
dd, | ||
ul, | ||
ol, | ||
li, | ||
h1, | ||
h2, | ||
h3, | ||
h4, | ||
h5, | ||
h6, | ||
pre, | ||
code, | ||
form, | ||
fieldset, | ||
legend, | ||
input, | ||
textarea, | ||
p, | ||
blockquote, | ||
th, | ||
td, | ||
hr, | ||
button, | ||
article, | ||
aside, | ||
details, | ||
figcaption, | ||
figure, | ||
footer, | ||
header, | ||
hgroup, | ||
menu, | ||
nav, | ||
section { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
ul, | ||
ol { | ||
list-style: none; | ||
} | ||
ul, | ||
ol { | ||
list-style: none; | ||
} | ||
img { | ||
vertical-align: middle; | ||
border-style: none; | ||
} | ||
img { | ||
vertical-align: middle; | ||
border-style: none; | ||
} | ||
[id] { | ||
scroll-margin-top: ${anchorTop}px; | ||
} | ||
[id] { | ||
scroll-margin-top: ${anchorTop}px; | ||
} | ||
[data-prefers-color='dark'] { | ||
color-scheme: dark; | ||
} | ||
[data-prefers-color='dark'] { | ||
color-scheme: dark; | ||
} | ||
[data-prefers-color='light'] { | ||
color-scheme: light; | ||
} | ||
`} | ||
[data-prefers-color='light'] { | ||
color-scheme: light; | ||
} | ||
} | ||
`} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.