-
Notifications
You must be signed in to change notification settings - Fork 837
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New [EuiLoaderLogo] and other loader updates (#4835)
* NEW: EuiLoadingLogo * Pausing animations when `prefers-reduced-motion` is on * Updating text content loader color to be lighter * [EuiEmptyPrompt] Added `icon` for custom icon And cleaned up spacing * Move `null` role to fix a11y tests and allow overriding In EuiPageTemplate when `centeredContent` and no sidebar
- Loading branch information
Showing
28 changed files
with
690 additions
and
208 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
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,17 @@ | ||
import React from 'react'; | ||
|
||
import { EuiEmptyPrompt } from '../../../../src/components'; | ||
|
||
export default () => ( | ||
<EuiEmptyPrompt | ||
iconType="alert" | ||
iconColor="danger" | ||
title={<h2>Error loading Dashboards</h2>} | ||
body={ | ||
<p> | ||
There was an error loading the Dashboard application. Contact your | ||
administrator for help. | ||
</p> | ||
} | ||
/> | ||
); |
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,10 @@ | ||
import React from 'react'; | ||
|
||
import { EuiEmptyPrompt, EuiLoadingLogo } from '../../../../src/components'; | ||
|
||
export default () => ( | ||
<EuiEmptyPrompt | ||
icon={<EuiLoadingLogo logo="logoKibana" size="xl" />} | ||
title={<h2>Loading Dashboards</h2>} | ||
/> | ||
); |
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,74 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
|
||
import { | ||
EuiEmptyPrompt, | ||
EuiPageTemplate, | ||
EuiLoadingLogo, | ||
EuiButton, | ||
} from '../../../../src/components'; | ||
|
||
export default () => { | ||
const states = ['loading1', 'error', 'loading2', 'empty']; | ||
|
||
const [currentState, setCurrentState] = useState(states[0]); | ||
|
||
const searchTimeout = setTimeout(() => { | ||
// Cycle through the array of states | ||
const index = states.indexOf(currentState); | ||
setCurrentState(index < states.length - 1 ? states[index + 1] : states[0]); | ||
}, 3000); | ||
|
||
useEffect(() => { | ||
return () => { | ||
clearTimeout(searchTimeout); | ||
}; | ||
}); | ||
|
||
let emptyPromptProps; | ||
switch (currentState) { | ||
case 'error': | ||
emptyPromptProps = { | ||
iconType: 'alert', | ||
iconColor: 'danger', | ||
title: <h2>Error loading Dashboards</h2>, | ||
body: ( | ||
<p> | ||
There was an error loading the Dashboard application. Contact your | ||
administrator for help. | ||
</p> | ||
), | ||
}; | ||
break; | ||
case 'empty': | ||
emptyPromptProps = { | ||
iconType: 'dashboardApp', | ||
iconColor: 'default', | ||
title: <h2>Dashboards</h2>, | ||
body: <p>You don't have any dashboards yet.</p>, | ||
actions: [ | ||
<EuiButton fill iconType="plusInCircleFilled"> | ||
Create new dashboard | ||
</EuiButton>, | ||
], | ||
}; | ||
break; | ||
|
||
default: | ||
emptyPromptProps = { | ||
icon: <EuiLoadingLogo logo="logoKibana" size="xl" />, | ||
title: <h2>Loading Dashboards</h2>, | ||
}; | ||
break; | ||
} | ||
|
||
return ( | ||
<EuiPageTemplate | ||
template="centeredContent" | ||
pageContentProps={{ | ||
color: currentState === 'error' ? 'danger' : 'subdued', | ||
role: null, // For passing a11y tests in EUI docs only | ||
}}> | ||
<EuiEmptyPrompt {...emptyPromptProps} /> | ||
</EuiPageTemplate> | ||
); | ||
}; |
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
Oops, something went wrong.