Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: tailwindcss reset Image style #39914

Merged
merged 3 commits into from Dec 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions components/image/style/index.ts
Expand Up @@ -198,6 +198,13 @@ export const genImagePreviewStyle: GenerateStyle<ImageToken> = (token: ImageToke
...genBoxStyle(),
transition: `transform ${motionDurationSlow} ${motionEaseOut} 0s`,

// https://github.com/ant-design/ant-design/issues/39913
// TailwindCSS will reset img default style.
// Let's set back.
display: 'flex',
yoyo837 marked this conversation as resolved.
Show resolved Hide resolved
justifyContent: 'center',
alignItems: 'center',

'&::before': {
display: 'inline-block',
width: 1,
Expand Down
2 changes: 1 addition & 1 deletion docs/react/compatible-style.en-US.md
Expand Up @@ -7,7 +7,7 @@ Ant Design supports the last 2 versions of modern browsers. If you need to be co

### Compatible adjustment

Ant Design default using CSS-in-JS with `:where` Selector to reduce priority to avoid user additional adjust style cost when updating. If you want to support old browser, you can use `@ant-design/cssinjs` to adjust this behavior (Please note keep version align with antd):
Ant Design default using CSS-in-JS with `:where` Selector to reduce priority to avoid user additional adjust style cost when updating. If you want to support old browser (or some other CSS framework selector priority conflict like TailwindCSS), you can use `@ant-design/cssinjs` to adjust this behavior (Please note keep version align with antd):

```tsx
import React from 'react';
Expand Down
2 changes: 1 addition & 1 deletion docs/react/compatible-style.zh-CN.md
Expand Up @@ -7,7 +7,7 @@ Ant Design 支持最近 2 个版本的现代浏览器。如果你需要兼容旧

### `:where` 选择器

Ant Design 的 CSS-in-JS 默认通过 `:where` 选择器降低 CSS Selector 优先级,以减少用户升级时额外调整自定义样式成本。在某些场景下你如果需要支持的旧版浏览器,你可以使用 `@ant-design/cssinjs` 取消默认的降权操作(请注意版本保持与 antd 一致):
Ant Design 的 CSS-in-JS 默认通过 `:where` 选择器降低 CSS Selector 优先级,以减少用户升级时额外调整自定义样式成本。在某些场景下你如果需要支持的旧版浏览器(或者如 TailwindCSS 优先级冲突),你可以使用 `@ant-design/cssinjs` 取消默认的降权操作(请注意版本保持与 antd 一致):

```tsx
import React from 'react';
Expand Down