-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Infra] Migrate infra from styled-components to @emotion #202405
Changes from 6 commits
0b4775f
7846e0f
c84a731
ff2da58
105cab2
bd7a67a
30f592a
672caf8
9c2af1b
0f155cf
12d44a4
2223eeb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import '@emotion/react'; | ||
import type { UseEuiTheme } from '@elastic/eui'; | ||
|
||
declare module '@emotion/react' { | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
export interface Theme extends UseEuiTheme {} | ||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -7,13 +7,13 @@ | |||||
|
||||||
import React from 'react'; | ||||||
import { Chart, Metric, Settings } from '@elastic/charts'; | ||||||
import { EuiIcon, EuiPanel, useEuiBackgroundColor } from '@elastic/eui'; | ||||||
import { EuiIcon, EuiPanel, UseEuiTheme, useEuiTheme } from '@elastic/eui'; | ||||||
MiriamAparicio marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
import type { PartialTheme, Theme } from '@elastic/charts'; | ||||||
import { i18n } from '@kbn/i18n'; | ||||||
import { COMPARATORS } from '@kbn/alerting-comparators'; | ||||||
|
||||||
export interface ChartProps { | ||||||
theme?: PartialTheme; | ||||||
theme?: UseEuiTheme<{}>; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would this work?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think so, i'll fix it on the next PR |
||||||
baseTheme: Theme; | ||||||
} | ||||||
|
||||||
|
@@ -41,7 +41,8 @@ export const Threshold = ({ | |||||
valueFormatter, | ||||||
warning, | ||||||
}: Props) => { | ||||||
const color = useEuiBackgroundColor('danger'); | ||||||
const { euiTheme } = useEuiTheme(); | ||||||
const color = euiTheme.colors.danger; | ||||||
mgadewoll marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
return ( | ||||||
<EuiPanel | ||||||
|
@@ -56,7 +57,7 @@ export const Threshold = ({ | |||||
data-test-subj={`threshold-${thresholds.join('-')}-${value}`} | ||||||
> | ||||||
<Chart> | ||||||
<Settings theme={theme} baseTheme={baseTheme} locale={i18n.getLocale()} /> | ||||||
<Settings theme={theme as PartialTheme} baseTheme={baseTheme} locale={i18n.getLocale()} /> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The types coming from the emotion Theme and the type requested for Settings theme doesn't match, we need to cast it as |
||||||
<Metric | ||||||
id={id} | ||||||
data={[ | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this potentially be an issue for flakiness should there be any further changes to the design system or theming?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought so, I will check if we can actually not pass the color for the test, or another option