Add EuiButtonEmptyTo components (#85213)
This PR adds another wrapper component for internal routing, the EuiButtonEmptyTo component.
This commit is contained in:
parent
568ce65039
commit
62e79eec70
|
@ -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(<EuiButtonEmptyTo to="/" />);
|
||||
|
||||
expect(wrapper.find(EuiButtonEmpty)).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('renders an EuiPanel', () => {
|
||||
const wrapper = shallow(<EuiPanelTo to="/" paddingSize="l" />);
|
||||
|
||||
|
|
|
@ -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<ReactRouterEuiButtonProps> = ({
|
|||
</ReactRouterHelper>
|
||||
);
|
||||
|
||||
type ReactRouterEuiButtonEmptyProps = ReactRouterProps & EuiButtonEmptyProps;
|
||||
export const EuiButtonEmptyTo: React.FC<ReactRouterEuiButtonEmptyProps> = ({
|
||||
to,
|
||||
onClick,
|
||||
shouldNotCreateHref,
|
||||
...rest
|
||||
}) => (
|
||||
<ReactRouterHelper {...{ to, onClick, shouldNotCreateHref }}>
|
||||
<EuiButtonEmpty {...rest} />
|
||||
</ReactRouterHelper>
|
||||
);
|
||||
|
||||
type ReactRouterEuiPanelProps = ReactRouterProps & EuiPanelProps;
|
||||
export const EuiPanelTo: React.FC<ReactRouterEuiPanelProps> = ({
|
||||
to,
|
||||
|
|
|
@ -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';
|
||||
|
|
Loading…
Reference in a new issue