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

Messing up the styles in an existing project #50

Closed
MihaiPerju opened this issue Sep 2, 2018 · 17 comments
Closed

Messing up the styles in an existing project #50

MihaiPerju opened this issue Sep 2, 2018 · 17 comments

Comments

@MihaiPerju
Copy link

I have a project and I wanted to integrate this query builder into it, but it messes up all my styles. Can anyone help me to find a way to "isolate" query builder own styles from the rest of the styles from the application?

@sitch
Copy link

sitch commented Sep 19, 2018

I'm having the same issue. It's due to antd being semversioned at v2.12.2 and currently antd is at v3.9.

@sitch
Copy link

sitch commented Sep 19, 2018

I tried yarn add https://github.com/ukrbublik/react-awesome-query-builder.git#antd-3 but it didn't seem to work

@ukrbublik
Copy link
Owner

Can you provide more info, what kind of styles are messed up, maybe screenshot, page example?

@sitch
Copy link

sitch commented Sep 19, 2018

Tons of minor things from menu sizing, duplication of breadcrumb icons, etc. I also used yarn add https://github.com/joskoanicic/react-awesome-query-builder.git#feature/antd3_react16 to pull in the newer v3.9 branch (built it by going into /node_modules/react-awesome-query-build/ and running yarn) but was having what seemed to be dependency issues with transit / Immutable, getting an error that Map was not an instance of Map in PropTypes. Seems like this packages tight coupling with antd / Immutable / redux makes it challenging to use without regular updates... :(

@that-jpg
Copy link

The antd have global styles that can 'leak' into the application;

See:

I don't think that the update will fix the problem because its not 'fixed' by the antd team, the sad part it is that this issue is not a priority for them, so the fix may take some time.

@ukrbublik
Copy link
Owner

What if move antd from dependencies to peerDependencies in this project?

@ukrbublik
Copy link
Owner

Also, as you can see at demo, I import css/denormalize.scss and css/reset.scss to fix some global styles after antd.
Have you tried this?

@that-jpg
Copy link

Yep, but my project is on a stage that we would had just to much to fix.
And I use CSS-in-JS too, this increase a little the complexity of adding 'global' styles.

PS, you answered my comment pretty fast, thank you for taking the time :)

@vitali-svishchou
Copy link

it would be nice to have an opportunity not to add any styling at all and let developers to define their own =)

cause currently, as others in this conversation, after adding react-awesome-query-builder to the project a lot of styles became broken because of antDesign

@ukrbublik
Copy link
Owner

@vitali-svishchou If I exclude antd from this lib, I'll have to rewtite widgets without using antd. And let developers choose between antd widgets and "vanilla" ones.
If somebody helps me with this, it would be great. (it's not complex, I just don't have much time for now)

@bilal-rao
Copy link

bilal-rao commented Dec 17, 2018

@ukrbublik I have same issue it messes up all my styles can i isolate query builder's styles , is there any workaround ?

@vitali-svishchou
Copy link

@bilal-rao , not really clear one, but it works - import any component of react-awesome-query-builder before importing main styles of your application. in this case you will rewrite antd styles by yours, but it'll complitely breake styles of react-awesome-query-builder

@bilal-rao
Copy link

@vitali-svishchou Thanks

@OrDuan
Copy link

OrDuan commented Dec 24, 2018

Yes, this makes it impossible to integrate into existing project, but thanks to @vitali-svishchou comments I found the workaround:
I imported everything in my App.js file (which loads first), then imported react-awesome-query-builder just before every other style, then exported the Query & Builder from the same file(App.js) and then Imported and reused them whenever needed.

While this is super awkward, it worked.

@ryanau
Copy link

ryanau commented Feb 6, 2019

@OrDuan We ran into the same issue and your solution works! But instead of importing and re-exporting react-awesome-query-builder from App.jsx, we just have import { Query, Builder } from 'react-awesome-query-builder' at the top of our App.jsx file and we can now use import { Query, Builder } from 'react-awesome-query-builder' in other parts of the app as we normally would.

@bandersen22000
Copy link
Contributor

I have suggested a solution here, but you have to fork the repo.

@ukrbublik
Copy link
Owner

See latest version: import 'react-awesome-query-builder/css/antd.less';

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

9 participants