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): adds inline modifier #1775

Merged

Conversation

srambach
Copy link
Member

Based on design doc at https://docs.google.com/document/d/1HTkvK8_zFJAX-rhBw1aNrmZYzywixik31DzaiKCUbW4/edit#

Fixes #1390

Note: The icon padding should be broken into parts but is a breaking change so there is an issue for this in #1773

@patternfly-build
Copy link

patternfly-build commented Apr 29, 2019

Deploy preview for pf-next ready!

Built with commit a6651af

https://deploy-preview-1775--pf-next.netlify.com

@bdellasc
Copy link

Looks good to me @srambach - thanks!

--pf-c-alert__m-inline__icon--PaddingRight: 0;
--pf-c-alert__m-inline__icon--PaddingBottom: var(--pf-global--spacer--md);
--pf-c-alert__m-inline__icon--PaddingLeft: var(--pf-global--spacer--md);
--pf-c-alert--m-success-inline__icon--Color: var(--pf-global--success-color--100);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you separate these vars out into --m-[state]--m-inline, so not to confuse it as ineferring .pf-m-[state]-inline?

border-color: var(--pf-c-alert--m-inline--BorderColor);
border-style: var(--pf-c-alert--m-inline--BorderStyle);
border-width: var(--pf-c-alert--m-inline--BorderWidth);
border-left-color: var(--pf-c-alert--m-inline--BorderLeftColor);
Copy link
Contributor

Choose a reason for hiding this comment

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

You can write this in shorthand to save some lines. We also typically don't define border-style as a var, but you can if you want.

That said how about we define this border as a pseudo element instead? The triangle corner is somewhat obvious.

Screen Shot 2019-04-29 at 1 12 57 PM

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

awesome! we've needed this for a while. left a few comments for your review.

@bdellasc
Copy link

The latest changes look great, @srambach - thank you!

border-top: var(--pf-c-alert--m-inline--BorderTopWidth) solid var(--pf-c-alert--m-inline--BorderColor);
border-right: var(--pf-c-alert--m-inline--BorderRightWidth) solid var(--pf-c-alert--m-inline--BorderColor);
border-bottom: var(--pf-c-alert--m-inline--BorderBottomWidth) solid var(--pf-c-alert--m-inline--BorderColor);
border-left: var(--pf-c-alert--m-inline--BorderLeftWidth) solid var(--pf-c-alert--m-inline--BorderColor);
Copy link
Contributor

Choose a reason for hiding this comment

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

Since you don't have unique border colors (and I don't think you need them), you could write this shorter like:

    border: solid var(--pf-c-alert--m-inline--BorderColor);
    border-width: var(--pf-c-alert--m-inline--BorderTopWidth) var(--pf-c-alert--m-inline--BorderRightWidth) var(--pf-c-alert--m-inline--BorderBottomWidth) var(--pf-c-alert--m-inline--BorderLeftWidth);

position: absolute;
top: var(--pf-c-alert--before--Top);
left: 0;
z-index: var(--pf-c-alert--before--ZIndex);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you need the z-index? Doesn't look like it's necessary. Plus with this high of a z-index, I believe if another component with a lower z-index (like a dropdown menu with --pf-global--ZIndex--xs) pops up over the alert, this border would show up on top of that component.

@@ -83,14 +91,26 @@
background-color: var(--pf-c-alert--BackgroundColor);
box-shadow: var(--pf-c-alert--BoxShadow);

