-
Notifications
You must be signed in to change notification settings - Fork 96
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
feat(alert): add pf-alert #2593
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 472fa59 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for patternfly-elements ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
… feat/add-pf-alert
….Add function to SlotController
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some preliminary comments. i didn't get to the lifecycle or template or styles yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some more notes
const hasContent = this.#slots.hasAnonymousSlot(); | ||
|
||
return html` | ||
<div id="container" role="alert" aria-hidden="false" class="${classMap({ truncateTitle })}"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can a role=alert
have interactive children @nikkimk?
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/Alert_Role
…nfly-elements into feat/add-pf-alert
Co-authored-by: Benny Powers <[email protected]>
…nfly-elements into feat/add-pf-alert
<link rel="stylesheet" href="demo.css"> | ||
<script type="module" src="pf-alert.js"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's prefer to inline this stuff, to make the demos easier to grok
elements/pf-alert/demo/inline.html
Outdated
<link rel="stylesheet" href="demo.css"> | ||
<script type="module" src="pf-alert.js"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above, re: inline
elements/pf-alert/demo/inline.html
Outdated
<h1> | ||
Inline | ||
</h1> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<h1> | |
Inline | |
</h1> |
elements/pf-alert/demo/inline.html
Outdated
<h1> | ||
Inline Plain | ||
</h1> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<h1> | |
Inline Plain | |
</h1> | |
<h2>Plain</h2> | |
<link rel="stylesheet" href="demo.css"> | ||
<script type="module" src="pf-alert.js"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inline
elements/pf-alert/demo/pf-alert.html
Outdated
<pf-alert variant="info" header="Info alert title"></pf-alert> | ||
<pf-alert variant="success" header="Success alert title"></pf-alert> | ||
<pf-alert variant="warning" header="Warning alert title"></pf-alert> | ||
<pf-alert variant="danger" header="Danger alert title"></pf-alert> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<pf-alert variant="info" header="Info alert title"></pf-alert> | |
<pf-alert variant="success" header="Success alert title"></pf-alert> | |
<pf-alert variant="warning" header="Warning alert title"></pf-alert> | |
<pf-alert variant="danger" header="Danger alert title"></pf-alert> |
we can leave these for variants.html
elements/pf-alert/demo/plain.html
Outdated
<link rel="stylesheet" href="demo.css"> | ||
<script type="module" src="pf-alert.js"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inline
elements/pf-alert/pf-alert.css
Outdated
--pf-alert-title-color: var(--pf-alert-title-color, var(--pf-global--default-color--300, #003737)); | ||
--pf-alert-icon-color: var(--pf-alert-icon-color, var(--pf-global--default-color--200, #009596)); | ||
--pf-alert-inline-background-color: var(--pf-global--palette--cyan-50, #f2f9f9); | ||
--alert-title-color: var(--alert-title-color, var(--pf-global--default-color--300, #003737)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--alert-title-color: var(--alert-title-color, var(--pf-global--default-color--300, #003737)); | |
--_alert-title-color: var(--pf-global--default-color--300, #003737); |
etc, and at call sites
danger: { set: 'fas', icon: 'exclamation-circle' }, | ||
info: { set: 'fas', icon: 'info-circle' }, | ||
close: { set: 'patternfly', icon: 'close' }, | ||
get(name: 'default' | 'success' | 'warning' | 'danger' | 'info' | 'close') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove get()
and reference the data here in render
elements/pf-alert/pf-alert.ts
Outdated
const hasActions = this.#slots.hasSlotted('actions'); | ||
const hasDescriptionContent = this.#slots.hasSlotted(); | ||
|
||
return html` | ||
<div id="container" role="alert" aria-hidden="false" class="${classMap({ truncateTitle })}"> | ||
<div id="left-column" part="left-column"> | ||
<slot name="icon" id="icon">${icon}</slot> | ||
<slot name="icon" id="icon">${this.#icon}</slot> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inline the pf-icon, reference data in ICONS
directly here. remove #icon
@@ -1,5 +1,4 @@ | |||
<link rel="stylesheet" href="demo.css"> | |||
<script type="module" src="pf-alert.js"></script> | |||
<link rel="stylesheet" href="demo.css"><script type="module" src="pf-alert.js"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the sake of clarity, What I mean by inline is to replace <link href
with <style and <script src with <script
In other words, each demo file would be self contained except for the files we ship in our package
Thanks @brianferry ! If you don't mind, I'd like to continue with this. I started with your work in my branch https://github.com/martinpitt/patternfly-elements/tree/pf-alert and now I am adding some commits on top. The demo at least works again, but this still needs a lot of effort, so no new PR yet. |
#2539
What I did
Testing Instructions
Notes to Reviewers