fix(Pagination): updated width logic for page selection#6276
fix(Pagination): updated width logic for page selection#6276mcoker merged 2 commits intopatternfly:v6from
Conversation
| --#{$pagination}__nav-page-select--FontSize: var(--pf-t--global--font--size--body--md); | ||
| --#{$pagination}__nav-page-select--ColumnGap: var(--pf-t--global--spacer--sm); | ||
| --#{$pagination}__nav-page-select--c-form-control--width-base: calc(var(--pf-t--global--spacer--sm) * 2 + var(--pf-t--global--border--width--100) * 2); // TODO: replace border width token with semantic token | ||
| --#{$pagination}__nav-page-select--c-form-control--width-base: calc((var(--pf-t--global--spacer--md) * 2) + (var(--pf-t--global--border--width--control--default) * 2)); |
There was a problem hiding this comment.
Previously we were using a small 8px padding on the actual form control input, now we're using medium 16px padding inline start/end. Also update the border token.
Should we instead use the actual form control vars here, though? If a consumer updates the form control input padding, it'll cause the same cutoff issue unless they also update vars in Pagination.
There was a problem hiding this comment.
Should we instead use the actual form control vars here, though?
@thatblindgeye yeah, I think that would be ideal. Same deal if we update that padding or border or whatever - we'll have to update any other components that do this sort of thing.
Along those lines, looks like we support this in a handful of components. IMO this would be much more useful as logic in the form control's text input. Then we can yank all of that logic out of the other components and those components can just set a --[pf form control]--chars var for this. Here's where all I'm seeing it, though there may be other places I missed.
patternfly/src/patternfly/components/NumberInput/number-input.scss
Lines 12 to 21 in 5c96ffb
patternfly/src/patternfly/components/Slider/slider.scss
Lines 63 to 65 in 5c96ffb
That could be a follow-up or you could try that now and see if it doesn't open a can of worms, up to you. My guess is it should be pretty straight forward.
There was a problem hiding this comment.
@mcoker for now I just updated Pagination, wasn't 100% sure how to go about pulling some of the logic out of the other components into form control. What I had thought was in form control, updating the Width var to:
--#{$form-control}--Width: calc((var(--#{$form-control}--width-chars, 0) * 1ch) + var(--#{$form-control}--width-base, 100%));
So that we end up 100% width by default like we currently have, then in other components we'd need to at least define vars to assign to --#{$form-control}--width-chars and --#{$form-control}--width-base, since other components will need different values for both of those vars (could maybe define a var in FormControl that = its padding left + padding right then use that var in other components, e.g. --component--c-form-control--width-base: var(--#{$form-control}--padding-inline-base) + [whatever additional units we need to take into account like border width, icon width, etc])
But not sure how off the mark that would be 😆
There was a problem hiding this comment.
Good stuff! Sounds like a fun problem for future us to solve 🐸
|
Preview: https://patternfly-pr-6276.surge.sh A11y report: https://patternfly-pr-6276-a11y.surge.sh |
mcoker
left a comment
There was a problem hiding this comment.
Left a comment, but LGTM as it is now, too! 👍
|
🎉 This PR is included in version 6.0.0-alpha.75 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Closes #6236