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: upstream FormikField #1054

Merged
merged 2 commits into from
Mar 20, 2024
Merged

feat: upstream FormikField #1054

merged 2 commits into from
Mar 20, 2024

Conversation

huwshimi
Copy link
Collaborator

@huwshimi huwshimi commented Mar 19, 2024

Done

  • upstream the FormikField component to make react-component's fields and Formik easier to work with. This component is already in use in maas-ui and react-components and we want to use it in another project.

QA

Storybook

To see rendered examples of all react-components, run:

yarn start

QA in your project

from react-components run:

yarn build
npm pack

Install the resulting tarball in your project with:

yarn add <path-to-tarball>

QA steps

  • Go to the FormikField docs page in Storybook.
  • Check that the docs make sense.

Fixes

https://warthogs.atlassian.net/browse/WD-9813
Fixes: #957.

@webteam-app
Copy link

Demo starting at https://react-components-1054.demos.haus

@@ -0,0 +1,75 @@
import React from "react";
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the docs doesn't render as expected. For instance:

  • when pressing Show code, the entire code is presented, but I assume we only want the bit from render to be displayed.
  • the default value of component prop in props table is not listed in DEFAULT column.

The first issue also appears in Card stories, which is one of the few other .stories.tsx docs. There are also some slight inconsistencies in presentation between .stories.tsx and .stories.mdx docs e.g. the Props header missing in .stories.tsx docs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think the docs doesn't render as expected. For instance:

  • when pressing Show code, the entire code is presented, but I assume we only want the bit from render to be displayed.

There's an open issue here, with a workaround that I've applied to both files: storybookjs/storybook#22281.

  • the default value of component prop in props table is not listed in DEFAULT column.

It looks like the table couldn't handle the Input component as a default but this can be set via a jsdoc string so I've done that.

The first issue also appears in Card stories, which is one of the few other .stories.tsx docs. There are also some slight inconsistencies in presentation between .stories.tsx and .stories.mdx docs e.g. the Props header missing in .stories.tsx docs.

It looks like it was decided not to customise the page too much and stick with the CSF defaults: #1010 (comment).

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the explanation and links, and for also fixing the inconsistency in Card stories!

Copy link
Contributor

@vladimir-cucu vladimir-cucu left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@huwshimi huwshimi merged commit ee0bf93 into canonical:main Mar 20, 2024
6 checks passed
Copy link

🎉 This PR is included in version 0.51.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

Inputs have no id and are passed extra params
3 participants