This repository has been archived by the owner on Nov 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
Updating MessageBar to reuse other components and reduce custom CSS #87
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file modified
BIN
-35 Bytes
(100%)
config/styleguide-visual/reference/MessageBar_with_icon_action_desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,5 @@ module.exports = () => ({ | |
path: [''], | ||
}, | ||
precss: {}, | ||
autoprefixer: {}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
|
||
.y-fixedGridRow { | ||
display: flex; | ||
flex-basis: 100%; | ||
} | ||
|
||
.y-fixedGridRow__bottomSpacing-xxLarge { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,19 @@ | ||
/*! Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. */ | ||
@import "src/css/variables/colors.css"; | ||
@import "src/css/variables/fonts.css"; | ||
|
||
.y-message-bar { | ||
display: flex; | ||
background-color: $messageBarBackgroundColor; | ||
border: solid 0 $alertColor__info; | ||
border-radius: 1px; | ||
border-left-width: 4px; | ||
border-left-style: solid; | ||
background-color: $messageBarBackgroundColor; | ||
padding: 7px 12px 8px 12px; | ||
font-size: $fontSize__small; | ||
line-height: $lineHeight__small; | ||
} | ||
|
||
.y-message-bar--message { | ||
flex-grow: 1; | ||
color: $messageBarTextColor; | ||
} | ||
|
||
.y-message-bar--actions { | ||
padding-left: 32px; | ||
flex-grow: 0; | ||
} | ||
|
||
.y-message-bar__type-info { | ||
border-left-color: $messageBarBorderColor__info; | ||
color: $textColor; | ||
padding: 7px 12px 8px; | ||
} | ||
|
||
.y-message-bar__type-warning { | ||
border-left-color: $messageBarBorderColor__warning; | ||
border-color: $alertColor__warning; | ||
} | ||
|
||
.y-message-bar__type-error { | ||
border-left-color: $messageBarBorderColor__error; | ||
border-color: $alertColor__error; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 47 additions & 39 deletions
86
src/components/MessageBar/__snapshots__/MessageBar.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,68 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`<FakeLink /> with a type matches its snapshot 1`] = ` | ||
<div | ||
aria-label="label" | ||
exports[`<MessageBar /> with a type matches its snapshot 1`] = ` | ||
<Block | ||
className="y-message-bar y-message-bar__type-warning" | ||
textSize="small" | ||
> | ||
<div | ||
className="y-message-bar--message" | ||
<FixedGridRow | ||
gutterSize="xxLarge" | ||
> | ||
content | ||
</div> | ||
</div> | ||
<FixedGridColumn> | ||
content | ||
</FixedGridColumn> | ||
</FixedGridRow> | ||
</Block> | ||
`; | ||
|
||
exports[`<FakeLink /> with actions matches its snapshot 1`] = ` | ||
<div | ||
aria-label="label" | ||
exports[`<MessageBar /> with actions matches its snapshot 1`] = ` | ||
<Block | ||
className="y-message-bar y-message-bar__type-info" | ||
textSize="small" | ||
> | ||
<div | ||
className="y-message-bar--message" | ||
<FixedGridRow | ||
gutterSize="xxLarge" | ||
> | ||
content | ||
</div> | ||
<div | ||
className="y-message-bar--actions" | ||
> | ||
<FakeLink> | ||
Link | ||
</FakeLink> | ||
</div> | ||
</div> | ||
<FixedGridColumn> | ||
content | ||
</FixedGridColumn> | ||
<FixedGridColumn | ||
fixed={true} | ||
> | ||
<FakeLink> | ||
Link | ||
</FakeLink> | ||
</FixedGridColumn> | ||
</FixedGridRow> | ||
</Block> | ||
`; | ||
|
||
exports[`<FakeLink /> with additional className matches its snapshot 1`] = ` | ||
<div | ||
aria-label="label" | ||
exports[`<MessageBar /> with additional className matches its snapshot 1`] = ` | ||
<Block | ||
className="y-message-bar y-message-bar__type-info TEST_CLASSNAME" | ||
textSize="small" | ||
> | ||
<div | ||
className="y-message-bar--message" | ||
<FixedGridRow | ||
gutterSize="xxLarge" | ||
> | ||
content | ||
</div> | ||
</div> | ||
<FixedGridColumn> | ||
content | ||
</FixedGridColumn> | ||
</FixedGridRow> | ||
</Block> | ||
`; | ||
|
||
exports[`<FakeLink /> with default options matches its snapshot 1`] = ` | ||
<div | ||
aria-label="label" | ||
exports[`<MessageBar /> with default options matches its snapshot 1`] = ` | ||
<Block | ||
className="y-message-bar y-message-bar__type-info" | ||
textSize="small" | ||
> | ||
<div | ||
className="y-message-bar--message" | ||
<FixedGridRow | ||
gutterSize="xxLarge" | ||
> | ||
content | ||
</div> | ||
</div> | ||
<FixedGridColumn> | ||
content | ||
</FixedGridColumn> | ||
</FixedGridRow> | ||
</Block> | ||
`; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why are the extra
div
s necessary?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.
took a little head-scratching to figure out why the visual diffs were messed up for this story. basically i'd fixed a FixedGridRow bug via
flex-basis: 100%
because previously it would only fill its horizontal space if its column content pushed it out that far. in your example, your flex container's direct children were also display: flex and now have flex-basis: 100% so they filled the entire vertical space instead of being clustered in the center of the wrapper.in general it's best to not use flexbox containers as direct children of another flexbox container, you should have another div or something to manage the flex-child layout then nest the next flex container under that
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.
Aah I didn't stop to think that
FixedGridRow
was alsodisplay: flex
.