-
Notifications
You must be signed in to change notification settings - Fork 363
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
Migrate docs for deprecated React components #710
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
keithamus
approved these changes
Jan 18, 2024
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Deprecated component status
This PR migrates docs for deprecated React components from the old primer.style/react site to the new docsite. This was not a straightforward migration, since the current docs exist within this matrix of sadness:
ActionList
ActionMenu
Button
FilterList
FilteredSearch
SideNav
UnderlineNav
Legend:
Deprecated
.<PropsTable>
component. "Imports .data.json" means it imports the corresponding component_name.data.json file and passes the data to the<ComponentProps>
component.Action taken
ActionList
,ActionMenu
,Button
, andUnderlineNav
, I copy/pasted the existing docs into dedicated pages under components/component-name/react/deprecated, which follows the same naming conventions I described above. I added a specialreactStatus: deprecated
field to the page's YAML frontmatter to mark components that have dedicated pages for their deprecated versions, which gatsby-node.js queries when generating pages.FilterList
andFilteredSearch
are listed in components.json, I elected to turn them into top-level /deprecated-components, i.e. under the "Deprecated components" section in the nav. Although there is some additional information in their bespoke .md files, it's minimal enough to drop from the new docsite.SideNav
now lives under the top-level "Deprecated components" nav section. There was enough information in its bespoke .md file that I decided to port it over by creating /deprecated-components/side-nav/react/latest.md, which is consistent with our now site-wide URL structure.Prop tables
<PropsTable>
component from Primer React.FilterList
FilteredSearch
are also part of components.json. By opting to use react-component-layout.tsx for these components, the props table is now generated automatically. The results should appear identical.Additional hurdles
Because the new docsite uses an outdated version of Gatsby, we are unable to use modern versions of Primer React to build it. As a direct consequence, I had to re-implement the old docsite's
ThemeReferenceTree
component, which relies on Primer React'sTreeView
component. SadlyTreeView
isn't available in older versions of the library. I had to rewrite it to use<summary>
/<details>
elements instead.