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): added overflow alert button #4650

Merged
merged 1 commit into from
Feb 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<button class="pf-c-alert-group__overflow-button{{#if alert-group-overflow-button--modifier}} {{alert-group-overflow-button--modifier}}{{/if}}"
{{#if alert-group-overflow-button--attribute}}
{{{alert-group-overflow-button--attribute}}}
{{/if}}>
{{#if alert-group-overflow-button--text}}
{{{alert-group-overflow-button--text}}}
{{/if}}
{{#if @partial-block}}
{{> @partial-block}}
{{/if}}
</button>
41 changes: 41 additions & 0 deletions src/patternfly/components/AlertGroup/alert-group.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@
--pf-c-alert-group--m-toast--MaxWidth: #{pf-size-prem(600px)};
--pf-c-alert-group--m-toast--ZIndex: var(--pf-global--ZIndex--2xl);

// Overflow button
--pf-c-alert-group__overflow-button--BorderWidth: 0;
--pf-c-alert-group__overflow-button--PaddingTop: var(--pf-global--spacer--lg);
--pf-c-alert-group__overflow-button--PaddingRight: var(--pf-global--spacer--md);
--pf-c-alert-group__overflow-button--PaddingBottom: var(--pf-global--spacer--lg);
--pf-c-alert-group__overflow-button--PaddingLeft: var(--pf-global--spacer--md);
--pf-c-alert-group__overflow-button--Color: var(--pf-global--link--Color);
--pf-c-alert-group__overflow-button--BoxShadow: var(--pf-global--BoxShadow--lg);
--pf-c-alert-group__overflow-button--BackgroundColor: var(--pf-global--BackgroundColor--100);
--pf-c-alert-group__overflow-button--hover--Color: var(--pf-global--link--Color--hover);
--pf-c-alert-group__overflow-button--hover--BoxShadow: var(--pf-global--BoxShadow--lg), var(--pf-global--BoxShadow--lg-bottom);
--pf-c-alert-group__overflow-button--focus--Color: var(--pf-global--link--Color--hover);
--pf-c-alert-group__overflow-button--focus--BoxShadow: var(--pf-global--BoxShadow--lg), var(--pf-global--BoxShadow--lg-bottom);
--pf-c-alert-group__overflow-button--active--Color: var(--pf-global--link--Color--hover);
--pf-c-alert-group__overflow-button--active--BoxShadow: var(--pf-global--BoxShadow--lg), var(--pf-global--BoxShadow--lg-bottom);

// Spacing between alerts
> * + * {
margin-top: var(--pf-c-alert-group__item--MarginTop);
Expand All @@ -24,3 +40,28 @@
max-width: var(--pf-c-alert-group--m-toast--MaxWidth);
}
}

.pf-c-alert-group__overflow-button {
position: relative;
width: 100%;
padding: var(--pf-c-alert-group__overflow-button--PaddingTop) var(--pf-c-alert-group__overflow-button--PaddingRight) var(--pf-c-alert-group__overflow-button--PaddingBottom) var(--pf-c-alert-group__overflow-button--PaddingLeft);
color: var(--pf-c-alert-group__overflow-button--Color);
background-color: var(--pf-c-alert-group__overflow-button--BackgroundColor);
border-width: var(--pf-c-alert-group__overflow-button--BorderWidth);
box-shadow: var(--pf-c-alert-group__overflow-button--BoxShadow);

&:hover {
--pf-c-alert-group__overflow-button--Color: var(--pf-c-alert-group__overflow-button--hover--Color);
--pf-c-alert-group__overflow-button--BoxShadow: var(--pf-c-alert-group__overflow-button--hover--BoxShadow);
}

&:focus {
--pf-c-alert-group__overflow-button--Color: var(--pf-c-alert-group__overflow-button--focus--Color);
--pf-c-alert-group__overflow-button--BoxShadow: var(--pf-c-alert-group__overflow-button--focus--BoxShadow);
}

&:active {
--pf-c-alert-group__overflow-button--Color: var(--pf-c-alert-group__overflow-button--active--Color);
--pf-c-alert-group__overflow-button--BoxShadow: var(--pf-c-alert-group__overflow-button--active--BoxShadow);
}
}
6 changes: 5 additions & 1 deletion src/patternfly/components/AlertGroup/examples/AlertGroup.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ cssPrefix: pf-c-alert-group
{{/alert-action}}
{{/alert}}
{{/alert-item}}

{{#> alert-item}}
{{> alert-group-overflow-button alert-group-overflow-button--text="View 3 more notifications"}}
{{/alert-item}}
{{/alert-group}}
```
### Overview
Expand All @@ -125,7 +129,7 @@ For sighted users, interactive elements can be included in this message in one o
| Class | Applied to | Outcome |
| -- | -- | -- |
| `.pf-m-toast`| `.pf-c-alert-group` | Applies toast alert styling to an alert group. |

| `.pf-c-alert-group__overflow-button` | `<button>` | Applies overflow button styling to an alert group overflow button. |
## Documentation
### Overview
Alert groups are used to contain and align consecutive alerts. Groups can either be embedded alongside a page's content or in the top-right corner as a toast group using the `.pf-m-toast` modifier.