Skip to content
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

Bug 1796116: fix duplicate badge on dev console list pages #4256

Merged
merged 1 commit into from Feb 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -10,17 +10,23 @@ export interface ProjectListPageProps {
children?: React.ReactNode;
badge?: React.ReactNode;
}
const ProjectListPage: React.FC<ProjectListPageProps> = (props) => (
const ProjectListPage: React.FC<ProjectListPageProps> = ({
badge,
title,
children,
listComponent,
...listPageProps
}) => (
<div className="odc-project-list-page">
<PageHeading title={props.title} badge={props.badge}>
{props.children}
<PageHeading title={title} badge={badge}>
{children}
</PageHeading>
<hr className="odc-project-list-page__section-border" />
<ListPage
{...props}
{...listPageProps}
Copy link
Member Author

Choose a reason for hiding this comment

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

This avoids the whole problem by simply not passing the badge prop through to the ProjectList when it shouldn't be displayed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, the beauty of React. Nice solution @spadgett - I'll do a quick once over in a few moments after my current review but this looks like an elegant solution.

showTitle={false}
kind="Project"
ListComponent={props.listComponent || ProjectsTable}
ListComponent={listComponent || ProjectsTable}
canCreate={false}
filterLabel="by name or display name"
textFilter="project-name"
Expand Down