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
Add new page to helper-plugin's storybook about useCustomFields hook #15963
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the information hierarchy could be stronger. For instance you've included the return type for get
which is fantastic but it's a bit hidden imo. Have you seen how documentation has been written for other hooks in contributor docs
? Also this one too.
I'd probably do something like this for the headings:
- useCustomFields
- - Usage
- - - Get a specific custom field
- - - Get all the custom fields
- - Methods
- - `get(uuid: string): CustomField`
- - `getAll(): Record<string, CustomField>`
- - Typescript
I would write the CustomField interface here & the signature of the hook in the Typescript
section.
You might think you're repeating yourself by the two usage examples and then writing the methods out but what you're doing is giving readers different ways of accessing the information i.e. they can copy your examples in their app quickly, or learn a bit more about the methods in detail. You also don't need to write copy if you don't want to to accompany the example in great detail. The typescript stuff also is good to explain the return types in a clearer way.
Let me know if any of this doesn't make sense 👍🏼
@joshuaellis I liked the idea, so I tried to apply it. I'm not completely sure if the TypeScript is correct 🤔. Please let me know if you see any issues there |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small TS tweaks but it looks great ⭐
packages/core/helper-plugin/lib/src/hooks/useCustomFields/useCustomFields.stories.mdx
Outdated
Show resolved
Hide resolved
packages/core/helper-plugin/lib/src/hooks/useCustomFields/useCustomFields.stories.mdx
Outdated
Show resolved
Hide resolved
packages/core/helper-plugin/lib/src/hooks/useCustomFields/useCustomFields.stories.mdx
Outdated
Show resolved
Hide resolved
packages/core/helper-plugin/lib/src/hooks/useCustomFields/useCustomFields.stories.mdx
Outdated
Show resolved
Hide resolved
packages/core/helper-plugin/lib/src/hooks/useCustomFields/useCustomFields.stories.mdx
Outdated
Show resolved
Hide resolved
packages/core/helper-plugin/lib/src/hooks/useCustomFields/useCustomFields.stories.mdx
Show resolved
Hide resolved
packages/core/helper-plugin/lib/src/hooks/useCustomFields/useCustomFields.stories.mdx
Outdated
Show resolved
Hide resolved
packages/core/helper-plugin/lib/src/hooks/useCustomFields/useCustomFields.stories.mdx
Outdated
Show resolved
Hide resolved
…ustomFields.stories.mdx Co-authored-by: Josh <37798644+joshuaellis@users.noreply.github.com>
…ustomFields.stories.mdx Co-authored-by: Josh <37798644+joshuaellis@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work and initiative to add this ⭐
What does it do?
Add a new page to the storybook of the helper plugin that explains how to utilize the useCustomFields custom hook and the functions it returns.
Why is it needed?
To provide more information to developers working on plugins that use custom fields
How to test it?
packages/core/helper-plugin
and runnpm run storybook
Or visit the preview