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

Feat(DescriptionList): 6866 set width of term column #7061

Merged

Conversation

gitdallas
Copy link
Contributor

What: Closes #6866

Additional issues:

@gitdallas gitdallas modified the milestones: 2022.04, 2022.03 Mar 14, 2022
@patternfly-build
Copy link
Contributor

patternfly-build commented Mar 14, 2022

@gitdallas gitdallas force-pushed the feat/6866-set-width-term-col-desc-list branch from e2adaab to 9438c37 Compare March 14, 2022 17:26
Copy link
Contributor

@nicolethoen nicolethoen left a comment

Choose a reason for hiding this comment

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

Perhaps it'd be worth updating the other horizontal example to use a checkbox to apply a custom width when checked since it's only changing one prop.

@gitdallas
Copy link
Contributor Author

@nicolethoen - just noticed your top level comment about a checkbox, will address that soon

@tlabaj
Copy link
Contributor

tlabaj commented Mar 14, 2022

Perhaps it'd be worth updating the other horizontal example to use a checkbox to apply a custom width when checked since it's only changing one prop.

@nicolethoen Maybe more than a checkbox is warranted, it would be ideal if the consumer can set the width. Most of our examples with checkboxes are to apply modifiers.

Tooltip has something that is more than modifying a boolean in an example
https://patternfly-react.surge.sh/components/tooltip#options

cc @mcarrano

fix tests

fix tests

address pr comments

make checkbox optional custom term length in example

remove typo

add number input for width
@gitdallas gitdallas force-pushed the feat/6866-set-width-term-col-desc-list branch from 653e95f to b1dbf3b Compare March 14, 2022 20:03
@gitdallas
Copy link
Contributor Author

@tlabaj - converted to a NumberInput

@gitdallas gitdallas requested a review from tlabaj March 14, 2022 20:19
@tlabaj
Copy link
Contributor

tlabaj commented Mar 15, 2022

@gitdallas I don't think we have a good way to add anything other than a checkbox right now without having the control look like it is part of the component. I this case I think it is best to have a separate example to show the functionality.
An issue has been opened in design so we can update our example to better allow for adding controls.

@gitdallas
Copy link
Contributor Author

@tlabaj - reverted back to separate examples

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

This looks great, though does it support the breakpoint modifiers? https://codesandbox.io/s/stoic-mopsa-twtm0v?file=/style.css

@gitdallas
Copy link
Contributor Author

This looks great, though does it support the breakpoint modifiers? https://codesandbox.io/s/stoic-mopsa-twtm0v?file=/style.css

not sure, basically just allowing the consumer to overwrite the --pf-c-description-list__term--width value. they pass the termWidth.

style.setProperty(termWidthToken.name, termWidth);

i'm not sure where they come from or what it means if they aren't there, but I only see a react-token for that main term_width which is given a value of 12ch

@mcoker
Copy link
Contributor

mcoker commented Mar 18, 2022

@gitdallas ah ok, I'm assuming they don't show up in react tokens since we don't define them with an initial value. We just use them in a fallback stack --pf-c-description-list__term--width at different breakpoints. You can see how they're used here: https://unpkg.com/browse/@patternfly/patternfly@4.183.1/components/DescriptionList/description-list.css

I imagine termWidth would be an object that supports default, sm, md, etc keys to define the size(s), similar to maxWidths and minWidths in the gallery component

@gitdallas gitdallas changed the title Feat(DescriptionList): 6866 set width of term column WIP - Feat(DescriptionList): 6866 set width of term column Mar 19, 2022
@gitdallas
Copy link
Contributor Author

@nicolethoen @mcoker - see latest https://patternfly-react-pr-7061.surge.sh/components/description-list , i added modifiers for the width breakpoints.. it doesn't seem to have any affect. you can see they are applied
image

@nicolethoen
Copy link
Contributor

I think you're updating the wrong breakpoint modifier.
Your various breakpoints should be setting the following CSS vars:

  --pf-c-description-list--m-horizontal__term--width (this is the default width)
  --pf-c-description-list--m-horizontal__term--width-on-sm
  --pf-c-description-list--m-horizontal__term--width-on-md
  --pf-c-description-list--m-horizontal__term--width-on-lg
  --pf-c-description-list--m-horizontal__term--width-on-xl
  --pf-c-description-list--m-horizontal__term--width-on-2xl

@gitdallas
Copy link
Contributor Author

gitdallas commented Mar 21, 2022

I think you're updating the wrong breakpoint modifier. Your various breakpoints should be setting the following CSS vars:

  --pf-c-description-list--m-horizontal__term--width (this is the default width)
  --pf-c-description-list--m-horizontal__term--width-on-sm
  --pf-c-description-list--m-horizontal__term--width-on-md
  --pf-c-description-list--m-horizontal__term--width-on-lg
  --pf-c-description-list--m-horizontal__term--width-on-xl
  --pf-c-description-list--m-horizontal__term--width-on-2xl

does it matter that there is no react token for these? just hard code them in?

edit: i do see that is being done in another place so i'll go ahead with that.

@gitdallas gitdallas changed the title WIP - Feat(DescriptionList): 6866 set width of term column Feat(DescriptionList): 6866 set width of term column Mar 21, 2022
Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

Looks great!!! Just one nit about the docs.

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

Left a comment re: the docs.

Also unrelated I noticed the enableFlip prop docs are missing a period between "necessary If" and at the end.

If true, tries to keep the popover in view by flipping it if necessary If the position is set to 'auto', this prop is ignored

@gitdallas gitdallas requested a review from mcoker March 23, 2022 18:34
Copy link
Contributor

@tlabaj tlabaj left a comment

Choose a reason for hiding this comment

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

looks good other than the little issue.

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

Nice!!

@tlabaj tlabaj merged commit da124dd into patternfly:main Mar 23, 2022
@mturley
Copy link
Collaborator

mturley commented Mar 24, 2022

Thanks so much everyone! This is perfect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

DescriptionList: Add prop to set width of the term column in the horizontal variant
6 participants