Skip to content

Commit 330e740

Browse files
authored
Merge pull request #76 from nicolethoen/fix_console_errors
fix: prevent console errors for read only badges in card actions
2 parents ebd8588 + 602f9f6 commit 330e740

File tree

4 files changed

+31
-33
lines changed

4 files changed

+31
-33
lines changed

packages/module/patternfly-docs/content/examples/catalogTile.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
color: var(--pf-t--global--text--color--regular);
33
text-decoration: none;
44
}
5+
.ws-react-e-catalog-tile .pf-v6-c-card__header-main {
6+
display: flex;
7+
}
58
.ws-react-e-catalog-tile .catalog-tile-pf-header .catalog-tile-pf-subtitle {
69
color: var(--pf-t--global--text--color--subtle);
710
font-size: var(--pf-t--global--font--size--body--sm);

packages/module/sass/react-catalog-view-extension/_catalog-tile.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
text-decoration: none;
1212
}
1313

14+
.pf-v6-c-card__header-main {
15+
display: flex;
16+
}
17+
1418
.pf-v6-c-card__actions {
1519
padding-left: 5px;
1620
}

packages/module/src/components/CatalogTile/CatalogTile.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ export class CatalogTile extends React.Component<CatalogTileProps> {
119119
>
120120
{(badges.length > 0 || iconImg || iconClass || icon || onClick || href) && (
121121
<CardHeader
122-
actions={{ actions: badges.length > 0 && this.renderBadges(badges), hasNoOffset: true }}
123122
selectableActions={ (onClick || href) && {
124123
selectableActionId: id + '-input',
125124
onClickAction: (e) => this.handleClick(e),
@@ -129,6 +128,7 @@ export class CatalogTile extends React.Component<CatalogTileProps> {
129128
>
130129
{iconImg && <img className="catalog-tile-pf-icon" src={iconImg} alt={iconAlt} />}
131130
{!iconImg && (iconClass || icon) && <span className={`catalog-tile-pf-icon ${iconClass}`}>{icon}</span>}
131+
{badges.length > 0 && this.renderBadges(badges)}
132132
</CardHeader>
133133
)}
134134
<CardTitle className="catalog-tile-pf-header">

packages/module/src/components/CatalogTile/__snapshots__/CatalogTile.test.tsx.snap

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ exports[`CatalogTile href renders properly 1`] = `
1313
class="pf-v6-c-card__header"
1414
>
1515
<div
16-
class="pf-v6-c-card__actions pf-m-no-offset"
16+
class="pf-v6-c-card__actions"
1717
>
1818
<div
1919
class="pf-v6-c-card__selectable-actions"
@@ -80,7 +80,7 @@ exports[`CatalogTile renders properly 1`] = `
8080
class="pf-v6-c-card__header"
8181
>
8282
<div
83-
class="pf-v6-c-card__actions pf-m-no-offset"
83+
class="pf-v6-c-card__header-main"
8484
>
8585
<div
8686
class="catalog-tile-pf-badge-container"
@@ -134,9 +134,6 @@ exports[`CatalogTile renders properly 1`] = `
134134
</span>
135135
</div>
136136
</div>
137-
<div
138-
class="pf-v6-c-card__header-main"
139-
/>
140137
</div>
141138
<div
142139
class="pf-v6-c-card__title"
@@ -189,7 +186,7 @@ exports[`CatalogTile renders properly 1`] = `
189186
class="pf-v6-c-card__header"
190187
>
191188
<div
192-
class="pf-v6-c-card__actions pf-m-no-offset"
189+
class="pf-v6-c-card__header-main"
193190
>
194191
<div
195192
class="catalog-tile-pf-badge-container"
@@ -252,9 +249,6 @@ exports[`CatalogTile renders properly 1`] = `
252249
</span>
253250
</div>
254251
</div>
255-
<div
256-
class="pf-v6-c-card__header-main"
257-
/>
258252
</div>
259253
<div
260254
class="pf-v6-c-card__title"
@@ -300,8 +294,11 @@ exports[`CatalogTile renders properly 1`] = `
300294
class="pf-v6-c-card__header"
301295
>
302296
<div
303-
class="pf-v6-c-card__actions pf-m-no-offset"
297+
class="pf-v6-c-card__header-main"
304298
>
299+
<span
300+
class="catalog-tile-pf-icon fa fa-codepen"
301+
/>
305302
<div
306303
class="catalog-tile-pf-badge-container"
307304
>
@@ -335,13 +332,6 @@ exports[`CatalogTile renders properly 1`] = `
335332
</span>
336333
</div>
337334
</div>
338-
<div
339-
class="pf-v6-c-card__header-main"
340-
>
341-
<span
342-
class="catalog-tile-pf-icon fa fa-codepen"
343-
/>
344-
</div>
345335
</div>
346336
<div
347337
class="pf-v6-c-card__title"
@@ -387,7 +377,21 @@ exports[`CatalogTile renders properly 1`] = `
387377
class="pf-v6-c-card__header"
388378
>
389379
<div
390-
class="pf-v6-c-card__actions pf-m-no-offset"
380+
class="pf-v6-c-card__actions"
381+
>
382+
<div
383+
class="pf-v6-c-card__selectable-actions"
384+
>
385+
<button
386+
aria-labelledby="tile-footer-test"
387+
class="pf-v6-c-card__clickable-action"
388+
id="tile-footer-test-input"
389+
type="button"
390+
/>
391+
</div>
392+
</div>
393+
<div
394+
class="pf-v6-c-card__header-main"
391395
>
392396
<div
393397
class="catalog-tile-pf-badge-container"
@@ -421,20 +425,7 @@ exports[`CatalogTile renders properly 1`] = `
421425
</div>
422426
</span>
423427
</div>
424-
<div
425-
class="pf-v6-c-card__selectable-actions"
426-
>
427-
<button
428-
aria-labelledby="tile-footer-test"
429-
class="pf-v6-c-card__clickable-action"
430-
id="tile-footer-test-input"
431-
type="button"
432-
/>
433-
</div>
434428
</div>
435-
<div
436-
class="pf-v6-c-card__header-main"
437-
/>
438429
</div>
439430
<div
440431
class="pf-v6-c-card__title"
@@ -500,7 +491,7 @@ exports[`CatalogTile renders properly 1`] = `
500491
class="pf-v6-c-card__header"
501492
>
502493
<div
503-
class="pf-v6-c-card__actions pf-m-no-offset"
494+
class="pf-v6-c-card__actions"
504495
>
505496
<div
506497
class="pf-v6-c-card__selectable-actions"

0 commit comments

Comments
 (0)