-
Notifications
You must be signed in to change notification settings - Fork 887
[Feature Notification] Add a euiAnimation method on the EuiHeaderSectionItemButton ref #4424
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
Merged
elizabetdev
merged 25 commits into
elastic:feature/notification
from
elizabetdev:notification_header_button
Feb 11, 2021
Merged
Changes from 11 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
915a2d1
Adding animation and hasBackground props to EuiHeaderSectionItemButton
elizabetdev 14d5b51
A few improvements
elizabetdev cc5c874
Docs props
elizabetdev 4f5c09f
Removing hasBackground prop
elizabetdev e020d7a
Using JS do hide and show on xs breakpoints
elizabetdev c6f7bc3
Adding a snippet
elizabetdev 41a54c8
refactor animation prop into a ref method
chandlerprall e4b21e1
Merge pull request #8 from chandlerprall/notification_header_button_m…
elizabetdev d5923d3
Snapshots. Trigger animation comments.
elizabetdev 4d3c970
Deleting unused css animation
elizabetdev 8253863
triggerAnimation explanation
elizabetdev 46a3d77
Cleaned up some logic and created a docs example specifically for the…
f88a657
Merge pull request #11 from cchaos/notification_header_button
elizabetdev aba5d8e
re-enable the animation test
chandlerprall d13e053
Merge pull request #12 from chandlerprall/notification_header_button_…
elizabetdev f3a8851
Update src-docs/src/views/header/header_animate.js
elizabetdev 733ae30
Update src-docs/src/views/header/header_example.js
elizabetdev 4634390
Update src-docs/src/views/header/header_alert.js
elizabetdev b4eb475
Update src-docs/src/views/header/header_alert.js
elizabetdev 10736bd
Update src-docs/src/views/header/header_animate.js
elizabetdev 4b396ac
Update src-docs/src/views/header/header_example.js
elizabetdev 36c586d
renaming animate methods to euiAnimate
elizabetdev 67d1c48
euiAnimate into header example
elizabetdev c5b041e
simplifying onClick closeFlyout
elizabetdev d431074
Update src-docs/src/views/header/header_example.js
elizabetdev 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -67,7 +67,8 @@ const headerSnippet = `<EuiHeader> | |
| <!-- HeaderSectionItem content --> | ||
| </EuiHeaderSectionItem> | ||
| </EuiHeaderSection> | ||
| </EuiHeader>`; | ||
| </EuiHeader> | ||
| `; | ||
|
|
||
| const headerSectionsSnippet = `<EuiHeader | ||
| sections={[ | ||
|
|
@@ -105,6 +106,30 @@ const headerLinksSnippet = `<EuiHeader> | |
| </EuiHeaderLinks> | ||
| </EuiHeader>`; | ||
|
|
||
| const headerAlertSnippet = `<EuiHeader> | ||
| <EuiHeaderSection grow={false}> | ||
| <EuiHeaderSectionItem> | ||
| <!-- HeaderSectionItem content --> | ||
| </EuiHeaderSectionItem> | ||
| </EuiHeaderSection> | ||
|
|
||
| <EuiHeaderSection side="right"> | ||
| <EuiHeaderSectionItem> | ||
| <!-- Button to trigger portal content like a EuiPopover or a EuiFlyout --> | ||
| <EuiHeaderSectionItemButton | ||
| aria-controls={portalContentId} | ||
| aria-expanded={isPortalContentVisible} | ||
| aria-label="Open portal content" | ||
| onClick={() => showPortalConten()} | ||
| notification={showNotification} | ||
| animation={isAnimating} | ||
| > | ||
| <EuiIcon type="bell" /> | ||
| </EuiHeaderSectionItemButton> | ||
| </EuiHeaderSectionItem> | ||
| </EuiHeaderSection> | ||
| </EuiHeader>`; | ||
|
|
||
| export const HeaderExample = { | ||
| title: 'Header', | ||
| sections: [ | ||
|
|
@@ -279,7 +304,7 @@ export const HeaderExample = { | |
| demo: <HeaderDark theme={lightColors} />, | ||
| }, | ||
| { | ||
| title: 'Portal content in the header', | ||
| title: 'Portal content and buttons in the header', | ||
| source: [ | ||
| { | ||
| type: GuideSectionTypes.JS, | ||
|
|
@@ -311,16 +336,39 @@ export const HeaderExample = { | |
| in conjunction with a <strong>fixed</strong> header, be sure to add | ||
| the <EuiCode>repositionOnScroll</EuiCode> prop to the popover. | ||
| </p> | ||
| <p> | ||
| To alert or notify users about the additional information they are | ||
| receiving, use the <strong>EuiHeaderSectionItemButton</strong>{' '} | ||
| <EuiCode>notification</EuiCode> prop. You can pass a{' '} | ||
| <EuiCode>node</EuiCode> that will render inside a{' '} | ||
| <strong>EuiBadgeNotification</strong> or pass{' '} | ||
| <EuiCode>true</EuiCode> to render a simple dot. You can also animate | ||
| the button by calling the <EuiCode>triggerAnimation()</EuiCode>{' '} | ||
| method on the <strong>EuiHeaderSectionItemButton</strong>{' '} | ||
| <EuiCode>ref</EuiCode>. | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New explanation on how to animate. Is this enough? |
||
| </p> | ||
|
|
||
| <p> | ||
| The example below shows how to incorporate{' '} | ||
| <strong>EuiHeaderAlert</strong> components to show a list of | ||
| updates. | ||
| <strong>EuiHeaderAlert</strong> components to show a list of updates | ||
| inside a{' '} | ||
| <Link to="/layout/flyout"> | ||
| <strong>EuiFlyout</strong> | ||
| </Link>{' '} | ||
| and a{' '} | ||
| <Link to="/layout/popover"> | ||
| <strong>EuiPopover</strong> | ||
| </Link>{' '} | ||
| . It also shows how to animate and add different types of | ||
| notifications. | ||
| </p> | ||
| </> | ||
| ), | ||
| props: { | ||
| EuiHeaderAlert, | ||
| EuiHeaderSectionItemButton, | ||
| }, | ||
| snippet: headerAlertSnippet, | ||
| demo: <HeaderAlert />, | ||
|
elizabetdev marked this conversation as resolved.
|
||
| }, | ||
| { | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
49 changes: 49 additions & 0 deletions
49
src/components/header/header_section/_header_section_item_button.scss
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| .euiHeaderSectionItemButton { | ||
| position: relative; // For positioning the notification | ||
| height: $euiHeaderChildSize; | ||
| min-width: $euiHeaderChildSize; | ||
| text-align: center; | ||
| font-size: 0; // aligns icons better vertically | ||
|
|
||
| &:hover { | ||
| background: $euiColorLightestShade; | ||
| } | ||
|
|
||
| &:focus { | ||
| background: $euiFocusBackgroundColor; | ||
| } | ||
| } | ||
|
|
||
| .euiHeaderSectionItemButton__notification { | ||
| position: absolute; | ||
|
|
||
| &--dot { | ||
| top: 0; | ||
| right: 0; | ||
| stroke: $euiHeaderBackgroundColor; | ||
| } | ||
|
|
||
| &--badge { | ||
| top: 9%; | ||
| right: 9%; | ||
| box-shadow: 0 0 0 1px $euiHeaderBackgroundColor; | ||
| } | ||
| } | ||
|
|
||
|
|
||
| .euiHeaderSectionItemButton__content { | ||
| // This element is a span and we're changing the display because inline elements can’t take a transform | ||
| display: inline-block; | ||
| } | ||
|
|
||
| @include euiBreakpoint('xs') { | ||
| .euiHeaderSectionItemButton { | ||
| min-width: $euiHeaderChildSize * .75; | ||
| } | ||
|
|
||
| // Using specificity to override the default icon size | ||
| .euiHeaderSectionItemButton__notification.euiHeaderSectionItemButton__notification--dot { | ||
| @include size($euiSize); | ||
| top: 9%; | ||
| } | ||
| } |
This file contains hidden or 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,2 +1,3 @@ | ||
| @import 'header_section'; | ||
| @import 'header_section_item'; | ||
| @import 'header_section_item_button'; |
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.