Skip to content

Conversation

@jpuzz0
Copy link
Contributor

@jpuzz0 jpuzz0 commented Aug 11, 2022

Closes: #3125
Depends on: patternfly/patternfly-react#7824

  • Give "next" module components unique key names when building prop components.
  • Filter out duplicate component names when building "scope" for the list of examples we render on any given documentation page (based on the "source" passed from react-docs).

const propComponents = [...new Set(frontmatter.propComponents || [])].reduce((acc, componentName) => {
const name = getTsDocName(componentName, source === 'react-next');

if (tsDocs[name]) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Trying to understand. So if there's let's say ...next/components/Wizard/Wizard.tsx, then it exists as tsDocs['Wizard-next']?
And then it will get pushed to

propComponents[
  {
    "name": "Wizard-next",
    "props": []
  }
]

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, the name of the component would be "Wizard" still, but the props would be that of the appropriate component.

Here's an example generated output for the "Next" Wizard:

const pageData = {
  "id": "Wizard",
  "section": "components",
  "source": "react-next",
  "slug": "/components/wizard/react-next",
  "sourceLink": "https://github.com/patternfly/patternfly-react/blob/main/packages/react-core/src/next/components/Wizard/examples/Wizard.md",
  "propComponents": [
    {
      "name": "Wizard",

const defaultImports = [
'react',
'@reach/router',
'@patternfly/react-core/next',
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this not added to versions.json?

Copy link
Contributor Author

@jpuzz0 jpuzz0 Aug 17, 2022

Choose a reason for hiding this comment

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

I did not update that file. What are the expectations there? The /next subpath doesn't have its own versioning so I think this will still be required.

@jpuzz0 jpuzz0 force-pushed the next-component-support branch 3 times, most recently from 2136864 to cd18519 Compare August 17, 2022 17:58
@patternfly-build
Copy link
Collaborator

patternfly-build commented Aug 17, 2022

tlabaj
tlabaj previously approved these changes Aug 18, 2022
Copy link
Contributor

@tlabaj tlabaj left a comment

Choose a reason for hiding this comment

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

I am not familiar with the framework. Looks good to me if @jschuler or @CooperRedhat are good with it.

@jpuzz0 jpuzz0 force-pushed the next-component-support branch from e9d8aa6 to de1aeca Compare August 18, 2022 15:36
@jschuler jschuler merged commit 8617112 into patternfly:main Aug 18, 2022
jessiehuff pushed a commit to jessiehuff/patternfly-org that referenced this pull request Oct 24, 2022
…core components (patternfly#3126)

* feat(doc-framework): Allow for 'next' core component usage alongside core components with the same names

* address feedback

* allowing more memory space

* add example prop back

* remove dependency since implicit react-core version is now updated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(documentation-framework): Allow for "React next" component/prop usage

5 participants