Skip to content

refactor(button): refactor CSS vars - #1030

Merged
matthewcarleton merged 5 commits into
patternfly:masterfrom
mcoker:issue-985
Dec 7, 2018
Merged

refactor(button): refactor CSS vars#1030
matthewcarleton merged 5 commits into
patternfly:masterfrom
mcoker:issue-985

Conversation

@mcoker

@mcoker mcoker commented Nov 29, 2018

Copy link
Copy Markdown
Contributor

fixes #985

@patternfly-build

patternfly-build commented Nov 29, 2018

Copy link
Copy Markdown
Collaborator

Deploy preview for pf-next ready!

Built with commit 52a52fd

https://deploy-preview-1030--pf-next.netlify.com

@mcoker

mcoker commented Nov 29, 2018

Copy link
Copy Markdown
Contributor Author

Before this PR

  • button.css
    • 16k
    • 12504 characters
  • button.scss
    • 12k
    • 11652 characters

After this PR

  • button.css
    • 8k (50%)
    • 6336 characters (51%)
  • button.scss
    • 8k (67%)
    • 5961 characters (51%)

@jgiardino jgiardino left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I like these updates.

@@ -16,12 +14,6 @@
// Hover state variables

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe in the description you could put "Hover, Focus and Active State Variables" so that we know which variable applies to which states?

@@ -31,62 +23,30 @@
--pf-c-button--m-primary--BackgroundColor: var(--pf-global--primary-color--100);
--pf-c-button--m-primary--Color: var(--pf-global--Color--light-100);
--pf-c-button--m-primary--hover--BackgroundColor: var(--pf-global--primary-color--200);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

And then add a description above this hover variable describing that it applies to focus and active for Background Color

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

My concern with adding that is that I haven't been adding it to other components where I'm consolidating variables, and it isn't in components that were already written that way where vars are reused and consolidated. I can just add it here, or we can go back and add it everywhere. Do you think it's worth doing? I think it's fine just to read the CSS and figure it out but maybe I'm biased :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I do like how we have this comment up above:

  // Hover/focus/active state variables
  --pf-c-button--hover--BorderWidth: var(--pf-global--BorderWidth--md);	  --pf-c-button--hover--BorderWidth: var(--pf-global--BorderWidth--md);

Maybe the // Hover/focus/active state variables comment above is sufficient to provide devs enough of a clue that for this component --hover-- refers to hover, focus and active, and any variable further down with --hover-- could be assumed to address those states too? That's assuming that "hover" for hover/focus/active is consistent throughout the css for the component.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is that cool with you @christiemolloy? I updated the comment for the first hover var to state that the state vars are shared and represented as a "hover" var for each button variation.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That sounds good! Ill update the issue #1036

--pf-c-button--m-secondary--BackgroundColor: transparent;
--pf-c-button--m-secondary--BorderColor: var(--pf-global--primary-color--100);
--pf-c-button--m-secondary--Color: var(--pf-global--primary-color--100);
--pf-c-button--m-secondary--hover--BackgroundColor: transparent;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

And then since the states dont change variables, you could make a note of the fact that these variables carry over to H,F,A

@matthewcarleton
matthewcarleton merged commit 5861022 into patternfly:master Dec 7, 2018
@mcoker
mcoker deleted the issue-985 branch December 16, 2019 23:22
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.

5 participants