Skip to content

ref(onboarding): Introduce content blocks #95224

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

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ArthurKnaus
Copy link
Member

@ArthurKnaus ArthurKnaus commented Jul 10, 2025

Introduce specialized content blocks opposed to the current configuration object.
This makes it clearer what is rendered in which order and which properties are required -> enforced by types.
Converted react and java project creation onboarding docs.

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jul 10, 2025
Comment on lines +43 to +46
const partialLoading = useMemo(
() => children.includes(PACKAGE_LOADING_PLACEHOLDER),
[children]
);
Copy link
Member Author

Choose a reason for hiding this comment

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

Previously we had a separate prop partiallyLoading on the configuration object, which was missing most of the time. I decided to drop it from the new format and rather autodetect the loading placeholder in the snippet. This solution is maybe a bit hacky but is much better DX when writing docs.

*
* **Do not** use this with custom react elements but instead use the `custom` block type.
*/
text: React.ReactNode;
Copy link
Member Author

Choose a reason for hiding this comment

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

Would love to only have string here. Also the translation functions are making the docs so much harder to read...

Copy link

codecov bot commented Jul 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #95224   +/-   ##
=======================================
  Coverage   87.84%   87.85%           
=======================================
  Files       10469    10469           
  Lines      605374   605361   -13     
  Branches    23674    23672    -2     
=======================================
- Hits       531819   531814    -5     
+ Misses      73195    73187    -8     
  Partials      360      360           

Comment on lines +56 to +61
export type ContentBlock =
| TextBlock
| CodeBlock
| CustomBlock
| AlertBlock
| ConditionalBlock;
Copy link
Member Author

Choose a reason for hiding this comment

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

I just added the most basic ones that I encountered while converting java & react docs.
In the future we will for sure add more like heading, list, ...

Comment on lines +55 to +59
type: 'custom',
content: (
<OnboardingCodeSnippet
language="bash"
onCopy={() =>
Copy link
Member Author

Choose a reason for hiding this comment

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

onCopy and onSelectAndCopy was only supported for this one usage. Decided to resort to a custom block instead of bloating the interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant