From 4f7339643041fc410bbaaad74ed24ba1528f7f0c Mon Sep 17 00:00:00 2001 From: cchaos Date: Fri, 7 Sep 2018 16:06:45 -0400 Subject: [PATCH 1/6] Allowing context menu panels to have different widths --- .../context_menu/context_menu_example.js | 16 +++++++++----- .../context_menu/context_menu_with_content.js | 1 + .../__snapshots__/context_menu.test.js.snap | 8 +++++-- .../context_menu_panel.test.js.snap | 8 +++++-- .../context_menu/_context_menu.scss | 4 +++- src/components/context_menu/context_menu.js | 18 ++++++++++++++- .../context_menu/context_menu_panel.js | 22 ++++++++++++++++++- 7 files changed, 65 insertions(+), 12 deletions(-) diff --git a/src-docs/src/views/context_menu/context_menu_example.js b/src-docs/src/views/context_menu/context_menu_example.js index 07353e56248..8924170fe4a 100644 --- a/src-docs/src/views/context_menu/context_menu_example.js +++ b/src-docs/src/views/context_menu/context_menu_example.js @@ -90,11 +90,17 @@ export const ContextMenuExample = { code: contextMenuWithContentHtml, }], text: ( -

- Context menu panels can be passed React elements through the - content prop instead of items. The panel - will display your custom content without modification. -

+
+

+ Context menu panels can be passed React elements through the + content prop instead of items. The panel + will display your custom content without modification. +

+

+ If your panel contents have different widths or you need to ensure that a specific + context menu panel has a certain width, add width: [number of pixels] to the panel tree. +

+
), demo: , }], diff --git a/src-docs/src/views/context_menu/context_menu_with_content.js b/src-docs/src/views/context_menu/context_menu_with_content.js index fee75b19b1e..e30c6702fcf 100644 --- a/src-docs/src/views/context_menu/context_menu_with_content.js +++ b/src-docs/src/views/context_menu/context_menu_with_content.js @@ -51,6 +51,7 @@ export default class extends Component { icon: 'plusInCircle', panel: { id: 1, + width: 400, title: 'See more', content: ( diff --git a/src/components/context_menu/__snapshots__/context_menu.test.js.snap b/src/components/context_menu/__snapshots__/context_menu.test.js.snap index bee9cd17c18..bcb5f20a0ca 100644 --- a/src/components/context_menu/__snapshots__/context_menu.test.js.snap +++ b/src/components/context_menu/__snapshots__/context_menu.test.js.snap @@ -11,10 +11,11 @@ exports[`EuiContextMenu is rendered 1`] = ` exports[`EuiContextMenu props panels and initialPanelId allows you to click the title button to go back to the previous panel 1`] = `