Skip to content

Commit

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

* Chore (ui-shared-deps): Clean up direct usage of OUI theme JSON

Signed-off-by: Josh Romero <rmerqg@amazon.com>

* add changelog

Signed-off-by: Josh Romero <rmerqg@amazon.com>

---------

Signed-off-by: Josh Romero <rmerqg@amazon.com>
  • Loading branch information
joshuarrrr authored Jan 10, 2024
1 parent 52981db commit a4ae399
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [Console] Remove unused ul element and its custom styling ([#3993](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3993))
- Remove unused Sass in `tile_map` plugin ([#4110](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4110))
- [Home] Remove unused tutorials ([#5212](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5212))
- [UiSharedDeps] Standardize theme JSON imports to be light/dark-mode aware ([#5662](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5662))

### 🔩 Tests

Expand Down
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 a4ae399

Please sign in to comment.