Skip to content

Commit

Permalink
[8.8] [Canvas] Remove dark mode prop on editor menu component (#158968)…
Browse files Browse the repository at this point in the history
… (#159081)

# Backport

This will backport the following commits from `main` to `8.8`:
- [[Canvas] Remove dark mode prop on editor menu component
(#158968)](#158968)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Catherine
Liu","email":"catherine.liu@elastic.co"},"sourceCommit":{"committedDate":"2023-06-06T01:22:11Z","message":"[Canvas]
Remove dark mode prop on editor menu component (#158968)\n\nCloses
#158967.\r\n\r\nWe were checking dark mode to override icon colors in
the editor menu.\r\nAt some point these styles were removed because EUI
auto handles the\r\ncolors per light/dark mode for the icons properly
now. I'm removing\r\nthose classes and the dark mode prop for the
EditorMenu
component.","sha":"a8ef21f96836527038cdc5f19b59bf9a9561a26b","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Presentation","loe:hours","release_note:skip","impact:medium","Feature:Canvas","v8.9.0","v8.8.1"],"number":158968,"url":"#158968
Remove dark mode prop on editor menu component (#158968)\n\nCloses
#158967.\r\n\r\nWe were checking dark mode to override icon colors in
the editor menu.\r\nAt some point these styles were removed because EUI
auto handles the\r\ncolors per light/dark mode for the icons properly
now. I'm removing\r\nthose classes and the dark mode prop for the
EditorMenu
component.","sha":"a8ef21f96836527038cdc5f19b59bf9a9561a26b"}},"sourceBranch":"main","suggestedTargetBranches":["8.8"],"targetPullRequestStates":[{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"#158968
Remove dark mode prop on editor menu component (#158968)\n\nCloses
#158967.\r\n\r\nWe were checking dark mode to override icon colors in
the editor menu.\r\nAt some point these styles were removed because EUI
auto handles the\r\ncolors per light/dark mode for the icons properly
now. I'm removing\r\nthose classes and the dark mode prop for the
EditorMenu
component.","sha":"a8ef21f96836527038cdc5f19b59bf9a9561a26b"}},{"branch":"8.8","label":"v8.8.1","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Catherine Liu <catherine.liu@elastic.co>
  • Loading branch information
kibanamachine and cqliu1 committed Jun 6, 2023
1 parent 7442e67 commit 89771e7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,23 +85,12 @@ const testVisTypeAliases: VisTypeAlias[] = [
},
];

storiesOf('components/WorkpadHeader/EditorMenu', module)
.add('default', () => (
<EditorMenu
factories={testFactories}
promotedVisTypes={testVisTypes}
visTypeAliases={testVisTypeAliases}
createNewVisType={() => action('createNewVisType')}
createNewEmbeddable={() => action('createNewEmbeddable')}
/>
))
.add('dark mode', () => (
<EditorMenu
factories={testFactories}
isDarkThemeEnabled
promotedVisTypes={testVisTypes}
visTypeAliases={testVisTypeAliases}
createNewVisType={() => action('createNewVisType')}
createNewEmbeddable={() => action('createNewEmbeddable')}
/>
));
storiesOf('components/WorkpadHeader/EditorMenu', module).add('default', () => (
<EditorMenu
factories={testFactories}
promotedVisTypes={testVisTypes}
visTypeAliases={testVisTypeAliases}
createNewVisType={() => action('createNewVisType')}
createNewEmbeddable={() => action('createNewEmbeddable')}
/>
));
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ interface FactoryGroup {

interface Props {
factories: EmbeddableFactoryDefinition[];
isDarkThemeEnabled?: boolean;
promotedVisTypes: BaseVisType[];
visTypeAliases: VisTypeAlias[];
createNewVisType: (visType?: BaseVisType | VisTypeAlias) => () => void;
Expand All @@ -42,7 +41,6 @@ interface Props {

export const EditorMenu: FC<Props> = ({
factories,
isDarkThemeEnabled,
promotedVisTypes,
visTypeAliases,
createNewVisType,
Expand Down Expand Up @@ -155,11 +153,6 @@ export const EditorMenu: FC<Props> = ({
<EuiContextMenu
initialPanelId={0}
panels={editorMenuPanels}
className={`canvasSolutionToolbar__editorContextMenu ${
isDarkThemeEnabled
? 'canvasSolutionToolbar__editorContextMenu--dark'
: 'canvasSolutionToolbar__editorContextMenu--light'
}`}
data-test-subj="canvasEditorContextMenu"
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ import {
EmbeddableInput,
} from '@kbn/embeddable-plugin/public';
import { trackCanvasUiMetric, METRIC_TYPE } from '../../../lib/ui_metric';
import {
useEmbeddablesService,
usePlatformService,
useVisualizationsService,
} from '../../../services';
import { useEmbeddablesService, useVisualizationsService } from '../../../services';
import { CANVAS_APP } from '../../../../common/lib';
import { encode } from '../../../../common/lib/embeddable_dataurl';
import { ElementSpec } from '../../../../types';
Expand All @@ -39,10 +35,8 @@ interface UnwrappedEmbeddableFactory {
export const EditorMenu: FC<Props> = ({ addElement }) => {
const embeddablesService = useEmbeddablesService();
const { pathname, search, hash } = useLocation();
const platformService = usePlatformService();
const stateTransferService = embeddablesService.getStateTransfer();
const visualizationsService = useVisualizationsService();
const IS_DARK_THEME = platformService.getUISetting('theme:darkMode');

const embeddableFactories = useMemo(
() => (embeddablesService ? Array.from(embeddablesService.getEmbeddableFactories()) : []),
Expand Down Expand Up @@ -161,7 +155,6 @@ export const EditorMenu: FC<Props> = ({ addElement }) => {
createNewVisType={createNewVisType}
createNewEmbeddable={createNewEmbeddable}
promotedVisTypes={promotedVisTypes}
isDarkThemeEnabled={IS_DARK_THEME}
factories={factories}
visTypeAliases={visTypeAliases}
/>
Expand Down

0 comments on commit 89771e7

Please sign in to comment.