// left border treatment base
// color is transparent by default, then set by the state modifier classes and turned on by the inline modifier
&::before {
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about moving this into the &.pf-m-inline selector since it isn't needed on the default alert?

// left border treatment
&::before {
background-color: var(--pf-c-alert--m-inline--before--BackgroundColor);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you need this since you set --pf-c-alert--before--BackgroundColor: var(--pf-c-alert--m-inline--before--BackgroundColor); above.

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

awesome, thanks! 🥇

{{/alert-title}}
{{/alert}}
<br>
{{#> alert alert--modifier="pf-m-danger pf-m-inline" alert--attribute='aria-label="Inline Danger Alert"'}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{{#> alert alert--modifier="pf-m-danger pf-m-inline" alert--attribute='aria-label="Inline Danger Alert"'}}
{{#> alert alert--modifier="pf-m-danger pf-m-inline" alert--attribute='aria-label="Inline danger alert"'}}

{{/alert-title}}
{{/alert}}
<br>
{{#> alert alert--modifier="pf-m-warning pf-m-inline" alert--attribute='aria-label="Inline Warning Alert"'}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{{#> alert alert--modifier="pf-m-warning pf-m-inline" alert--attribute='aria-label="Inline Warning Alert"'}}
{{#> alert alert--modifier="pf-m-warning pf-m-inline" alert--attribute='aria-label="Inline warning alert"'}}

{{/alert-title}}
{{/alert}}
<br>
{{#> alert alert--modifier="pf-m-success pf-m-inline" alert--attribute='aria-label="Inline Success Alert"'}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{{#> alert alert--modifier="pf-m-success pf-m-inline" alert--attribute='aria-label="Inline Success Alert"'}}
{{#> alert alert--modifier="pf-m-success pf-m-inline" alert--attribute='aria-label="Inline success alert"'}}

@@ -0,0 +1,35 @@
{{#> alert alert--modifier="pf-m-info pf-m-inline" alert--attribute='aria-label="Inline Information Alert"'}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{{#> alert alert--modifier="pf-m-info pf-m-inline" alert--attribute='aria-label="Inline Information Alert"'}}
{{#> alert alert--modifier="pf-m-info pf-m-inline" alert--attribute='aria-label="Inline information alert"'}}

@@ -24,6 +27,9 @@ export default () => {
<Example heading="Alert Variations" handlebars={AlertVariationsRaw}>
{alertVariations}
</Example>
<Example heading="Inline Alert Types" handlebars={AlertInlineRaw}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<Example heading="Inline Alert Types" handlebars={AlertInlineRaw}>
<Example heading="Inline alert types" handlebars={AlertInlineRaw}>

@srambach srambach force-pushed the inline-alert-variation-1390 branch 2 times, most recently from 88468a3 to 8cdf421 Compare May 6, 2019 18:22
import docs from '../docs/code.md';

export const Docs = docs;

export default (props) => {
export default props => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you either rebase or put the () around props?

@christiemolloy
Copy link
Member

The icon size in the doc vs what you have in the PR, looks different. Could you check with design and see what exact size they want?

Screen Shot 2019-05-13 at 11 26 20 AM

Screen Shot 2019-05-13 at 11 26 28 AM

@christiemolloy
Copy link
Member

I think it would also be worth showing an example of an inline notification with a close button

Screen Shot 2019-05-13 at 11 31 07 AM

@bdellasc
Copy link

Good catch, @christiemolloy - it's my bad for not pointing out that icon size tweak to @srambach when we went over the design. I brought the size down when we dropped the BG behind the icon because visually, it feels more like an inline icon next to the title, so having the larger size felt a little too big to me without that BG visually separating it from the text.

@@ -49,8 +49,36 @@
--pf-c-alert--m-info__icon--BackgroundColor: var(--pf-global--info-color--100);
--pf-c-alert--m-info__title--Color: var(--pf-global--info-color--200);

// Inline modification
--pf-c-alert--m-inline__title--Color: var(--pf-global--Color--100);
Copy link
Contributor

@mcoker mcoker May 22, 2019

Choose a reason for hiding this comment

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

Can you move this var below the icon element vars?

@@ -4,15 +4,20 @@ import Example from '@siteComponents/Example';

import AlertTypesRaw from '!raw!./alert-types-example.hbs';
import AlertVariationsRaw from '!raw!./alert-variations-example.hbs';
import AlertInlineRaw from '!raw!./alert-inline-example.hbs';
Copy link
Contributor

Choose a reason for hiding this comment

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

can you move this above the AlertVariationsRaw line that comes before it so AlertInline comes before AlertInlineVariations throughout this file?

--pf-c-alert--m-inline--BorderLeftWidth: 0;
--pf-c-alert--m-inline--before--Width: var(--pf-global--BorderWidth--lg);
--pf-c-alert--m-inline--before--Top: calc(-1 * var(--pf-c-alert--m-inline--BorderTopWidth));
--pf-c-alert--m-inline--before--Height: calc(100% + var(--pf-c-alert--m-inline--BorderTopWidth) + var(--pf-c-alert--m-inline--BorderBottomWidth));
Copy link
Contributor

Choose a reason for hiding this comment

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

this works, but you could also remove height and use bottom instead as --pf-c-alert--m-inline--before--Bottom: calc(-1 * var(--pf-c-alert--m-inline--BorderBottomWidth)); (the same way you define top)

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

lgtm! just a few small things I commented on.

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

🥇

Copy link
Contributor

@matthewcarleton matthewcarleton left a comment

Choose a reason for hiding this comment

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

Nice Work!!!

@matthewcarleton matthewcarleton merged commit 04641c9 into patternfly:master May 23, 2019
@patternfly-build
Copy link

🎉 This PR is included in version 2.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

srambach referenced this pull request in mcoker/patternfly-next May 28, 2019
* feat(alert): adds inline modifier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants