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

How to import Ant Design components without default class names? #18963

Closed
1 task done
amerllica opened this issue Sep 23, 2019 · 2 comments
Closed
1 task done

How to import Ant Design components without default class names? #18963

amerllica opened this issue Sep 23, 2019 · 2 comments
Assignees

Comments

@amerllica
Copy link

amerllica commented Sep 23, 2019

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

https://stackoverflow.com/questions/58070076

Steps to reproduce

<Title className="root-23-07">....

What is expected?

I wanna my class name CSS override the default.

What is actually happening?

I pass className to the Title component of Typography but the default component class name is .ant-typography and its less file CSS selection started with h4.ant-typography and it causes my class name .root-23-07 doesn't override the default. actually CSS selection with tag name ruins everything.

Environment Info
antd 3.23.4
React 16.9.0
System Mac OSX
Browser Google Chrome 77

If I import the Ant Design component without its default class name I definitely can reach my goal.

@afc163
Copy link
Member

afc163 commented Sep 24, 2019

h1.root-23-07 {
  font-size: 100px;
  color: red;
}

https://codesandbox.io/s/reverent-hypatia-hyqkp

@afc163 afc163 closed this as completed Sep 24, 2019
@amerllica
Copy link
Author

Dear @afc163, Thanks for your effort to help me and I don't know why you close my issue, Actually, its Ant-Design issue.

I know about CSS priority numbers, the [1, 10, 100, 1000] and I know when you add an h1 to the head of class name the priority will be equal to the Ant-Design class name selecting so my CSS will override the default CSS of And-Design.

But I'm using ReactJSS for generating CSS and in JSS solution I cannot add an h1 or anything else.

It's a bug for Ant-Design. because there are some situations that Developer's CSS cannot override the default CSS of Ant-Design.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants