Skip to content

Commit

Permalink
Chore (ui-shared-deps): Clean up direct usage of OUI theme JSON
Browse files Browse the repository at this point in the history
Signed-off-by: Josh Romero <[email protected]>
  • Loading branch information
joshuarrrr committed Jan 5, 2024
1 parent 6710ec3 commit 98f6182
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];
}

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 98f6182

Please sign in to comment.