Skip to content

Commit cec0ca3

Browse files
zeroedinbennypowersmarkcaron
authored
feat(banner)!: port to pf-v6-banner (#3143)
* feat(banner): add pf-v6-banner * style: format * style: unused import * chore: remove pf-v5-banner * fix(banner): correct jsdoc to cem documentation comments * chore: add changeset * docs(banner): add README * docs(banner): remove noise * test(banner): add missing spec tests * docs(banner): missing docs markdown and screenshot * test(banner): missing e2e test file * fix(banner): rename screen-reader-text to accessible-label * docs: readme, jsdoc * docs: update references to banner * refactor: use static css * fix!: remove accessible-label and screen-reader-text instruct downstream users to slot visually hidden text instead * fix: remove references to v5 --------- Co-authored-by: Benny Powers <web@bennypowers.com> Co-authored-by: Mark Caron <mark.caron@gmail.com>
1 parent baf703f commit cec0ca3

25 files changed

Lines changed: 747 additions & 505 deletions

.changeset/smooth-webs-travel.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
"@patternfly/elements": major
3+
---
4+
5+
`<pf-v6-banner>`: replaces `<pf-v5-banner>` with PatternFly v6 design specs.
6+
7+
```html
8+
<pf-v6-banner status="info">
9+
<span class="pf-v6-screen-reader">Info alert:</span>
10+
Info banner content
11+
</pf-v6-banner>
12+
```
13+
14+
**Breaking Changes from v5**
15+
16+
- Renamed tag from `<pf-v5-banner>` to `<pf-v6-banner>`
17+
- `variant` attribute split into separate `color` and `status` attributes
18+
- CSS custom properties renamed from `--pf-v5-c-banner--*` to `--pf-v6-c-banner--*`
19+
- Removed `icon` attribute and `icon` slot (compose icons in default slot)
20+
- Removed `container` and `icon` CSS parts
21+
22+
**New features**
23+
24+
- `color` attribute for decorative colors (red, orangered, orange, yellow, green, teal, blue, purple)
25+
- `status` attribute for semantic statuses (success, warning, danger, info, custom)

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ core/pfe-core/demo/*
105105

106106
# AI
107107
.claude/settings.local.json
108+
.claude/worktrees
108109

109110
# Temp files
110111
*~

docs/main.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { PfV5Icon } from '@patternfly/elements/pf-v5-icon/pf-v5-icon.js';
33
import '@patternfly/elements/pf-v5-accordion/pf-v5-accordion.js';
44
import '@patternfly/elements/pf-v5-alert/pf-v5-alert.js';
55
import '@patternfly/elements/pf-v5-back-to-top/pf-v5-back-to-top.js';
6-
import '@patternfly/elements/pf-v5-banner/pf-v5-banner.js';
76
import '@patternfly/elements/pf-v5-button/pf-v5-button.js';
87
import '@patternfly/elements/pf-v5-card/pf-v5-card.js';
98
import '@patternfly/elements/pf-v5-chip/pf-v5-chip.js';
@@ -28,9 +27,11 @@ import '@patternfly/elements/pf-v5-text-area/pf-v5-text-area.js';
2827
import '@patternfly/elements/pf-v5-text-input/pf-v5-text-input.js';
2928
import '@patternfly/elements/pf-v5-tile/pf-v5-tile.js';
3029
import '@patternfly/elements/pf-v5-tooltip/pf-v5-tooltip.js';
30+
3131
import '@patternfly/elements/pf-v6-avatar/pf-v6-avatar.js';
3232
import '@patternfly/elements/pf-v6-background-image/pf-v6-background-image.js';
3333
import '@patternfly/elements/pf-v6-badge/pf-v6-badge.js';
34+
import '@patternfly/elements/pf-v6-banner/pf-v6-banner.js';
3435
import '@patternfly/elements/pf-v6-spinner/pf-v6-spinner.js';
3536
import '@patternfly/elements/pf-v6-switch/pf-v6-switch.js';
3637
import '@patternfly/elements/pf-v6-timestamp/pf-v6-timestamp.js';
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<pf-v6-banner status="info" id="top">
2+
<pf-v5-icon icon="info-circle"></pf-v5-icon>
3+
<span class="pf-v6-screen-reader">Accessibility warning:</span>
4+
<strong>Accessibility Warning</strong> Using the Button/JS variant, implementation must apply click event and focus to the element that is scrolled to.
5+
</pf-v6-banner>
6+
<div class="outer-container">
7+
<div class="scroll-indicator padded">
8+
<h2>Button</h2>
9+
<p><a href="#focusable-element-top">Focusable element (top)</a></p>
10+
<pf-v5-icon icon="arrow-down"></pf-v5-icon> Scroll down to end of cyan box, 400px (default).
11+
</div>
12+
</div>
13+
<a href="#focusable-element-bottom">Focusable element (bottom)</a>
14+
15+
<pf-v5-back-to-top scrollable-selector="main">Back to top</pf-v5-back-to-top>
16+
17+
<script type="module">
18+
import '@patternfly/elements/pf-v5-back-to-top/pf-v5-back-to-top.js';
19+
import '@patternfly/elements/pf-v6-banner/pf-v6-banner.js';
20+
document.querySelector('pf-v5-back-to-top').addEventListener('click', function() {
21+
// scroll to some element
22+
const target = document.querySelector('#top');
23+
target.scrollIntoView();
24+
target.focus();
25+
});
26+
</script>
27+
28+
<style>
29+
:root {
30+
--_scroll-distance: 400px;
31+
}
32+
33+
main {
34+
scroll-behavior: smooth;
35+
}
36+
37+
.scroll-distance {
38+
--_scroll-distance: 200px;
39+
}
40+
41+
.outer-container {
42+
height: calc(100vh - var(--pf-v5-demo-header-height) + var(--_scroll-distance));
43+
}
44+
45+
.padded {
46+
padding: var(--pf-global--spacer--md, 1rem);
47+
}
48+
49+
.scroll-indicator {
50+
height: var(--_scroll-distance);
51+
background-color: var(--pf-global--palette--cyan-50, #f2f9f9) !important;
52+
}
53+
</style>

elements/pf-v5-banner/README.md

Lines changed: 0 additions & 60 deletions
This file was deleted.

elements/pf-v5-banner/demo/index.html

Lines changed: 0 additions & 15 deletions
This file was deleted.

elements/pf-v5-banner/demo/status-banners.html

Lines changed: 0 additions & 40 deletions
This file was deleted.

elements/pf-v5-banner/demo/sticky.html

Lines changed: 0 additions & 55 deletions
This file was deleted.

elements/pf-v5-banner/docs/pf-v5-banner.md

Lines changed: 0 additions & 59 deletions
This file was deleted.
-11.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)