Skip to content

Commit

Permalink
Merge pull request #76 from nicolethoen/fix_console_errors
Browse files Browse the repository at this point in the history
fix: prevent console errors for read only badges in card actions
  • Loading branch information
nicolethoen authored Jan 13, 2025
2 parents ebd8588 + 602f9f6 commit 330e740
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
color: var(--pf-t--global--text--color--regular);
text-decoration: none;
}
.ws-react-e-catalog-tile .pf-v6-c-card__header-main {
display: flex;
}
.ws-react-e-catalog-tile .catalog-tile-pf-header .catalog-tile-pf-subtitle {
color: var(--pf-t--global--text--color--subtle);
font-size: var(--pf-t--global--font--size--body--sm);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
text-decoration: none;
}

.pf-v6-c-card__header-main {
display: flex;
}

.pf-v6-c-card__actions {
padding-left: 5px;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/module/src/components/CatalogTile/CatalogTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ export class CatalogTile extends React.Component<CatalogTileProps> {
>
{(badges.length > 0 || iconImg || iconClass || icon || onClick || href) && (
<CardHeader
actions={{ actions: badges.length > 0 && this.renderBadges(badges), hasNoOffset: true }}
selectableActions={ (onClick || href) && {
selectableActionId: id + '-input',
onClickAction: (e) => this.handleClick(e),
Expand All @@ -129,6 +128,7 @@ export class CatalogTile extends React.Component<CatalogTileProps> {
>
{iconImg && <img className="catalog-tile-pf-icon" src={iconImg} alt={iconAlt} />}
{!iconImg && (iconClass || icon) && <span className={`catalog-tile-pf-icon ${iconClass}`}>{icon}</span>}
{badges.length > 0 && this.renderBadges(badges)}
</CardHeader>
)}
<CardTitle className="catalog-tile-pf-header">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exports[`CatalogTile href renders properly 1`] = `
class="pf-v6-c-card__header"
>
<div
class="pf-v6-c-card__actions pf-m-no-offset"
class="pf-v6-c-card__actions"
>
<div
class="pf-v6-c-card__selectable-actions"
Expand Down Expand Up @@ -80,7 +80,7 @@ exports[`CatalogTile renders properly 1`] = `
class="pf-v6-c-card__header"
>
<div
class="pf-v6-c-card__actions pf-m-no-offset"
class="pf-v6-c-card__header-main"
>
<div
class="catalog-tile-pf-badge-container"
Expand Down Expand Up @@ -134,9 +134,6 @@ exports[`CatalogTile renders properly 1`] = `
</span>
</div>
</div>
<div
class="pf-v6-c-card__header-main"
/>
</div>
<div
class="pf-v6-c-card__title"
Expand Down Expand Up @@ -189,7 +186,7 @@ exports[`CatalogTile renders properly 1`] = `
class="pf-v6-c-card__header"
>
<div
class="pf-v6-c-card__actions pf-m-no-offset"
class="pf-v6-c-card__header-main"
>
<div
class="catalog-tile-pf-badge-container"
Expand Down Expand Up @@ -252,9 +249,6 @@ exports[`CatalogTile renders properly 1`] = `
</span>
</div>
</div>
<div
class="pf-v6-c-card__header-main"
/>
</div>
<div
class="pf-v6-c-card__title"
Expand Down Expand Up @@ -300,8 +294,11 @@ exports[`CatalogTile renders properly 1`] = `
class="pf-v6-c-card__header"
>
<div
class="pf-v6-c-card__actions pf-m-no-offset"
class="pf-v6-c-card__header-main"
>
<span
class="catalog-tile-pf-icon fa fa-codepen"
/>
<div
class="catalog-tile-pf-badge-container"
>
Expand Down Expand Up @@ -335,13 +332,6 @@ exports[`CatalogTile renders properly 1`] = `
</span>
</div>
</div>
<div
class="pf-v6-c-card__header-main"
>
<span
class="catalog-tile-pf-icon fa fa-codepen"
/>
</div>
</div>
<div
class="pf-v6-c-card__title"
Expand Down Expand Up @@ -387,7 +377,21 @@ exports[`CatalogTile renders properly 1`] = `
class="pf-v6-c-card__header"
>
<div
class="pf-v6-c-card__actions pf-m-no-offset"
class="pf-v6-c-card__actions"
>
<div
class="pf-v6-c-card__selectable-actions"
>
<button
aria-labelledby="tile-footer-test"
class="pf-v6-c-card__clickable-action"
id="tile-footer-test-input"
type="button"
/>
</div>
</div>
<div
class="pf-v6-c-card__header-main"
>
<div
class="catalog-tile-pf-badge-container"
Expand Down Expand Up @@ -421,20 +425,7 @@ exports[`CatalogTile renders properly 1`] = `
</div>
</span>
</div>
<div
class="pf-v6-c-card__selectable-actions"
>
<button
aria-labelledby="tile-footer-test"
class="pf-v6-c-card__clickable-action"
id="tile-footer-test-input"
type="button"
/>
</div>
</div>
<div
class="pf-v6-c-card__header-main"
/>
</div>
<div
class="pf-v6-c-card__title"
Expand Down Expand Up @@ -500,7 +491,7 @@ exports[`CatalogTile renders properly 1`] = `
class="pf-v6-c-card__header"
>
<div
class="pf-v6-c-card__actions pf-m-no-offset"
class="pf-v6-c-card__actions"
>
<div
class="pf-v6-c-card__selectable-actions"
Expand Down

0 comments on commit 330e740

Please sign in to comment.