Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,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 Expand Up @@ -954,4 +955,4 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

### 🔩 Tests

- Update caniuse to fix failed integration tests ([#2322](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2322))
- Update caniuse to fix failed integration tests ([#2322](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2322))
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
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 @@

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
Loading