-
-
Notifications
You must be signed in to change notification settings - Fork 201
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
docs: add string() #220
docs: add string() #220
Conversation
✅ Deploy Preview for valibot ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Thank you very much! I'll take a closer look at the PR in the next few days and give you feedback. |
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.
Thanks again for your contribution! 🧩
## Parameter | ||
|
||
- `errorMessage` <Property type='string'/> = 'Invalid type' | ||
- `pipe` <Property type={{ type: 'custom', name: 'Pipe<string>' }}/> = [] |
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.
The syntax name: 'Pipe<string>'
is not quite correct:
<Property
type={[
{
type: 'custom',
name: 'Pipe',
href: '../Pipe',
generics: ['string'],
},
'undefined',
]}
/>;
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.
To not mess up the mdx file, you can also define complex properties at the end of the file like I did in Modular Forms: https://github.com/fabian-hiller/modular-forms/blob/main/website/src/routes/(layout)/[framework]/api/getValues.mdx
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 would be interested to know how other documentation handles this internally. Maybe we can use that to improve our approach with <Property />
.
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.
Implemented!
a224502
I would be interested to know how other documentation handles this internally. Maybe we can use that to improve our approach with .
I'll look this up in the coming days 🙏
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 would be interested to know how other documentation handles this internally.
I've searched 3 library documents, and found that there are only simple approaches to handle type and property information:
- React Hook Form
- only code block is used, and there is no component like
<Property />
- https://react-hook-form.com/ts#Field
- only code block is used, and there is no component like
- Material UI
- only code block and `` block are used, and there is no component like
<Property />
- https://mui.com/material-ui/api/accordion/
- only code block and `` block are used, and there is no component like
- Typia
- only code block and `` block are used, and there is no component like
<Property />
- https://typia.io/docs/validators/validate/
- only code block and `` block are used, and there is no component like
So as far as I've searched, I guess it might be good to use without big changes.
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.
Thank you for the research!
You are great! Thanks a lot. I will try to review the changes in the next few days. One idea I had was to list the authors of the documentation at the bottom of each page, like in Qwik. What do you think about that? Here is an example: https://qwik.builder.io/docs/ |
@kazizi55 please pull my latest changes, start the website in your development environment and let me know what you think about them. |
Sounds great! Can I add this section in another PR? |
Fixed! Now, generics with default parameter can be displayed! |
website/src/components/Property.tsx
Outdated
@@ -54,7 +54,9 @@ type SingleTypeOrValue = | |||
| { | |||
type: 'custom'; | |||
name: string; | |||
generics?: TypeOrValue[]; | |||
generics?: | |||
| { withDefault: true; name: string; type: TypeOrValue } |
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.
Can we rename that to default
so that it is similar to the default
prop of the component?
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.
My idea would be to change it to default?: TypeOrValue
.
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.
Maybe your approach is the right one. I will probably take a closer look tomorrow.
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.
LGTM
Thanks a lot. I plan to review the new changes in the next days. |
@kazizi55 can you review my changes? I think that we are slowly approaching our destination. 🏁 |
@fabian-hiller I think it's better to create a new issue which includes to-do list, so that we can check which document is completed or not. 😄 |
Are you happy with the current version? Would you change anything? I will take another look at everything in the next few days and also check how other API references present there information to give feedback. But we are on the right track and I think we will reach a final version soon. |
I have further improved the |
@kazizi55 thank you again for your contribution! I will merge this PR and post the draft on Twitter to get more feedback before we add the other references. |
@fabian-hiller
Thank you! |
Unfortunately, no. We probably only get feedback when people use the API reference and don't understand or miss something. I will create a issue soon where we can coordinate the API reference extension. 🧩 |
Implements #209 (comment)