Skip to content

Conversation

@thatblindgeye
Copy link
Collaborator

@thatblindgeye thatblindgeye commented Mar 24, 2025

Towards #15

Note that I updated the index file to render some dummy data, I'll back that out after this gets reviews in case anyone has comments on the visuals.

Things to consider:

  • Do we want this table to handle sorting items alphabetically, or should whatever is passing the date into the table handle it? Probably the latter if we anticipate using this data elsewhere for whatever reason.
    • Austin mentioned the backend handling this, I'd be fine with that. Adding sorting functionality in the future is also an option
  • FWIW, here's a screenshot of something I toyed with where we display an empty state in the table if no props are found, rather than just omitting the table completely
    image

it('Does not render component description by default', () => {
render(<PropsTable componentName={componentName} />)

expect(screen.queryByTestId('component-description')).not.toBeInTheDocument()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Feel like this happens every once in a blue moon, but only reason I'm doing this is because I feel like checking the specific description string doesn't exist could potentially lead to false passes. This at least checks the description wrapper (and its content) doesn't exist at all.

@thatblindgeye thatblindgeye marked this pull request as ready for review April 1, 2025 14:47
Comment on lines 42 to 51
const betaDeprecatedProps = hasPropsToRender
? publicProps.filter((prop) => prop.isBeta && prop.isDeprecated)
: []

if (betaDeprecatedProps.length) {
// eslint-disable-next-line no-console
console.error(
`The following ${componentName} props have both the isBeta and isDeprecated tag: ${betaDeprecatedProps.map((prop) => prop.name).join(', ')}`,
)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Think this could be done in the renderTagLabel function? Seems like that might be cleaner.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah we could, only reason I originally did it this way was to capture all props that fit the criteria at once rather than one at a time, but doing it in the renderTagLabel would negate the need for some of this code so I'm for it

Comment on lines 111 to 127
{prop.isRequired ? (
<>
<span
aria-hidden="true"
className={css(textStyles.textColorRequired)}
>
*
</span>
<span
className={css(accessibleStyles.screenReader)}
>
required
</span>
</>
) : (
''
)}{' '}
Copy link
Contributor

Choose a reason for hiding this comment

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

What would you think about moving this into its own function/component so that we can have a little bit less logic in the JSX?

/>,
)

expect(screen.getByText(componentDescription)).toBeVisible()
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: if you're using the testId to check that the description isn't rendering in the last test I would expect an assertion that it is rendering in this test.

Up to you whether you have both assertions or assert against the text content of the queried test id.

consoleSpy.mockRestore()
})

it('Does not throw error if isBeta and isDeprecated both are not passed', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit for readability:

Suggested change
it('Does not throw error if isBeta and isDeprecated both are not passed', () => {
it('Does not throw error if neither isBeta nor isDeprecated are passed', () => {

componentDescription="The container to render a list of alerts."
/>
<PropsTable componentName="AlertTitle" />
</MainLayout>
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you intend to keep these changes in the PR?

Copy link
Collaborator Author

@thatblindgeye thatblindgeye Apr 1, 2025

Choose a reason for hiding this comment

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

Just for now, to show what the various renders look like in case anyone had thoughts/concerns or anything (also to get design input on the Label choices, though we can do that another time if need be; I can otherwise back that file change out in my next push if things look good to you)

@thatblindgeye
Copy link
Collaborator Author

@wise-king-sullyman spoke to Lucia and she gave feedback on the labels so I updated those accordingly (gray fill for deprecated, blue fill for beta). Other feedback should be resolved.

Copy link
Contributor

@wise-king-sullyman wise-king-sullyman left a comment

Choose a reason for hiding this comment

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

🔥

@wise-king-sullyman wise-king-sullyman merged commit fa04cce into patternfly:main Apr 4, 2025
1 check passed
@github-actions
Copy link

github-actions bot commented Apr 4, 2025

🎉 This PR is included in version 1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants