Skip to content

feat(content-docs): allow custom props through _category_.json - #6780

Merged
Josh-Cena merged 3 commits into
facebook:mainfrom
taejs:add-props-to-category
Mar 5, 2022
Merged

Josh-Cena merged 3 commits into
facebook:mainfrom
taejs:add-props-to-category

Conversation

@taejs

@taejs taejs commented Feb 27, 2022

Copy link
Copy Markdown
Contributor

Motivation

Close #6690
Resolve Feature Request: allow-customizing-category-description-in-generated-index-cards

Have you read the Contributing Guidelines on pull requests?

yes. but I have no idea how to test it.

Test Plan

Related PRs

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Feb 27, 2022
@netlify

netlify Bot commented Feb 27, 2022

Copy link
Copy Markdown

✔️ [V2]
Built without sensitive environment variables

🔨 Explore the source changes: 50d52ee

🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/62233de1447eaa00073c87b1

😎 Browse the preview: https://deploy-preview-6780--docusaurus-2.netlify.app

@github-actions

github-actions Bot commented Feb 27, 2022

Copy link
Copy Markdown

⚡️ Lighthouse report for the changes in this PR:

Category Score
🔴 Performance 48
🟢 Accessibility 100
🟢 Best practices 92
🟢 SEO 100
🟢 PWA 90

Lighthouse ran on https://deploy-preview-6780--docusaurus-2.netlify.app/

@Josh-Cena Josh-Cena left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sorry, we don't want to add more root config fields for categories. Could you please just make categoryMetadata.customProps be passed to the final item? The idea is that the user can swizzle DocCard and implement whatever design through custom props.

@slorber slorber left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Agree with @Josh-Cena : we want to enable users to bring their own customization abilities, not add just 2 new premade and unflexible attributes

@taejs

taejs commented Mar 2, 2022

Copy link
Copy Markdown
Contributor Author

Also agree. Thanks for the feedback. After addressing the review I'm trying to resolve this error.
The docs sidebar category metadata file path=${filePath} looks invalid

CustomProps are not acceptable even though I added sidebar validation.

@Josh-Cena

Copy link
Copy Markdown
Collaborator

CustomProps are not acceptable even though I added sidebar validation.

You added validation for the sidebar item, but not for the metadata file, which has another schema

@slorber
slorber marked this pull request as draft March 4, 2022 14:32
@taejs taejs changed the title feat(content-docs): add props to categoryMetaData for category card feat(content-docs): allow custom props through _category_.json Mar 5, 2022
@taejs
taejs force-pushed the add-props-to-category branch from ca32856 to b76094e Compare March 5, 2022 08:40
@taejs
taejs force-pushed the add-props-to-category branch from b76094e to 1698957 Compare March 5, 2022 08:46
@taejs
taejs marked this pull request as ready for review March 5, 2022 08:46
@taejs

taejs commented Mar 5, 2022

Copy link
Copy Markdown
Contributor Author

Addressed reviews:
make categoryMetadata.customProps be passed to the final item.

@Josh-Cena Josh-Cena added the pr: new feature This PR adds a new API or behavior. label Mar 5, 2022

@Josh-Cena Josh-Cena left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, that looks great!

@Josh-Cena
Josh-Cena merged commit 2e163a9 into facebook:main Mar 5, 2022
mrizwanashiq pushed a commit to mrizwanashiq/docusaurus that referenced this pull request Jun 25, 2026
…ook#6780)

* feat(content-docs): allow custom props through _category_.json

* refactor

* documentation

Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA pr: new feature This PR adds a new API or behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow custom props through _category_.json

4 participants