-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Refactor styles #161
Refactor styles #161
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the approach of this PR a lot!
I believe the code needs some additional comments to help the reader understand what exactly happens happens and how the different mixins function together.
For example the application of .define-state(...)
can be hard to understand.
Shall I merge #159 separately?
.state-circle-with-border-hover(@dot-border-width, @circle-color) { | ||
border-color: darken(@circle-color, 10%); | ||
|
||
li .step-indicator { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm in favor of adding this and the following blocks to the previous li
block:
li {
.step-indicator {
...
}
&.current .step-indicator {
...
}
...
}
I think this makes the code easier to read and understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, definitely. I did not write any comments in the first place because I was not sure if you would favor my approach.
Yes, I think it should not be blocked by this refactoring. |
Added code comments in 39b7430. If everything is OK, I can then apply the same refactoring procedure to the styles for horizontal layout. |
// Arguments: | ||
// @width - step indicator width | ||
// @height - step indicator height | ||
// @border - step indicator border |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the arguments need some more description.
For example, the @border
argument description doesn't specify what information the argument needs to contain:
- whether a border should be drawn (i.e. a boolean)
- how thick a border should be drawn
- or something entirely different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wz-color-default: #E6E6E6; | ||
@wz-color-current: #808080; | ||
@wz-color-done: #339933; | ||
@wz-color-optional: #38ef38; | ||
@wz-color-editing: #FF0000; | ||
|
||
/* | ||
dot definitions | ||
*/ | ||
dot definitions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this isn't really a part of this PR, but can you please change the style of the old comments:
/*
...
*/
to fit with the new ones:
// ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.state-circle-hover(@big-dot-width, @big-dot-height, @dot-border-width); | ||
.state-circle-with-border-and-content-hover(@dot-border-width, @wz-color-default); | ||
} | ||
&.small ul.steps-indicator { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sometimes, a user of the library may want to completely override the style of the library, i.e. he doesn't want to use any existing style but define his own one.
In such a case it would be useful to define a kind of "empty" default style.
I'm not sure how this could be done best, and whether this fits in the scope of this PR.
My current approach to such questions was to recommend using a non existing layout name in [navBarLayout]
, but I'm not sure if this is the best approach.
What do you think about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My first thought was that providing a default style is a good and easily implemented idea:
ul.steps-indicator {
.state-default(@color) { }
.state-hover(@color) { }
.state-nohover(@color) { }
.define-style(/* ??? */);
}
...but we will then have to decide which indicator width, height and border-width users are going to need. There will always be users unsatisfied with any assumption we make, so I'd rather not provide any defaults at all to avoid such questions.
.line(@big-dot-width, @big-dot-height, @wz-color-default); | ||
} | ||
// default steps shouldn't change when hovered, because they aren't clickable | ||
li.default a:hover .step-indicator { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sometimes we're only selecting a css class, e.g. .step-indicator
, while we're some other times selecting an element and a css class, e.g. ul.steps-indicator
.
I think it would be best if we try to always use a combination of an element and a css class, because it makes it easier to identify on which element type a css class is applied.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be best if we try to always use a combination of an element and a css class, because it makes it easier to identify on which element type a css class is applied.
True, unless the element type is div
or span
, which carry little meaning. I tend to think of div
's and span
's as placeholders to which some meaning is assigned by way of CSS classes, so adding div
or span
to CSS selectors, in my opinion, has little sense. The code is good as it is :)
@madoar , I have pushed another set of changes. Please review. |
I'm ok with merging this PR. |
I'd rather add changes for the horizontal layout to this PR. I think I'll find time for it and #166 later today or tomorrow. |
Done, please review. |
Sorry, I was absent-minded and committed to a wrong branch. Reverted. |
* master: - adjust version - add angular version 7 to the keywords - fix badges in README Update to angular 7 (madoar#194) Update the badges (madoar#193) Cleanup .travis.yml (madoar#191) Remove unnecesarry index.ts files (madoar#192) Apply the [stepId] field from the WizardSteps at ids in the navigation bar (madoar#186) Update the index.ts files (madoar#187) Removing barrel export and explicitly exporting each component in base index.ts. Barrel exports of components cause @ViewChild(<className>) to give undefined in AOT builds (madoar#184) Declare Angular 7 compatibility in `package.json` (madoar#165) Refactor styles (madoar#161) Restore vertical nav bar layout, in particular label alignment (madoar#159)
A styles refactoring proposal as a follow-up to #159 (review).
This PR is on top of #159.