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 inline styles #456

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open

Remove inline styles #456

wants to merge 6 commits into from

Conversation

liza-pizza
Copy link

Removes all inline styles that can be written into the less files instead. There is the exception of those in idresolver.views and template.views namespaces but ,if I am correct ,they cannot be built into less files.

This resolves #316

Copy link
Member

@yochannah yochannah left a comment

Choose a reason for hiding this comment

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

@liza-pizza thanks so much for this PR 😁 I haven't gotten around to fully reviewing it yet - but first off, could you format the less when you get a chance? Usually I do this with the atom beautify plugin (since I use atom as my text editor), but any other text editor auto-tidy plugin would be fine too.

Edit to add: by "format" I mean make the indentation all uniform, e.g.

// not great
.someClass {
color: purple;
.childClass{background-color:yellow}
}

//better
.someClass {
  color: purple;
  .childClass {
     background-color:yellow;
  }
}

Let me know if that isn't clear!

@liza-pizza
Copy link
Author

I hope this is enough for now. Do let me know if there are any errors to correct.
Thanks for your patience. 😁

@yochannah yochannah requested a review from heralden January 20, 2020 12:53
Copy link
Member

@heralden heralden left a comment

Choose a reason for hiding this comment

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

Thanks for working on this! It's always tricky to get into a new CSS codebase, especially one where we use a different syntax (hiccup) for HTML.

There are some selectors which could be more specific to the element, instead of global.
Some selectors also missed edge cases which you probably didn't notice.

It would be great if you could look into my comments.

@@ -46,8 +46,7 @@
(not (contains? registry current-mine))
{:db (assoc db-with-registry :current-mine :default)
:dispatch [:messages/add
{:markup [:span (str "Your mine has been changed to the default as your selected mine '" (name current-mine) "' was not present in the registry.")]
:style "warning"}]}
Copy link
Member

Choose a reason for hiding this comment

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

Could you revert this change? It's by chance called :style but not an inline style in this instance.

@@ -140,3 +140,8 @@ input.form-control:focus {
label {
color: @body-foreground-color;
}

.col-xs-3 {
Copy link
Member

Choose a reason for hiding this comment

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

I think we should have something more specific here, probably in enrichment.less instead.
If you can't find a good way to target the element, coming up with a new suitable class name for the element is fine as well.

@@ -38,8 +38,7 @@
[:span.markup markup]
[:span.controls
[:button.btn.btn-default.btn-xs.btn-raised
{:on-click (fn [] (dispatch [:messages/remove id]))
:style {:margin 0}} "X"]]])}))
Copy link
Member

Choose a reason for hiding this comment

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

I can't see that margin: 0 is added back via the CSS, and in this case it makes a visual difference.
Could you add it to alerts.less?

@@ -43,6 +43,7 @@
.icon {
color: @cta-color-text;
fill: @cta-color-text;
position: absolute;
Copy link
Member

Choose a reason for hiding this comment

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

This seems to break the positioning of icons for some buttons elsewhere.
Could you instead add a more specific rule to templates.less, under .constraint-container?

@@ -353,6 +354,11 @@ button.btn, button.cta {
}
}

Copy link
Member

Choose a reason for hiding this comment

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

I don't think many of these selectors added to site.less make much sense as global styles.

Each "component" generally have their own less source file. In the case of .container-fluid.results, you could add this styling to the less/components/results.less file instead.

Could you go through the selectors you added to site.less and see if there exist a more suitable less file to place them? There's usually a top-level class name that these page-specific styles will be nested under. Don't hesitate to create new class names if you feel this is necessary.

@@ -174,6 +174,10 @@

div.value {}
}

.col-xs-2 {
Copy link
Member

Choose a reason for hiding this comment

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

This is too specific. What if we changed the markup to use .col-xs-3 instead? We would still want the rule to work.

@@ -118,6 +118,11 @@
.allresults {
display: flex;
flex-direction: column;

.feature {
Copy link
Member

Choose a reason for hiding this comment

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

Excellent, this is what I want to see more of [=

@@ -395,6 +397,7 @@ div.column-container {
.qb-label {
padding-left: 0;
white-space: nowrap;
margin-left: 5px;
Copy link
Member

Choose a reason for hiding this comment

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

.qb-label is also used for query builder attributes, where we don't want the margin-left (see src/cljs/bluegenes/pages/querybuilder/views.cljs:83).
Maybe split it into .qb-attribute-label where the margin-left is the only difference, changing the attributes to use this class instead?

}


.icon.icon-globe {
Copy link
Member

Choose a reason for hiding this comment

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

I also feel this is too general. Try moving this into mymine.less to target that use of icon-globe specifically.

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

Successfully merging this pull request may close these issues.

Remove inline styles from BlueGenes
3 participants