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

Bootstrap/Ant style collisions #3258

Closed
ranbena opened this issue Jan 7, 2019 · 8 comments
Closed

Bootstrap/Ant style collisions #3258

ranbena opened this issue Jan 7, 2019 · 8 comments
Assignees
Labels
Frontend: React Frontend codebase migration to React Frontend

Comments

@ranbena
Copy link
Contributor

ranbena commented Jan 7, 2019

Redash is in the midst of migrating from Bootstrap to Ant, and from Angular to React.
Loading both component libraries causes collisions, since both use some identical less variable names, resulting mostly in wrong colors being displayed.

Bootstrap cannot be fully swapped until React migration is complete (Ant doesn't offer Angular components) so a middle ground must be found.

Currently defining specific css overrides, which problematic in many ways. Need better solution.

@ranbena ranbena self-assigned this Jan 7, 2019
@arikfr arikfr added the Frontend: React Frontend codebase migration to React label Jan 7, 2019
@ranbena
Copy link
Contributor Author

ranbena commented Jan 7, 2019

Seems importing css instead of less files in ant.less resolves this.
I think it's good enough for now.

@ranbena ranbena closed this as completed Jan 7, 2019
@arikfr
Copy link
Member

arikfr commented Jan 8, 2019

@ranbena the problem with importing the css version is that our overrides won't apply:

// Overwritting Ant Design defaults to fit into Redash current style
@font-family-no-number : @redash-font;
@font-family : @redash-font;
@code-family : @redash-font;
@border-radius-base : @redash-input-radius;
@border-color-base : #e8e8e8;
@primary-color : @blue;
// Fix for disabled button styles inside Tooltip component.
// Tooltip wraps disabled buttons with `<span>` and moves all styles
// and classes to that `<span>`. This resets all button styles and
// turns it into simple inline element (because now it's wrapper is a button)
.btn {
button[disabled] {
-moz-appearance: none !important;
-webkit-appearance: none !important;
appearance: none !important;
border: 0 !important;
outline: none !important;
background: transparent !important;
margin: 0 !important;
padding: 0 !important;
}
}
// Fix for Ant dropdowns when they are used in Boootstrap modals
.ant-dropdown-in-bootstrap-modal {
z-index: 1050;
}

No?

@gabrieldutra
Copy link
Member

I agree with @arikfr on this, the issue still exists, although we can avoid it for some components that don't require variable override.

@gabrieldutra
Copy link
Member

gabrieldutra commented Jan 9, 2019

I tested migrating all less files related to #3209 and some differences are noticeable (e.g.: font for form labels and inputs). My first test was with buttons, so that wasn't annoying.

I think what we can try do to at least give it some time is somehow isolate Ant less processing from the rest. I did a few tests with webpack.config.js and it seemed possible. It seems to create a variable-isolated tree when I do sth like this:

// webpack.config.js (line 29)
  entry: {
    app: [
      "./client/app/index.js",
      "./client/app/assets/less/main.less",
      "./client/app/assets/less/redash/ant.less"
    ],
    server: ["./client/app/assets/less/server.less"]
  }

With that we can create a new tree without including bootstrap on those paths. WDYT? 😄

@arikfr
Copy link
Member

arikfr commented Jan 9, 2019

@gabrieldutra if this works, it seems like the best solution indeed.

@gabrieldutra gabrieldutra reopened this Jan 9, 2019
@gabrieldutra
Copy link
Member

@ranbena what do you think? I'm not very experienced with Less (or Redash styling files), but I can try to reorganize those files.

My concerns are all related to what we will see after this division. Till now we've been coding based on a mix of styles and once we properly divide it some page/component styles could break. A very good look on pages and components (mainly the ones which use Ant) will be important.

@ranbena
Copy link
Contributor Author

ranbena commented Jan 12, 2019

Be assured @arikfr and I will take a close look at all pages and components prior to approval 🕵🏻‍♂️

@arikfr
Copy link
Member

arikfr commented Jan 15, 2019

Can we close this now?

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

No branches or pull requests

3 participants