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: add <FormLayout /> component #814

Merged
merged 19 commits into from
Dec 6, 2023
Merged

feat: add <FormLayout /> component #814

merged 19 commits into from
Dec 6, 2023

Conversation

stephenjwatkins
Copy link
Member

@stephenjwatkins stephenjwatkins commented Nov 30, 2023

πŸ“ Changes

  • Adds <FormLayout /> component

βœ… Checklist

  • Visuals are complete and match Figma
  • Code is complete and in accordance with our style guide
  • Design and theme tokens are audited for any relevant changes
  • Unit tests are written and passing
  • TSDoc is written or updated for any component API surface area
  • Stories in Storybook accompany any relevant component changes
  • Ensure no accessibility violations are reported in Storybook
  • Specs and documentation are up-to-date
  • Cross-browser check is performed (Chrome, Safari, Firefox)
  • Changeset is added

@stephenjwatkins stephenjwatkins marked this pull request as ready for review December 1, 2023 16:15
@@ -42,6 +42,7 @@ type FormLayoutTitleProps = {
};

type FormLayoutHelperTextProps = {
id?: string;
Copy link
Member Author

Choose a reason for hiding this comment

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

potentially used for aria-describedby on parent form element

function findSectionTitleInChildren(children: ReactNode) {
// look for the first `FormLayout.Title` or `FormLayout.Section` element.
// if we encounter a Section before a Title we know the outer Section
// doesn't have a title (or it's wildly [and incorrectly] out of order)
Copy link
Member

Choose a reason for hiding this comment

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

thought: not related to whats going on in this function, but this comment got me thinking about error handling for components in easy ui that require some ordering or to be structured in some way. i haven't seen how other libraries deal with it, if it all, but i did some minor handling in the search nav and at the time it made sense for me to do it, but i wonder what the best practices are for these kinds of things.

Copy link
Member Author

Choose a reason for hiding this comment

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

true. it's a good question. i think some libraries handle this situation with "slots", which i think i've seen comes with some error handling, but i'll do some research for future iterations

* @param deepFindFn Comparator function to test each child against
* @returns The first child that meets the criteria of the comparator function
*/
export function deepFind(
Copy link
Member

Choose a reason for hiding this comment

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

praise: i like this utility here

/**
* Id to assign to the HTML element.
*/
id?: string;
Copy link
Member

Choose a reason for hiding this comment

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

question: i might be missing something super obvious, but is this meant to be spread onto the element?

Copy link
Member Author

Choose a reason for hiding this comment

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

lol yes. good catch

Copy link
Member

@OskiTheCoder OskiTheCoder left a comment

Choose a reason for hiding this comment

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

awesome!

@stephenjwatkins stephenjwatkins merged commit 8178ef1 into main Dec 6, 2023
2 checks passed
@stephenjwatkins stephenjwatkins deleted the form-layout branch December 6, 2023 16:50
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.

2 participants