patternfly-yew / patternfly-yew-quickstart

A Patternfly for Yew quickstart repository
https://patternfly-yew.github.io/patternfly-yew-quickstart/
Apache License 2.0
28 stars 13 forks source link

Props in Docs? #7

Open deathbreakfast opened 2 years ago

deathbreakfast commented 2 years ago

It might be helpful to read and add the props to the documentation. Would be nice to pull these dynamically. Not sure what the best solution would be for this. Can probably add a macro to the original components and expose a method through a Cargo feature?

ctron commented 2 years ago

I agree. So far, my strategy has been to keep this aligned with the ReactJS and/or HTML names/structs of PatternFly. So that reading the docs of PatternFly, should make it easy to translate this into the Rust world.

However, sometimes things work differently in Rust, or Yew, or I just did it differently. So some proper, generated documentation might be pretty useful.

I mean, there are the source docs to: https://docs.rs/patternfly-yew/0.1.2/patternfly_yew/struct.Toast.html

However, most of the components don't have much explanation: https://docs.rs/patternfly-yew/0.1.2/patternfly_yew/struct.TextInputProps.html

I guess the structure is mostly the same. There are yew components, which has a property type. Which should have source code level documentation. Maybe that way, there could be some trait that can be implemented using a macro, which describes the component and its properties, sourcing the information from the source code level docs. And with that, it should be easy to create some interactive docs.

Contributions welcome :grin:

phill-85 commented 1 year ago

There is an (unstable) feature in rust doc for outputting the docs in a json format

We might be able to use that.

I had a play but couldn't get it to work. rustdoc src/lib.rs fails with errors for me.