Skip to content

Conversation

@castastrophe
Copy link
Contributor

@castastrophe castastrophe commented May 1, 2020

Link(s) to demo pages where these udpates can be viewed (only listed components that have changes):

For component fixes and features

What has changed and why

  • Refactor of PFE functions responsible for outputting correct variables and fallbacks such that local variables are empty by default

Testing instructions

Be sure to include detailed instructions on how your update can be tested by another developer.

  1. Ensure that components visually look the same
  2. Spot check various existing local variables to make sure they still work
  3. Check theme variables to ensure they still work.

Browser requirements

Your component should work in all of the following environments:

  • Latest 2 versions of Edge
  • Internet Explorer 11 (should be useable, not pixel perfect)
  • Latest 2 versions of Firefox (one on Mac OS, one of Windows OS)
  • Firefox 60.7.2 (or latest version for Red Hat Enterprise Linux distribution)
  • Latest 2 versions of Chrome (one on Mac OS, one of Windows OS)
  • Latest 2 versions of Safari
  • Galaxy S9 Firefox
  • iPhone X Safari
  • iPad Pro Safari
  • Pixel 3 Chrome

Ready-for-merge Checklist

Check off items as they are completed. Feel free to delete items if they are not applicable to your PR.

  • Expected files: all files in this pull request are related to one request or issue (no stragglers or scope-creep).
  • Browser testing passed.
  • Documentation (README.md, WHY.md, etc.) updated or added.
  • Link to the demo recording:

https://rally1.rallydev.com/#/270861059696d/detail/userstory/390981143804

@castastrophe castastrophe changed the title feat Add support for empty local variables feat: Add support for empty local variables May 1, 2020
@castastrophe castastrophe added styles An issue or PR pertaining only to CSS/Sass ready: branch testing Test the component from a user-perspective. Try to break it! ready: browser testing Test the component in the supported browser environments. ready: code review Ready for code review! feature New feature or request labels May 27, 2020
@castastrophe castastrophe added this to the PatternFly Elements 1.0 milestone May 27, 2020
@castastrophe castastrophe marked this pull request as ready for review May 27, 2020 21:27
// thinner padding on top & bottom
:host([pfe-size="small"]) {
--pfe-band--Padding: calc(#{pfe-local(Padding--vertical)} / 4) #{pfe-local(Padding--horizontal)};
--pfe-#{$LOCAL}--Padding: calc(#{pfe-local(Padding--vertical)} / 4) #{pfe-local(Padding--horizontal)};
Copy link
Contributor

Choose a reason for hiding this comment

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

@castastrophe - I see #{$LOCAL} in a bunch of these files instead of using the actual component name. I think this makes reading the code harder and a bit more difficult for debugging issues. If I'm looking the dev tools for and see --pfe-band--Padding and then try to find that variable in the repo as I'm doing development, it's going to be hard to find. Do you think this change is necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I do - if this is hardcoded and I update the $LOCAL variable at the top, anything using pfe-local function will continue to just work but all of these will break. It might take some work to figure out why all the suddent these variables aren't picking up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I recommend using the temp folder with the CSS assets to debug.

Copy link
Contributor

Choose a reason for hiding this comment

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

@castastrophe - I don't think we'll ever be changing local though. If we did, it'd be a new component, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Two possible use-cases: You could rename the component variables to add more specificity (nav to navigation or accordion to accordion-header) or you could copy the styles to a new component and want to update it there (without having to grep the entire stylesheet for updates). 🤷

Copy link
Contributor

Choose a reason for hiding this comment

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

I like the idea but the likelihood of those use-cases seems infrequent. Weighing this change against the ease of editing the files from day to day, it seems that we'd want to favor the developer experience being easier. I'd like to err on the side of making our code more readable and approachable but if you'd like to solicit feedback from the larger group, I'd be up for that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated the example to use the pfe-print-local function instead. Same idea but it accepts a map instead. Do you prefer that approach? It has the same benefits without hardcoding values.

@patternfly patternfly deleted a comment from starryeyez024 Jul 14, 2020
Copy link
Member

@starryeyez024 starryeyez024 left a comment

Choose a reason for hiding this comment

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

Labradors Get The Macaroni!

Copy link
Contributor

@kylebuch8 kylebuch8 left a comment

Choose a reason for hiding this comment

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

I'd like to resolve this conversation before we merge.
#854 (comment)

@castastrophe castastrophe removed ready: branch testing Test the component from a user-perspective. Try to break it! ready: browser testing Test the component in the supported browser environments. ready: code review Ready for code review! labels Jul 16, 2020
@kylebuch8 kylebuch8 merged commit fbbc35c into master Jul 16, 2020
@bennypowers bennypowers deleted the feat-empty-local-variables branch June 25, 2024 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

demo Updating demo pages feature New feature or request functionality Functionality, typically pertaining to the JavaScript. styles An issue or PR pertaining only to CSS/Sass tools Development and build tools

Projects

None yet

5 participants