-
Notifications
You must be signed in to change notification settings - Fork 841
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a placeholder content block loading animation.
- Loading branch information
1 parent
b92fa19
commit 22a23a3
Showing
7 changed files
with
123 additions
and
0 deletions.
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
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,5 @@ | ||
@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,20 @@ | ||
.euiLoadingContent__loader { | ||
width: 100%; | ||
} | ||
|
||
.euiLoadingContent__single-line { | ||
width: 100%; | ||
fill:shadeOrTint($euiColorLightShade, 0%, 15%); | ||
&:last-child { | ||
width: 75%; | ||
} | ||
} | ||
|
||
.euiLoadingContent__gradient--start-end { | ||
stop-color: shadeOrTint($euiColorLightShade, 0%, 15%); | ||
stop-opacity: 1; | ||
} | ||
.euiLoadingContent__gradient--middle { | ||
stop-color: shadeOrTint($euiColorLightestShade, 0%, 15%); | ||
stop-opacity: 1; | ||
} |
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,71 @@ | ||
import React, { FunctionComponent, HTMLAttributes } from 'react'; | ||
import classNames from 'classnames'; | ||
import { CommonProps } from '../common'; | ||
|
||
export const EuiLoadingContent: FunctionComponent< | ||
CommonProps & | ||
HTMLAttributes<HTMLDivElement> & { | ||
lines?: number; | ||
} | ||
> = ({ lines = 3, className, ...rest }) => { | ||
const classes = classNames('euiLoadingContent', className); | ||
// We need an array for mapping the lines | ||
const newLineArray = Array(lines).fill(undefined); | ||
return ( | ||
<div className={classes} {...rest}> | ||
<svg | ||
viewBox="0 0" | ||
height={newLineArray.length * 32} | ||
fill="none" | ||
className="euiLoadingContent__loader"> | ||
<mask id="euiLoadingContent__mask"> | ||
{newLineArray.map((line: undefined, index) => { | ||
return ( | ||
<rect | ||
className="euiLoadingContent__single-line" | ||
y={index * 32} | ||
width={newLineArray.length === index + 1 ? '75%' : '100%'} | ||
height="24" | ||
rx="4" | ||
/> | ||
); | ||
})} | ||
</mask> | ||
|
||
<linearGradient | ||
id="euiLoadingContent__gradient" | ||
x1="0%" | ||
x2="100%" | ||
y1="38%" | ||
y2="40%"> | ||
<stop | ||
className="euiLoadingContent__gradient--start-end" | ||
offset="0%" | ||
/> | ||
<stop className="euiLoadingContent__gradient--middle" offset="50%" /> | ||
<stop | ||
className="euiLoadingContent__gradient--start-end" | ||
offset="100%" | ||
/> | ||
<animate | ||
attributeName="x2" | ||
dur="900ms" | ||
from="20%" | ||
to="300%" | ||
repeatCount="indefinite" | ||
/> | ||
</linearGradient> | ||
|
||
<rect | ||
id="shimmer" | ||
x="0" | ||
y="0" | ||
width="100%" | ||
height="100%" | ||
fill="url(#euiLoadingContent__gradient)" | ||
mask="url(#euiLoadingContent__mask)" | ||
/> | ||
</svg> | ||
</div> | ||
); | ||
}; |