-
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): adds inline modifier #1775
feat(alert): adds inline modifier #1775
Conversation
Deploy preview for pf-next ready! Built with commit a6651af |
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); |
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 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); |
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.
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.
awesome! we've needed this for a while. left a few comments for your review.
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); |
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.
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); |
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.
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 { |
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.
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); | ||
} |
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.
I don't think you need this since you set --pf-c-alert--before--BackgroundColor: var(--pf-c-alert--m-inline--before--BackgroundColor);
above.
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.
awesome, thanks! 🥇
{{/alert-title}} | ||
{{/alert}} | ||
<br> | ||
{{#> alert alert--modifier="pf-m-danger pf-m-inline" alert--attribute='aria-label="Inline Danger 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.
{{#> 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"'}} |
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 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"'}} |
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 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"'}} |
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 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}> |
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.
<Example heading="Inline Alert Types" handlebars={AlertInlineRaw}> | |
<Example heading="Inline alert types" handlebars={AlertInlineRaw}> |
88468a3
to
8cdf421
Compare
import docs from '../docs/code.md'; | ||
|
||
export const Docs = docs; | ||
|
||
export default (props) => { | ||
export default props => { |
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 you either rebase or put the ()
around props
?
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. |
6ccf111
to
4498f53
Compare
@@ -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); |
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 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'; |
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 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)); |
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.
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
)
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.
lgtm! just a few small things I commented on.
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.
🥇
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.
Nice Work!!!
🎉 This PR is included in version 2.7.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
* feat(alert): adds inline modifier
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