-
Notifications
You must be signed in to change notification settings - Fork 841
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
Adding a content block loading animation. #1730
Merged
daveyholler
merged 11 commits into
elastic:master
from
daveyholler:content_loading_animation
Mar 22, 2019
+618
−0
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
6a8a47c
Adding a placeholder content block loading animation.
daveyholler aba9fc0
Fixing scss lint warning.
daveyholler 632922b
increasing the contrast on the dark mode loader
daveyholler d5b9b3f
Implementing feedback.
daveyholler 66e8a57
Switching from SVGs to regular ole' divs and animating via CSS
daveyholler 520fb68
Updating changelog.
daveyholler ae5cdee
Tidying up the gradient and animation. Thanks, Ryan.
daveyholler 35d4b3d
CSS naming & variables file
daveyholler 0bfdce5
Transforming the x position rather than animating the background posi…
daveyholler cf28ba7
Fixing a className and some whitespace.
daveyholler 41502b7
Adding tests for the component.
daveyholler 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
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from 'react'; | ||
|
||
import { EuiLoadingContent } from '../../../../src/components/loading'; | ||
|
||
export default () => ( | ||
<div> | ||
<EuiLoadingContent lines={3} /> | ||
</div> | ||
); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
@import 'variables'; | ||
@import 'mixins'; | ||
@import 'loading_kibana'; | ||
@import 'loading_chart'; | ||
@import 'loading_content'; | ||
@import 'loading_spinner'; |
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
.euiLoadingContent__loader { | ||
width: 100%; | ||
} | ||
|
||
.euiLoadingContent__singleLine { | ||
width: 100%; | ||
height: $euiSize; | ||
margin-bottom: $euiSizeS; | ||
border-radius: $euiBorderRadius; | ||
overflow: hidden; | ||
|
||
&:last-child:not(:only-child) { | ||
width: 75%; | ||
} | ||
} | ||
|
||
.euiLoadingContent__singleLineBackground { | ||
width: 220%; | ||
height: 100%; | ||
background: linear-gradient( | ||
to right, | ||
$euiGradientStartStop 45%, | ||
$euiGradientMiddle 50%, | ||
$euiGradientStartStop 55%, | ||
); | ||
animation: euiLoadingContentGradientLoad 1.5s $euiAnimSlightResistance infinite; | ||
} | ||
|
||
@keyframes euiLoadingContentGradientLoad { | ||
0% { | ||
transform: translateX(-53%); | ||
} | ||
|
||
100% { | ||
transform: translateX(0); | ||
} | ||
} | ||
|
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
$euiGradientStartStop: tintOrShade($euiColorLightShade, 5%, 12%); | ||
$euiGradientMiddle: tintOrShade($euiColorLightShade, 50%, 24%); |
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,3 +1,4 @@ | ||
export { EuiLoadingKibana } from './loading_kibana'; | ||
export { EuiLoadingChart } from './loading_chart'; | ||
export { EuiLoadingContent } from './loading_content'; | ||
export { EuiLoadingSpinner } from './loading_spinner'; |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React, { FunctionComponent, HTMLAttributes } from 'react'; | ||
import classNames from 'classnames'; | ||
import { CommonProps } from '../common'; | ||
|
||
type LineRange = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10; | ||
|
||
export const EuiLoadingContent: FunctionComponent< | ||
CommonProps & | ||
HTMLAttributes<HTMLDivElement> & { | ||
lines?: LineRange; | ||
} | ||
> = ({ lines = 3, className, ...rest }) => { | ||
const classes = classNames('euiLoadingContent', className); | ||
const lineElements = []; | ||
|
||
for (let i = 0; i < lines; i++) { | ||
lineElements.push( | ||
<div key={i} className="euiLoadingContent__singleLine"> | ||
<div className="euiLoadingContent__singleLineBackground" /> | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<div className={classes} {...rest}> | ||
{lineElements} | ||
</div> | ||
); | ||
}; |
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.
I don't think this is necessary now that each line is a block level element so you don't have to calculate the y position. You can leave
lines
as anumber
type.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 limited this more as a design decision to prevent it being used for giant walls of text. That's just a philosophy thing though. I can remove the limit if the preference is to keep EUI less opinionated. 😄
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'm ok with being opinionated, I was just thinking about cleanliness. I'm fine if you'd like to keep it in.
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.
Cool beans. I'll leave it here for the time being. We'll see what kind of feedback we get.