DashboardPanel: migrates styling from sass to emotion (#33115)

* DashboardPanel: migrates styling from sass to emotion

* fixes frontend test

* removed the theme since it doesn't have any use case in the styles

* updates frontend snapshot test
This commit is contained in:
Uchechukwu Obasi 2021-04-21 12:24:44 +01:00 committed by GitHub
parent dd0ba96d7c
commit 63e2977837
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 16 deletions

View File

@ -15,6 +15,8 @@ import { initDashboardPanel } from '../state/actions';
import { DashboardModel, PanelModel } from '../state';
import { StoreState } from 'app/types';
import { PanelPlugin } from '@grafana/data';
import { stylesFactory } from '@grafana/ui';
import { css } from 'emotion';
export interface OwnProps {
panel: PanelModel;
@ -111,6 +113,7 @@ export class DashboardPanelUnconnected extends PureComponent<Props, State> {
render() {
const { isViewing, plugin } = this.props;
const { isLazy } = this.state;
const styles = getStyles();
// If we have not loaded plugin exports yet, wait
if (!plugin) {
@ -122,13 +125,27 @@ export class DashboardPanelUnconnected extends PureComponent<Props, State> {
return null;
}
const panelWrapperClass = classNames({
'panel-wrapper': true,
'panel-wrapper--view': isViewing,
});
return <div className={panelWrapperClass}>{this.renderPanel(plugin)}</div>;
return (
<div
className={isViewing === true ? classNames(styles.panelWrapper, styles.panelWrapperView) : styles.panelWrapper}
>
{this.renderPanel(plugin)}
</div>
);
}
}
export const getStyles = stylesFactory(() => {
return {
panelWrapper: css`
height: 100%;
position: relative;
`,
panelWrapperView: css`
flex: 1 1 0;
height: 90%;
`,
};
});
export const DashboardPanel = connector(DashboardPanelUnconnected);

View File

@ -1,13 +1,3 @@
.panel-wrapper {
height: 100%;
position: relative;
&--view {
flex: 1 1 0;
height: 90%;
}
}
.panel-editor__scroll {
flex-grow: 1;
min-width: 0;