Skip to content

Commit

Permalink
Merge pull request #9 from cchaos/2019-05-30-embeddable-api-plugin__d…
Browse files Browse the repository at this point in the history
…esign

Clean up some classes and SASS
  • Loading branch information
stacey-gammon committed Jun 5, 2019
2 parents d87f710 + 5603491 commit 06306f4
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 42 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@

$embEditingModeHoverColor: transparentize($euiColorWarning, lightOrDarkTheme(.9, .7));
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ class EmbeddableChildPanelUi extends React.Component<EmbeddableChildPanelUiProps
}

public render() {
const classes = classNames('embPanel panel-content', {
'panel-content-isLoading': this.state.loading,
const classes = classNames('embPanel embPanel__content', {
'embPanel__content-isLoading': this.state.loading,
});

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export function openContextMenu(
<I18nContext>
<EuiPopover
id="dashboardPanelContextMenu"
className="embPanel_optionsMenuPopover"
className="embPanel__optionsMenuPopover"
button={container}
isOpen={true}
closePopover={onClose}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,45 +1,33 @@

.embPanel {
z-index: auto;
flex: 1;
display: flex;
flex-direction: column;
height: 100%;
min-height: $euiSizeL + 2px; // + 2px to account for border
position: relative;

// SASSTODO: The inheritence factor stemming from embeddables makes this class hard to change
.panel-content {
.embPanel__content {
display: flex;
flex: 1 1 100%;
z-index: 1;
min-height: 0; // Absolute must for Firefox to scroll contents
min-height: 0; // Absolute must for Firefox to scroll contents
}


// SASSTODO: Pretty sure this doesn't do anything since the flex-basis 100%,
// but it MIGHT be fixing IE
.panel-content--fullWidth {
.embPanel__content--fullWidth {
width: 100%;
}

.panel-content-isLoading {
.embPanel__content-isLoading {
// completely center the loading indicator
justify-content: center;
align-items: center;
}
}

.embPanel--editing {
border-style: dashed;
border-color: $euiColorMediumShade;
transition: all $euiAnimSpeedFast $euiAnimSlightResistance;

&:hover,
&:focus {
@include euiSlightShadowHover;
}
}

// HEADER

.embPanel__header {
Expand All @@ -60,17 +48,6 @@
}
}

.embPanel--editing {
.embPanel__dragger {
transition: background-color $euiAnimSpeedFast $euiAnimSlightResistance;
}

.embPanel__dragger:hover {
background-color: $embEditingModeHoverColor;
cursor: move;
}
}

.embPanel__dragger:not(.embPanel__title) {
flex-grow: 1;
}
Expand All @@ -91,7 +68,7 @@
* 3. Always show in editing mode
*/

.embPanel_optionsMenuButton {
.embPanel__optionsMenuButton {
background-color: transparentize($euiColorDarkestShade, .9);
border-bottom-right-radius: 0;
border-top-left-radius: 0;
Expand All @@ -102,23 +79,43 @@
}

.embPanel
.embPanel_optionsMenuButton {
.embPanel__optionsMenuButton {
opacity: 0; /* 1 */

&:focus {
opacity: 1; /* 2 */
}
}

.embPanel_optionsMenuPopover[class*="-isOpen"],
.embPanel__optionsMenuPopover[class*="-isOpen"],
.embPanel:hover {
.embPanel_optionsMenuButton {
.embPanel__optionsMenuButton {
opacity: 1;
}
}

// EDITING MODE

.embPanel--editing {
.embPanel_optionsMenuButton {
border-style: dashed;
border-color: $euiColorMediumShade;
transition: all $euiAnimSpeedFast $euiAnimSlightResistance;

&:hover,
&:focus {
@include euiSlightShadowHover;
}

.embPanel__dragger {
transition: background-color $euiAnimSpeedFast $euiAnimSlightResistance;

&:hover {
background-color: $embEditingModeHoverColor;
cursor: move;
}
}

.embPanel__optionsMenuButton {
opacity: 1; /* 3 */
}
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
@import './embeddable_panel';
@import 'panel_header/panel_options_menu_form';

@import './panel_header/index';
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export class EmbeddablePanel extends React.Component<Props, State> {
closeContextMenu={this.state.closeContextMenu}
title={title}
/>
<div className="panel-content" ref={this.embeddableRoot} />
<div className="embPanel__content" ref={this.embeddableRoot} />
</EuiPanel>
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import './panel_options_menu_form';
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class PanelOptionsMenuUi extends React.Component<PanelOptionsMenuUiProps, State>
<EuiButtonIcon
iconType={isViewMode ? 'boxesHorizontal' : 'gear'}
color="text"
className="embPanel_optionsMenuButton"
className="embPanel__optionsMenuButton"
aria-label={intl.formatMessage({
id: 'kbn.dashboard.panel.optionsMenu.panelOptionsButtonAriaLabel',
defaultMessage: 'Panel options',
Expand All @@ -95,7 +95,7 @@ class PanelOptionsMenuUi extends React.Component<PanelOptionsMenuUiProps, State>
return (
<EuiPopover
id="dashboardPanelContextMenu"
className="embPanel_optionsMenuPopover"
className="embPanel__optionsMenuPopover"
button={button}
isOpen={this.state.isPopoverOpen}
closePopover={this.closePopover}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export class VisualizeEmbeddable extends Embeddable {
timeRange: containerState.timeRange,
query: containerState.query,
filters: containerState.filters,
cssClass: `panel-content panel-content--fullWidth`,
cssClass: `embPanel__content embPanel__content--fullWidth`,
dataAttrs,
};

Expand Down

0 comments on commit 06306f4

Please sign in to comment.