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

fix(Explore): fixes broken layout of tooltips #14529

Merged
merged 4 commits into from May 19, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
import React from 'react';
import { shallow } from 'enzyme';
import { styledShallow as shallow } from 'spec/helpers/theming';
import {
DatasourceType,
getChartControlPanelRegistry,
Expand All @@ -29,7 +29,6 @@ import {
ControlPanelsContainer,
ControlPanelsContainerProps,
} from 'src/explore/components/ControlPanelsContainer';
import Collapse from 'src/components/Collapse';

describe('ControlPanelsContainer', () => {
let wrapper;
Expand Down Expand Up @@ -98,6 +97,8 @@ describe('ControlPanelsContainer', () => {

it('renders ControlPanelSections', () => {
wrapper = shallow(<ControlPanelsContainer {...getDefaultProps()} />);
expect(wrapper.find(Collapse.Panel)).toHaveLength(5);
expect(
wrapper.find('[data-test="collapsible-control-panel"]'),
).toHaveLength(5);
});
});
21 changes: 18 additions & 3 deletions superset-frontend/src/explore/components/ControlHeader.jsx
Expand Up @@ -18,7 +18,7 @@
*/
import React from 'react';
import PropTypes from 'prop-types';
import { t } from '@superset-ui/core';
import { t, css } from '@superset-ui/core';
import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls';
import { Tooltip } from 'src/components/Tooltip';
import { FormLabel } from 'src/components/Form';
Expand Down Expand Up @@ -49,7 +49,16 @@ export default class ControlHeader extends React.Component {
renderOptionalIcons() {
if (this.props.hovered) {
return (
<span>
<span
css={theme => css`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

css 👀 ... 🤣

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The debate of the ages! I'm actually working on a doc to specify use cases for each, and try to arrive at some sort of best practices. I'll share it when it's fully baked.

position: absolute;
top: 50%;
right: 0;
padding-left: ${theme.gridUnit}px;
transform: translate(100%, -50%);
white-space: nowrap;
`}
>
{this.props.description && (
<span>
<InfoTooltipWithTrigger
Expand Down Expand Up @@ -85,7 +94,13 @@ export default class ControlHeader extends React.Component {
return (
<div className="ControlHeader" data-test={`${this.props.name}-header`}>
<div className="pull-left">
<FormLabel css={{ marginBottom: 0 }}>
<FormLabel
css={{
marginBottom: 0,
position: 'relative',
whiteSpace: 'nowrap',
}}
>
{this.props.leftNode && <span>{this.props.leftNode}</span>}
<span
role="button"
Expand Down
Expand Up @@ -26,6 +26,7 @@ import {
getChartControlPanelRegistry,
QueryFormData,
DatasourceType,
css,
} from '@superset-ui/core';
import {
ControlPanelSectionConfig,
Expand Down Expand Up @@ -211,7 +212,24 @@ export class ControlPanelsContainer extends React.Component<ControlPanelsContain

return (
<Collapse.Panel
className="control-panel-section"
data-test="collapsible-control-panel"
css={theme => css`
margin-bottom: 0;
box-shadow: none;

&:last-child {
padding-bottom: ${theme.gridUnit * 10}px;
}

.panel-body {
margin-left: ${theme.gridUnit * 4}px;
padding-bottom: 0px;
}

span.label {
display: inline-block;
}
`}
header={PanelHeader()}
key={sectionId}
>
Expand Down
24 changes: 0 additions & 24 deletions superset-frontend/src/explore/main.less
Expand Up @@ -47,34 +47,10 @@
margin-right: 3px;
}

.control-panel-section {
margin-bottom: 0;
box-shadow: none;

&:last-child {
padding-bottom: 40px;
}
}

.background-transparent {
background-color: transparent !important;
}

.control-panel-section {
.panel-body {
margin-left: 15px;
padding-bottom: 0px;
}

.control-label {
margin-bottom: 0px;
}

span.label {
display: inline-block;
}
}

.fa.expander {
width: 15px;
}
Expand Down