Skip to content
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

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions core/pfe-core/controllers/slot-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ export class SlotController implements ReactiveController {
}
}

hasAnonymousSlot(): boolean {
brianferry marked this conversation as resolved.
Show resolved Hide resolved
return this.#nodes.get(SlotController.anonymous)?.hasContent ?? false;
}

/**
* Given a slot name or slot names, returns elements assigned to the requested slots as an array.
* If no value is provided, it returns all children not assigned to a slot (without a slot attribute).
Expand Down
61 changes: 54 additions & 7 deletions elements/pf-alert/demo/pf-alert.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,45 @@
<link rel="stylesheet" href="demo.css">
<script type="module" src="pf-alert.js"></script>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inline


<pf-alert title="Default"></pf-alert>
<pf-alert variant="info" title="Info"></pf-alert>
<pf-alert variant="success" title="Success"></pf-alert>
<pf-alert variant="warning" title="Warning"></pf-alert>
<pf-alert variant="danger" title="Danger"></pf-alert>
<pf-alert title="Default alert title"></pf-alert>
brianferry marked this conversation as resolved.
Show resolved Hide resolved
<pf-alert variant="info" title="Info alert title"></pf-alert>
<pf-alert variant="success" title="Success alert title"></pf-alert>
<pf-alert variant="warning" title="Warning alert title"></pf-alert>
<pf-alert variant="danger" title="Danger alert title"></pf-alert>

<h1>
Alert Variations
</h1>

<pf-alert title="Success alert title" variant="success" dismissable>
<p>Success alert description. This should tell the user more information about the alert.</p>
<button slot="actions">View details</button>
<button slot="actions">Ignore</button>
</pf-alert>

<pf-alert title="Success alert title" variant="success" dismissable>
<p>Success alert description. This should tell the user more information about the alert. <a href="#">This is a link.</a></p>
<p>Success alert description. This should tell the user more information about the alert. <a href="#">This is a link.</a></p>
</pf-alert>

<pf-alert title="Success alert title" variant="success" dismissable>
<button slot="actions">View details</button>
<button slot="actions">Ignore</button>
</pf-alert>

<pf-alert title="Success alert title" variant="success" dismissable>

<p>Success alert description. This should tell the user more information about the alert. <a href="#">This is a link.</a></p>
<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">View details</button>
<button slot="actions">Ignore</button>
<button slot="actions">Ignore</button>
<button slot="actions">Ignore</button>
<button slot="actions">Ignore</button>
<button slot="actions">Ignore</button>
</pf-alert>

<pf-alert title="Success alert title" variant="success" dismissable></pf-alert>

<h1>
Default Icons
Expand Down Expand Up @@ -33,7 +67,10 @@ <h1>

<pf-alert title="Default plain" plain></pf-alert>
<pf-alert variant="info" title="Info plain" plain></pf-alert>
<pf-alert variant="success" title="Success plain" plain></pf-alert>
<pf-alert variant="success" title="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" title="Warning plain" plain></pf-alert>
<pf-alert variant="danger" title="Danger plain" plain></pf-alert>

Expand All @@ -48,7 +85,17 @@ <h1>
<pf-alert variant="danger" title="Danger inline" inline></pf-alert>

<h1>
Inline
Plain
</h1>

<pf-alert title="Default inline" plain></pf-alert>
<pf-alert variant="info" title="Info inline" plain></pf-alert>
<pf-alert variant="success" title="Success inline" plain></pf-alert>
<pf-alert variant="warning" title="Warning inline" plain></pf-alert>
<pf-alert variant="danger" title="Danger inline" plain></pf-alert>

<h1>
Inline Plain
</h1>

<pf-alert title="Default inline" inline plain></pf-alert>
Expand Down
Loading
Loading