Skip to content

Commit

Permalink
Chore (ui-shared-deps): Clean up direct usage of OUI theme JSON (#5662)
Browse files Browse the repository at this point in the history
* Chore (ui-shared-deps): Clean up direct usage of OUI theme JSON

Signed-off-by: Josh Romero <[email protected]>

* add changelog

Signed-off-by: Josh Romero <[email protected]>

---------

Signed-off-by: Josh Romero <[email protected]>
(cherry picked from commit a4ae399)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Jan 10, 2024
1 parent b167406 commit 0166825
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/plugins/expressions/public/react_expression_renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { Observable, Subscription } from 'rxjs';
import { filter } from 'rxjs/operators';
import useShallowCompareEffect from 'react-use/lib/useShallowCompareEffect';
import { EuiLoadingChart, EuiProgress } from '@elastic/eui';
import theme from '@elastic/eui/dist/eui_theme_light.json';
import { euiThemeVars } from '@osd/ui-shared-deps/theme';
import { IExpressionLoaderParams, ExpressionRenderError } from './types';
import { ExpressionAstExpression, IInterpreterRenderHandlers } from '../common';
import { ExpressionLoader } from './loader';
Expand Down Expand Up @@ -191,8 +191,9 @@ export const ReactExpressionRenderer = ({

const expressionStyles: React.CSSProperties = {};

// TODO: refactor to SCSS instead of getting values from theme: https://github.com/opensearch-project/OpenSearch-Dashboards/issues/5661
if (padding) {
expressionStyles.padding = theme.paddingSizes[padding];
expressionStyles.padding = euiThemeVars.paddingSizes[padding];

Check warning on line 196 in src/plugins/expressions/public/react_expression_renderer.tsx

View check run for this annotation

Codecov / codecov/patch

src/plugins/expressions/public/react_expression_renderer.tsx#L196

Added line #L196 was not covered by tests
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
* under the License.
*/

// @ts-ignore
import { euiColorAccent } from '@elastic/eui/dist/eui_theme_light.json';
import React, { Component, Fragment } from 'react';

import {
Expand Down Expand Up @@ -148,7 +146,7 @@ export class CreateButton extends Component<Props, State> {

private renderBetaBadge = () => {
return (
<EuiBadge color={euiColorAccent}>
<EuiBadge color="accent">
<FormattedMessage
id="indexPatternManagement.indexPatternList.createButton.betaLabel"
defaultMessage="Beta"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export function createTheme(
};
}

// TODO: Refactor to use packages/osd-ui-shared-deps/theme.ts: https://github.com/opensearch-project/OpenSearch-Dashboards/issues/5661
const DARK_THEME = createTheme(darkTheme, '#343551');
const LIGHT_THEME = createTheme(lightTheme, '#E3E4ED');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ import $ from 'jquery';

import { Binder } from '../../lib/binder';
import { positionTooltip } from './position_tooltip';
import theme from '@elastic/eui/dist/eui_theme_light.json';
import { euiThemeVars } from '@osd/ui-shared-deps/theme';

let allContents = [];

const tooltipColumnPadding = parseInt(theme.euiSizeXS || 0, 10) * 2;
const tooltipTableMargin = parseInt(theme.euiSizeS || 0, 10) * 2;
const tooltipMaxWidth = parseInt(theme.euiSizeXL || 0, 10) * 10;
const tooltipColumnPadding = parseInt(euiThemeVars.euiSizeXS || 0, 10) * 2;
const tooltipTableMargin = parseInt(euiThemeVars.euiSizeS || 0, 10) * 2;
const tooltipMaxWidth = parseInt(euiThemeVars.euiSizeXL || 0, 10) * 10;

/**
* Add tooltip and listeners to visualization elements
Expand Down

0 comments on commit 0166825

Please sign in to comment.