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

Remove Helper Classes from visualizations #4788

Merged
merged 20 commits into from
Apr 25, 2020
Merged

Conversation

gabrieldutra
Copy link
Member

What type of PR is this? (check all applicable)

  • Other

Description

This PR updates visualizations not to depend on helper classes such as m-b-15 or text-nowrap.

Related Tickets & Documents

--

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

--

@gabrieldutra gabrieldutra self-assigned this Apr 8, 2020
@@ -41,7 +41,7 @@ function DateTimeFormatSpecs() {
title={
<React.Fragment>
Formatting Dates and Times
<i className="fa fa-external-link m-l-5" />
<i className="fa fa-external-link" style={{ marginLeft: 5 }} />
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kravets-levko I do try to avoid using inline styling, but replacing those isolated cases with only one css rule with it was really tempting

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brilliant! That's what I always wanted to do but never had a chance 😄

@@ -70,7 +71,12 @@ export default function withControlLabel(WrappedControl) {

return (
<ControlLabel layout={layout} label={label} labelProps={labelProps} disabled={disabled}>
<WrappedControl id={labelProps.htmlFor} disabled={disabled} {...props} />
<WrappedControl
className={cx("visualization-editor-input", className)}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forced all inputs to have width: 100% to remove the w-100 classes (all the InputNumbers and Select's had this class). LMK if you see any isolated case as I didn't find any on my checks.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be no special cases, as far as I remember all editor inputs should have width: 100% and we use grid where needed

@arikfr
Copy link
Member

arikfr commented Apr 10, 2020

It doesn't matter much as you already handled it, but I wonder: assuming it's a very limited number of classes, why not just implement them in a dedicated stylesheet?

@kravets-levko
Copy link
Collaborator

@arikfr @gabrieldutra FYI - this PR is related to one of my PRs - #4588

@gabrieldutra
Copy link
Member Author

It doesn't matter much as you already handled it, but I wonder: assuming it's a very limited number of classes, why not just implement them in a dedicated stylesheet?

I was already gonna have to check what were the ones being used and I didn't want to include those classes in the lib (helper classes seem something to be defined in an "App" scope, not in a lib and there's a remote possibility of conflicts), anyway the extra work to replace them seemed to be worth it.

@restyled-io
Copy link
Contributor

restyled-io bot commented Apr 21, 2020

Hey there-

I'm a bot, here to let you know that some code in this PR might not
match the team's automated styling. I ran the team's auto-reformatting tools on
the files changed in this PR and found some differences. Those differences can
be seen in #4821.

Please see that Pull Request's description for more details.

@@ -0,0 +1,5 @@
.visualization-editor-tabs {
.ant-tabs-tab {
padding: 12px 16px;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question: why was this needed? As far as I remember, we didn't change this anywhere.

Copy link
Member Author

@gabrieldutra gabrieldutra Apr 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no direct idea (may be that we changed ant-tab style for all Redash or we may have a single conflicting variable), but without it, it looks like this on a blank project:

image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, my bad, just noticed I had antd v4 on that blank page 😬

@blue: #2196f3;
@green: #4caf50;
@orange: #ff9800;
@redash-gray: rgba(102, 136, 153, 1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since all these variables will be independent from main Redash styles (and later we're going to redefine them for Redash) - I think we should avoid using too generic names and names from Redash styles. Instead, let's prefix all variables with some namespace to clearly see that they are related to visualizations and avoid names conflicts in the future. For example, this variable may be called @visualizations-gray: rgba(102, 136, 153, 1), and later, when using library in Redash - we'll define it as @visualizations-gray: @redash-gray. Same for others.

@gabrieldutra
Copy link
Member Author

@kravets-levko I plan on merging this as soon as checks are approved in order to open a new PR with the separated package for visualizations, in case you have other comments you're welcome to make them and I'll address them in the upcoming PR 🙂.

@gabrieldutra gabrieldutra merged commit bb767f3 into master Apr 25, 2020
@gabrieldutra gabrieldutra mentioned this pull request Apr 29, 2020
1 task
@guidopetri guidopetri deleted the visualizations-css-deps branch July 22, 2023 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants