-
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.
[EuiContextMenu] Add size prop (#4409)
Co-authored-by: cchaos <[email protected]> Co-authored-by: Greg Thompson <[email protected]>
- Loading branch information
1 parent
5b0d1c3
commit d16d296
Showing
21 changed files
with
499 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import React, { useState } from 'react'; | ||
|
||
import { | ||
EuiButton, | ||
EuiContextMenuPanel, | ||
EuiContextMenuItem, | ||
EuiPopover, | ||
} from '../../../../src/components'; | ||
|
||
export default () => { | ||
const [isPopoverOpen, setPopover] = useState(false); | ||
|
||
const onButtonClick = () => { | ||
setPopover(!isPopoverOpen); | ||
}; | ||
|
||
const closePopover = () => { | ||
setPopover(false); | ||
}; | ||
|
||
const items = [ | ||
<EuiContextMenuItem key="copy" icon="copy" onClick={closePopover}> | ||
Copy | ||
</EuiContextMenuItem>, | ||
<EuiContextMenuItem key="edit" icon="pencil" onClick={closePopover}> | ||
Edit | ||
</EuiContextMenuItem>, | ||
<EuiContextMenuItem key="share" icon="share" onClick={closePopover}> | ||
Share | ||
</EuiContextMenuItem>, | ||
]; | ||
|
||
const button = ( | ||
<EuiButton iconType="arrowDown" iconSide="right" onClick={onButtonClick}> | ||
Click to show a single panel | ||
</EuiButton> | ||
); | ||
|
||
return ( | ||
<EuiPopover | ||
id="smallContextMenuExample" | ||
button={button} | ||
isOpen={isPopoverOpen} | ||
closePopover={closePopover} | ||
panelPaddingSize="none" | ||
anchorPosition="downLeft"> | ||
<EuiContextMenuPanel size="s" items={items} /> | ||
</EuiPopover> | ||
); | ||
}; |
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.