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

Added documentation concerning forms #16566

Merged
merged 2 commits into from
Sep 12, 2024
Merged

Conversation

psatyal
Copy link
Contributor

@psatyal psatyal commented Aug 30, 2024

Ticket

https://community.openproject.org/projects/openproject/work_packages/57580/activity

What are you trying to accomplish?

Add documentation to Lookbook concerning the implementation of forms and form elements in Primer.

What approach did you choose and why?

The approach was discussed and agreed upon in the frontend daily on 30 August 2024.

Merge checklist

  • Review by front-end dev
  • Addition of any code samples
  • Merge

@psatyal psatyal requested a review from HDinger August 30, 2024 14:34
Copy link
Contributor

@HDinger HDinger left a comment

Choose a reason for hiding this comment

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

I have some very minor comments, other than that it looks fine 👍 I asked @cbliard to take a look as well, as he is currently implementing a settings page. So he might have additional ideas about what should be written down.


## Grouping and hierarchy

Form elements are related need to be grouped together. For this, use a form group.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Form elements are related need to be grouped together. For this, use a form group.
Form elements that are related need to be grouped together. For this, use a [form group](https://primer-lookbook.github.com/view-components/lookbook/pages/forms/groups_layouts).


Form elements are related need to be grouped together. For this, use a form group.

If a form is particularly long, split it into different form groups and use a `Subhead` at the start of each to give it a title. When using Subheads, we recommend implementing individual Save buttons for each section (using the <em>Secondary</em> style). If a section only contains `Toggle switch` elements, a separate Save button is not necessarily (since the Toggle sends its own server request on interaction).
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
If a form is particularly long, split it into different form groups and use a `Subhead` at the start of each to give it a title. When using Subheads, we recommend implementing individual Save buttons for each section (using the <em>Secondary</em> style). If a section only contains `Toggle switch` elements, a separate Save button is not necessarily (since the Toggle sends its own server request on interaction).
If a form is particularly long, split it into different form groups and use a [`Subhead`](https://primer-lookbook.github.com/view-components/lookbook/inspect/primer/beta/subhead/default) at the start of each to give it a title. When using Subheads, we recommend implementing individual Save buttons for each section (using the <em>Secondary</em> style). If a section only contains `Toggle switch` elements, a separate Save button is not necessarily (since the Toggle sends its own server request on interaction).

Comment on lines +34 to +39
- <strong>:auto</strong> => width: auto
- <strong>:small</strong> => max-width: min(256px, 100vw - 2rem)
- <strong>:medium</strong> => max-width: min(320px, 100vw - 2rem)
- <strong>:large</strong> => max-width: min(480px, 100vw - 2rem)
- <strong>:xlarge</strong> => max-width: min(640px, 100vw - 2rem)
- <strong>:xxlarge</strong> => max-width: min(960px, 100vw - 2rem)
Copy link
Member

Choose a reason for hiding this comment

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

A screenshot would be worth a thousand words.

Copy link
Member

Choose a reason for hiding this comment

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

Also knowing that multiple width are available does not help making a choice. If there is a rule, here would be a good place to make it explicit.

Copy link
Member

@cbliard cbliard left a comment

Choose a reason for hiding this comment

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

Thanks for providing this. Overall I think it could benefit from having more screenshots illustrating the mentionned cases. That's something I appreciate in original Primer documentation, and I'm sure that's something I would appreciate in our docs as well.


Form elements are related need to be grouped together. For this, use a form group.

If a form is particularly long, split it into different form groups and use a `Subhead` at the start of each to give it a title. When using Subheads, we recommend implementing individual Save buttons for each section (using the <em>Secondary</em> style). If a section only contains `Toggle switch` elements, a separate Save button is not necessarily (since the Toggle sends its own server request on interaction).
Copy link
Member

Choose a reason for hiding this comment

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

Screenshots of a short form and a long form would be helpful, or links to our lookbook to such forms.

Comment on lines +34 to +39
- <strong>:auto</strong> => width: auto
- <strong>:small</strong> => max-width: min(256px, 100vw - 2rem)
- <strong>:medium</strong> => max-width: min(320px, 100vw - 2rem)
- <strong>:large</strong> => max-width: min(480px, 100vw - 2rem)
- <strong>:xlarge</strong> => max-width: min(640px, 100vw - 2rem)
- <strong>:xxlarge</strong> => max-width: min(960px, 100vw - 2rem)
Copy link
Member

Choose a reason for hiding this comment

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

Also knowing that multiple width are available does not help making a choice. If there is a rule, here would be a good place to make it explicit.

@HDinger HDinger force-pushed the add-form-settings-pages-to-lookbook branch from ba2287f to 83daf48 Compare September 12, 2024 12:01
@HDinger HDinger added this to the 14.6.x milestone Sep 12, 2024
@cbliard
Copy link
Member

cbliard commented Sep 12, 2024

I forgot about this PR. I also added a forms page in another PR. A bit more technical. Once both PR are merged, we should issue a PR to merge the content of both pages into one coherent and cohesive page.

The other PR is #16550.
The page is there: https://github.com/opf/openproject/pull/16550/files#diff-48dfa06628ffc5ea460195fe11ff4953c48fc830892c373bfc8f949479c157c5

@cbliard
Copy link
Member

cbliard commented Sep 12, 2024

Seen with Henriette: once this PR is merged, I'll file my content in the page under a ## Technical notes section.

@HDinger HDinger merged commit 1658d21 into dev Sep 12, 2024
12 of 13 checks passed
@HDinger HDinger deleted the add-form-settings-pages-to-lookbook branch September 12, 2024 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants