grafana/public/app/features/explore/Wrapper.tsx
Uchechukwu Obasi d472c7820c
CustomScrollbar: migrated styles from sass to emotion (#30506)
* CustomScrollbar: migrated styles from sass to emotion

* fixes frontend test

* updated changes

* fixed page props and applied changes to all occurences

* moved the getStyles function to the bottom of the file

* made some changes

* fixed snapshot test

* Revert "Merge branch 'refactor-customscrollbar-30354' of https://github.com/grafana/grafana into refactor-customscrollbar-30354"

This reverts commit c45ee30b6b297991a1628e9b21c4121dc78e376c, reversing
changes made to d2645534e3.

* improved props name

* made use of theme variables for style consistency

* fixed snapshot test and updated some theme changes

* removed hover effects from customScrollbar style

* made some changes

* updated some changes

* added label to class names

* changed to a functional component and improved styling

* fixes snapshot test

* fixes small nit

* minor tweaks

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2021-01-27 17:47:24 +01:00

62 lines
1.7 KiB
TypeScript

import React, { Component } from 'react';
import { hot } from 'react-hot-loader';
import { connect } from 'react-redux';
import { StoreState } from 'app/types';
import { ExploreId } from 'app/types/explore';
import { CustomScrollbar, ErrorBoundaryAlert } from '@grafana/ui';
import { resetExploreAction, richHistoryUpdatedAction } from './state/main';
import Explore from './Explore';
import { getRichHistory } from '../../core/utils/richHistory';
interface WrapperProps {
split: boolean;
resetExploreAction: typeof resetExploreAction;
richHistoryUpdatedAction: typeof richHistoryUpdatedAction;
}
export class Wrapper extends Component<WrapperProps> {
componentWillUnmount() {
this.props.resetExploreAction({});
}
componentDidMount() {
const richHistory = getRichHistory();
this.props.richHistoryUpdatedAction({ richHistory });
}
render() {
const { split } = this.props;
return (
<div className="page-scrollbar-wrapper">
<CustomScrollbar autoHeightMin={'100%'}>
<div className="explore-wrapper">
<ErrorBoundaryAlert style="page">
<Explore exploreId={ExploreId.left} />
</ErrorBoundaryAlert>
{split && (
<ErrorBoundaryAlert style="page">
<Explore exploreId={ExploreId.right} />
</ErrorBoundaryAlert>
)}
</div>
</CustomScrollbar>
</div>
);
}
}
const mapStateToProps = (state: StoreState) => {
const { split } = state.explore;
return { split };
};
const mapDispatchToProps = {
resetExploreAction,
richHistoryUpdatedAction,
};
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(Wrapper));