-
-
Notifications
You must be signed in to change notification settings - Fork 721
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
Block examples documentation #6560
Conversation
✅ Deploy Preview for plone-components canceled.
|
Thank you for writing this @erral . It's awesome when an experienced Volto developer takes some time to pass on some of this hard-earned experience and writes some documentation. You are awesome for doing this. I plan on giving it a read sometime this week to see if there is anything that I can help with in potential suggestions. But again, thank you for doing this. |
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.
This is great stuff. Thank you!
I created a related PR to define Glossary terms at plone/documentation#1829, which needs to be merged before this PR to pull them into this PR's docs preview.
docs/source/blocks/examples/customviewvariationsandschemaenhancer.md
Outdated
Show resolved
Hide resolved
docs/source/blocks/examples/customviewvariationsandschemaenhancer.md
Outdated
Show resolved
Hide resolved
docs/source/blocks/examples/customviewvariationsandschemaenhancer.md
Outdated
Show resolved
Hide resolved
docs/source/blocks/examples/customviewvariationsandschemaenhancer.md
Outdated
Show resolved
Hide resolved
docs/source/blocks/examples/customviewvariationsandschemaenhancer.md
Outdated
Show resolved
Hide resolved
@erral once you apply @stevepiercy suggestions and you feel that the work is ready for review you can add me as a reviewer if you would like, I volunteer to read the docs and give any potential suggestions if needed. |
Co-authored-by: Steve Piercy <[email protected]>
Co-authored-by: Steve Piercy <[email protected]>
Co-authored-by: Steve Piercy <[email protected]>
Co-authored-by: Steve Piercy <[email protected]>
…cer.md Co-authored-by: Steve Piercy <[email protected]>
…cer.md Co-authored-by: Steve Piercy <[email protected]>
…cer.md Co-authored-by: Steve Piercy <[email protected]>
…cer.md Co-authored-by: Steve Piercy <[email protected]>
…cer.md Co-authored-by: Steve Piercy <[email protected]>
Co-authored-by: Steve Piercy <[email protected]>
Co-authored-by: Steve Piercy <[email protected]>
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.
Just a bunch of nitpicky stuff, except for changing webmaster or developer to editor. I'll merge these. Over to @ichim-david!
docs/source/blocks/examples/custom-view-variations-and-schema-enhancer.md
Outdated
Show resolved
Hide resolved
docs/source/blocks/examples/custom-view-variations-and-schema-enhancer.md
Outdated
Show resolved
Hide resolved
docs/source/blocks/examples/custom-view-variations-and-schema-enhancer.md
Outdated
Show resolved
Hide resolved
docs/source/blocks/examples/custom-view-variations-and-schema-enhancer.md
Outdated
Show resolved
Hide resolved
docs/source/blocks/examples/custom-view-variations-and-schema-enhancer.md
Outdated
Show resolved
Hide resolved
docs/source/blocks/examples/custom-view-variations-and-schema-enhancer.md
Show resolved
Hide resolved
docs/source/blocks/examples/custom-view-variations-and-schema-enhancer.md
Outdated
Show resolved
Hide resolved
Also move HOC comment to narrative text to allow a term
Glossary terms link now. According to the React docs, HOC is no longer used in modern React, so should we use them anymore? |
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.
@erral thank you again for taking the time to write these examples.
I think we are missing an example where you also define a custom edit view since we have created the view component, the schema and the schema enhancer.
What we haven't shown yet to the user is how they can also create a custom edit component.
It can also come in another pull request or added by Steve or anyone else I'm not saying it's mandatory for that example to also be created in this pull request but I think it would have been useful to have that example as well.
Again thank you for your work.
|
||
## Preparations | ||
|
||
In your Volto add-on, create a subfolder {file}`ExampleBlock02` inside the {file}`components` folder to save all the files required to create a block. |
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.
@erral this is the first document that you have created why do we have example block 02? it makes more sense for me to start with ExampleBlock01 or simply have block1
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.
wrll, this comes from examples I have written for my team. There are 6 examples, but I have brought here only 3, the most relevant ones. I have copy-pasted the code, so that's why we have 2, 5 and 6.
I haven't copied the following ones:
- Block just with schema (automatic view and edit)
- Custom edit component (I will add this following your suggestion)
- Block with 'manual' variations: adding the variation field manually in the schema
}; | ||
``` | ||
|
||
At the top of the file, import the relevant components as follows. |
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.
@erral I would flip this info to be added before the info from here
https://github.com/plone/volto/pull/6560/files#diff-0cac75d5c1904800eea8a8aabac27f32423c1cdffa5d10c0b1bb56456a83aa9aR137
To do so, open your add-on's {file}`index.js` file, and insert the following contents. | ||
|
||
```js | ||
const applyConfig = (config) => { |
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.
@erral I don't think this info should be here. It has nothing to do with the example given here. I would show the contents of the index file that is created whenever you create a new add-on.
From there, I would show that we can add our configuration for the block.
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 will rewrite this, saying to add the block configuration form before the return config
, that will be easier to understand.
docs/source/blocks/examples/custom-view-variations-and-schema-enhancer.md
Outdated
Show resolved
Hide resolved
docs/source/blocks/examples/custom-view-variations-and-schema-enhancer.md
Show resolved
Hide resolved
Co-authored-by: David Ichim <[email protected]>
…hema enhancer too
Thanks @ichim-david and @stevepiercy for your comments. I have made some modifications in the docs:
|
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.
More nitpicky stuff. I'll merge these.
docs/source/blocks/examples/custom-view-variations-and-schema-enhancer.md
Outdated
Show resolved
Hide resolved
docs/source/blocks/examples/custom-view-variations-and-schema-enhancer.md
Outdated
Show resolved
Hide resolved
docs/source/blocks/examples/custom-view-variations-and-schema-enhancer.md
Outdated
Show resolved
Hide resolved
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'm waiting for the RTD PR preview to complete building before committing these suggestions.
docs/source/blocks/examples/custom-view-variations-and-schema-enhancer.md
Outdated
Show resolved
Hide resolved
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.
This looks great. Thank you @erral for sharing your work, and @ichim-david for the suggesstions for improvement. ✋
@ichim-david one more review from you, and if you approve, please go ahead and merge.
…the examples in the browser.
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.
@erral and @stevepiercy. I built locally and the code examples look good now without any extra
overflow scrollbars and the build is passing.
Again thank you erral for this work.
@erral @ichim-david @stevepiercy Nice work! |
I have reviewed the block documentation, converted some code blocks from class components to functional components, and provide an example of a simple block.
📚 Documentation preview 📚: https://volto--6560.org.readthedocs.build/