-
Notifications
You must be signed in to change notification settings - Fork 106
feat(alert): add pf-alert #2593
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
base: main
Are you sure you want to change the base?
Changes from 13 commits
33afe49
df55c1d
6185d07
20eaf92
544a0c6
c68683a
da3c824
4a1dacf
9a03851
147b672
e1cfe19
88e079d
8e2cd9e
d97a4f7
472fa59
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| "@patternfly/pfe-core": minor | ||
| --- | ||
|
|
||
| `SlotController`: | ||
|
|
||
| - Add `isEmpty` method to check if a slot is empty. If no slot name is provided it will check the default slot. (#2603) | ||
| - `hasSlotted` method now returns default slot if no slot name is provided. (#2603) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # PatternFly Elements Alert | ||
|
|
||
| `<pf-alert>` is a web component that provides a standard alert interface for displaying important messages to users. | ||
|
|
||
| ## Installation | ||
|
|
||
| Load `<pf-alert>` via CDN: | ||
|
|
||
| ```html | ||
| <script src="https://jspm.dev/@patternfly/elements/pf-alert/pf-alert"></script> | ||
| ``` | ||
|
|
||
| Or, if you are using [NPM](https://npm.im), install it | ||
|
|
||
| ```bash | ||
| npm install @patternfly/elements | ||
| ``` | ||
|
|
||
| Then once installed, import it to your application: | ||
|
|
||
| ```js | ||
| import '@patternfly/elements/pf-alert/pf-alert.js'; | ||
| ``` | ||
|
|
||
|
|
||
| ```html | ||
| <pf-alert variant="info" header="Info alert title"></pf-alert> | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <link rel="stylesheet" href="demo.css"> | ||
| <script type="module" src="pf-alert.js"></script> | ||
|
||
|
|
||
| <pf-alert header="Custom icon"> | ||
| <pf-icon slot="icon" set="fas" icon="users" loading="idle"></pf-icon> | ||
| </pf-alert> | ||
| <pf-alert header="Custom info icon" variant="info"> | ||
| <pf-icon slot="icon" set="fas" icon="box" loading="idle"></pf-icon> | ||
| </pf-alert> | ||
| <pf-alert header="Custom success icon" variant="success"> | ||
| <pf-icon slot="icon" set="fas" icon="database" loading="idle"></pf-icon> | ||
| </pf-alert> | ||
| <pf-alert header="Custom warning icon" variant="warning"> | ||
| <pf-icon slot="icon" set="fas" icon="server" loading="idle"></pf-icon> | ||
| </pf-alert> | ||
| <pf-alert header="Custom danger icon" variant="danger"> | ||
| <pf-icon slot="icon" set="fas" icon="laptop" loading="idle"></pf-icon> | ||
| </pf-alert> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| pf-alert { | ||
| padding: 0.5rem; | ||
| display: block; | ||
| } | ||
|
|
||
| pf-button { | ||
| display: block; | ||
| padding-block: 1em; | ||
| } | ||
|
|
||
| #timeout-alerts { | ||
| min-height: 200px; | ||
| border: 1px solid #000; | ||
| margin: 0.5rem; | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,22 @@ | ||||||||||||
| <link rel="stylesheet" href="demo.css"> | ||||||||||||
| <script type="module" src="pf-alert.js"></script> | ||||||||||||
|
||||||||||||
|
|
||||||||||||
| <h1> | ||||||||||||
| Inline | ||||||||||||
| </h1> | ||||||||||||
|
|
||||||||||||
|
||||||||||||
| <h1> | |
| Inline | |
| </h1> |
Outdated
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> | |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,124 @@ | ||||||||||||
| <link rel="stylesheet" href="demo.css"> | ||||||||||||
| <script type="module" src="pf-alert.js"></script> | ||||||||||||
|
||||||||||||
|
|
||||||||||||
| <pf-alert header="Default alert title"></pf-alert> | ||||||||||||
| <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> | ||||||||||||
|
|
||||||||||||
| <h1> | ||||||||||||
| Alert Variations | ||||||||||||
| </h1> | ||||||||||||
|
|
||||||||||||
|
||||||||||||
| <h1> | |
| Alert Variations | |
| </h1> | |
| <h2>Variants</h2> | |
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.
and the rest
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.
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,8 @@ | ||||||||||
| <link rel="stylesheet" href="demo.css"> | ||||||||||
| <script type="module" src="pf-alert.js"></script> | ||||||||||
|
|
||||||||||
| <pf-alert header="Default alert title"></pf-alert> | ||||||||||
| <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> | ||||||||||
|
||||||||||
| <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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import '@patternfly/elements/pf-alert/pf-alert.js'; | ||
| import '@patternfly/elements/pf-button/pf-button.js'; | ||
| import '@patternfly/elements/pf-icon/pf-icon.js'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| <link rel="stylesheet" href="demo.css"> | ||
| <script type="module" src="pf-alert.js"></script> | ||
|
||
|
|
||
| <h1> | ||
| Plain | ||
| </h1> | ||
|
|
||
| <pf-alert header="Default plain" plain></pf-alert> | ||
| <pf-alert variant="info" header="Info plain" plain></pf-alert> | ||
| <pf-alert variant="success" header="Success plain" plain dismissable> | ||
| <p>Success alert description. This should tell the user more information about the alert. <a href="#">This is a link.</a></p> | ||
| <button slot="actions">Ignore</button> | ||
| </pf-alert> | ||
| <pf-alert variant="warning" header="Warning plain" plain></pf-alert> | ||
| <pf-alert variant="danger" header="Danger plain" plain></pf-alert> | ||
|
|
||
| <h1> | ||
| Inline Plain | ||
| </h1> | ||
|
|
||
| <pf-alert header="Default inline" inline plain></pf-alert> | ||
| <pf-alert variant="info" header="Info inline" inline plain></pf-alert> | ||
| <pf-alert variant="success" header="Success inline" inline plain></pf-alert> | ||
| <pf-alert variant="warning" header="Warning inline" inline plain></pf-alert> | ||
| <pf-alert variant="danger" header="Danger inline" inline plain></pf-alert> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| <link rel="stylesheet" href="demo.css"> | ||
| <script type="module" src="timeout.js"></script> | ||
|
|
||
| <h1> | ||
| Timeout | ||
| </h1> | ||
|
|
||
| <pf-button id="create-timeout-alert">Create default timeout alert</pf-button> | ||
| <pf-button id="create-timeout-inline-alert">Create inline timeout alert</pf-button> | ||
| <pf-button id="create-custom-timeout-alert">Create custom timeout alert</pf-button> | ||
|
|
||
| <input type="range" id="timeout-range" min="0" max="10000" step="100" value="1000" /> | ||
| <label for="timeout-range">Timeout: <span id="timeout-value">1000</span>ms</label> | ||
| <pf-button id="create-Default-timeout-alert">Create Default timeout alert</pf-button> | ||
|
|
||
| <section id="timeout-alerts"></section> |
Uh oh!
There was an error while loading. Please reload this page.