Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Lens] Fix overflow in printable report #70723

Merged
merged 4 commits into from
Jul 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions x-pack/plugins/lens/public/visualization_container.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.lnsVisualizationContainer {
overflow: auto;
}
9 changes: 9 additions & 0 deletions x-pack/plugins/lens/public/visualization_container.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,13 @@ describe('VisualizationContainer', () => {

expect(reportingEl.prop('style')).toEqual({ color: 'blue' });
});

test('combines class names with container class', () => {
const component = mount(
<VisualizationContainer className="myClass">Hello!</VisualizationContainer>
);
const reportingEl = component.find('[data-shared-item]').first();

expect(reportingEl.prop('className')).toEqual('myClass lnsVisualizationContainer');
});
});
19 changes: 17 additions & 2 deletions x-pack/plugins/lens/public/visualization_container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
*/

import React from 'react';
import classNames from 'classnames';

import './visualization_container.scss';

interface Props extends React.HTMLAttributes<HTMLDivElement> {
isReady?: boolean;
Expand All @@ -15,9 +18,21 @@ interface Props extends React.HTMLAttributes<HTMLDivElement> {
* This is a convenience component that wraps rendered Lens visualizations. It adds reporting
* attributes (data-shared-item, data-render-complete, and data-title).
*/
export function VisualizationContainer({ isReady = true, reportTitle, children, ...rest }: Props) {
export function VisualizationContainer({
isReady = true,
reportTitle,
children,
className,
...rest
}: Props) {
return (
<div data-shared-item data-render-complete={isReady} data-title={reportTitle} {...rest}>
<div
data-shared-item
data-render-complete={isReady}
className={classNames(className, 'lnsVisualizationContainer')}
data-title={reportTitle}
{...rest}
>
{children}
</div>
);
Expand Down