From 62e79eec7011cb8ffa6f1c9626f4f989656ddad1 Mon Sep 17 00:00:00 2001 From: Scotty Bollinger Date: Mon, 7 Dec 2020 21:03:10 -0600 Subject: [PATCH] Add EuiButtonEmptyTo components (#85213) This PR adds another wrapper component for internal routing, the EuiButtonEmptyTo component. --- .../eui_components.test.tsx | 10 +++++++-- .../react_router_helpers/eui_components.tsx | 22 ++++++++++++++++++- .../shared/react_router_helpers/index.ts | 2 +- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/eui_components.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/eui_components.test.tsx index 37784fbf4ffb..712c3056b808 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/eui_components.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/eui_components.test.tsx @@ -8,11 +8,11 @@ import '../../__mocks__/kea.mock'; import React from 'react'; import { shallow, mount } from 'enzyme'; -import { EuiLink, EuiButton, EuiPanel } from '@elastic/eui'; +import { EuiLink, EuiButton, EuiButtonEmpty, EuiPanel } from '@elastic/eui'; import { mockKibanaValues, mockHistory } from '../../__mocks__'; -import { EuiLinkTo, EuiButtonTo, EuiPanelTo } from './eui_components'; +import { EuiLinkTo, EuiButtonTo, EuiButtonEmptyTo, EuiPanelTo } from './eui_components'; describe('EUI & React Router Component Helpers', () => { beforeEach(() => { @@ -31,6 +31,12 @@ describe('EUI & React Router Component Helpers', () => { expect(wrapper.find(EuiButton)).toHaveLength(1); }); + it('renders an EuiButtonEmpty', () => { + const wrapper = shallow(); + + expect(wrapper.find(EuiButtonEmpty)).toHaveLength(1); + }); + it('renders an EuiPanel', () => { const wrapper = shallow(); diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/eui_components.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/eui_components.tsx index 56beed878070..fea59acdb0cc 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/eui_components.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/eui_components.tsx @@ -6,7 +6,15 @@ import React from 'react'; import { useValues } from 'kea'; -import { EuiLink, EuiButton, EuiButtonProps, EuiLinkAnchorProps, EuiPanel } from '@elastic/eui'; +import { + EuiLink, + EuiButton, + EuiButtonEmpty, + EuiButtonEmptyProps, + EuiButtonProps, + EuiLinkAnchorProps, + EuiPanel, +} from '@elastic/eui'; import { EuiPanelProps } from '@elastic/eui/src/components/panel/panel'; import { KibanaLogic } from '../kibana'; @@ -83,6 +91,18 @@ export const EuiButtonTo: React.FC = ({ ); +type ReactRouterEuiButtonEmptyProps = ReactRouterProps & EuiButtonEmptyProps; +export const EuiButtonEmptyTo: React.FC = ({ + to, + onClick, + shouldNotCreateHref, + ...rest +}) => ( + + + +); + type ReactRouterEuiPanelProps = ReactRouterProps & EuiPanelProps; export const EuiPanelTo: React.FC = ({ to, diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/index.ts b/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/index.ts index 05a9450e4a34..2cf2ca3c2e81 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/index.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/react_router_helpers/index.ts @@ -6,4 +6,4 @@ export { letBrowserHandleEvent } from './link_events'; export { createHref, CreateHrefOptions } from './create_href'; -export { EuiLinkTo, EuiButtonTo, EuiPanelTo } from './eui_components'; +export { EuiLinkTo, EuiButtonTo, EuiButtonEmptyTo, EuiPanelTo } from './eui_components';