-
Notifications
You must be signed in to change notification settings - Fork 844
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added stacked header example **Break**: EuiHeader now requires consumer to use mixin to apply padding to account for fixed position * Adding header updates to test flyouts * Fix styles for dark theme - Darker in actual dark theme * Fix addition/removal of body classes when there are mulitple fixed headers * Fixing shadows on flyouts. * Change Fixed Header example and fixed separation of flyout and header
- Loading branch information
Showing
20 changed files
with
262 additions
and
85 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
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
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,90 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
|
||
import { | ||
EuiHeader, | ||
EuiHeaderLogo, | ||
EuiHeaderSectionItemButton, | ||
} from '../../../../src/components/header'; | ||
import { EuiSwitch } from '../../../../src/components/form'; | ||
import { EuiSpacer } from '../../../../src/components/spacer'; | ||
import { EuiAvatar } from '../../../../src/components/avatar'; | ||
// @ts-ignore | ||
import HeaderUpdates from './header_updates'; | ||
|
||
export default () => { | ||
const [isFixed, setIsFixed] = useState(false); | ||
|
||
const breadcrumbs = [ | ||
{ | ||
text: 'Management', | ||
href: '#', | ||
}, | ||
{ | ||
text: 'Users', | ||
}, | ||
]; | ||
|
||
/** | ||
* Docs Note: This additional class is needed only for docs to override the usually single header | ||
*/ | ||
useEffect(() => { | ||
if (isFixed) document.body.classList.add('euiBody--headerIsFixed--double'); | ||
|
||
return () => { | ||
document.body.classList.remove('euiBody--headerIsFixed--double'); | ||
}; | ||
}, [isFixed]); | ||
|
||
const headers = ( | ||
<> | ||
<EuiHeader | ||
theme="dark" | ||
position={isFixed ? 'fixed' : 'static'} | ||
sections={[ | ||
{ | ||
items: [ | ||
<EuiHeaderLogo iconType="logoElastic">Elastic</EuiHeaderLogo>, | ||
], | ||
borders: 'right', | ||
}, | ||
{ | ||
items: [ | ||
<EuiHeaderSectionItemButton aria-label="Account menu"> | ||
<EuiAvatar name="John Username" size="s" /> | ||
</EuiHeaderSectionItemButton>, | ||
], | ||
}, | ||
]} | ||
/> | ||
<EuiHeader | ||
position={isFixed ? 'fixed' : 'static'} | ||
sections={[ | ||
{ | ||
items: [ | ||
<EuiHeaderSectionItemButton aria-label="Account menu"> | ||
<EuiAvatar type="space" name="Default Space" size="s" /> | ||
</EuiHeaderSectionItemButton>, | ||
], | ||
breadcrumbs: breadcrumbs, | ||
borders: 'none', | ||
}, | ||
{ | ||
items: isFixed ? [<HeaderUpdates />] : undefined, | ||
}, | ||
]} | ||
/> | ||
</> | ||
); | ||
|
||
return ( | ||
<> | ||
<EuiSwitch | ||
label={'Make header fixed position'} | ||
checked={isFixed} | ||
onChange={e => setIsFixed(e.target.checked)} | ||
/> | ||
<EuiSpacer /> | ||
{headers} | ||
</> | ||
); | ||
}; |
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
Oops, something went wrong.