Skip to content

Commit

Permalink
eui&team review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MiriamAparicio committed Dec 18, 2024
1 parent b204b08 commit ceaf0a3
Show file tree
Hide file tree
Showing 17 changed files with 35 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ export function getServiceHealthStatusColor(
) {
switch (status) {
case ServiceHealthStatus.healthy:
return euiTheme.colors.vis.euiColorVis0;
return euiTheme.colors.success;
case ServiceHealthStatus.warning:
return euiTheme.colors.vis.euiColorVis5;
return euiTheme.colors.warning;
case ServiceHealthStatus.critical:
return euiTheme.colors.vis.euiColorVis9;
return euiTheme.colors.danger;
case ServiceHealthStatus.unknown:
return euiTheme.colors.mediumShade;
}
Expand All @@ -56,11 +56,11 @@ export function getServiceHealthStatusBadgeColor(
) {
switch (status) {
case ServiceHealthStatus.healthy:
return euiTheme.colors.vis.euiColorVis0;
return euiTheme.colors.success;
case ServiceHealthStatus.warning:
return euiTheme.colors.vis.euiColorVis5;
return euiTheme.colors.warning;
case ServiceHealthStatus.critical:
return euiTheme.colors.vis.euiColorVis9;
return euiTheme.colors.danger;
case ServiceHealthStatus.unknown:
return euiTheme.colors.mediumShade;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
Tooltip,
niceTimeFormatter,
} from '@elastic/charts';
import { EuiSpacer, useEuiTheme } from '@elastic/eui';
import { COLOR_MODES_STANDARD, EuiSpacer, useEuiTheme } from '@elastic/eui';
import React, { useMemo } from 'react';
import { IUiSettingsClient } from '@kbn/core/public';
import { TimeUnitChar } from '@kbn/observability-plugin/common';
Expand Down Expand Up @@ -122,7 +122,7 @@ export function ChartPreview({
legendPosition={'bottom'}
legendSize={legendSize}
locale={i18n.getLocale()}
theme={theme.colorMode === 'DARK' ? DARK_THEME : LIGHT_THEME}
theme={theme.colorMode === COLOR_MODES_STANDARD.dark ? DARK_THEME : LIGHT_THEME}
/>
<LineAnnotation
dataValues={[{ dataValue: threshold }]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ export function FieldStatsPopover({
)}
data-test-subj={'apmCorrelationsContextPopoverButton'}
css={css`
marginleft: ${euiTheme.size.xs};
margin-left: ${euiTheme.size.xs};
`}
/>
</EuiToolTip>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const CentralizedContainer = styled.div`

const Border = styled.div`
height: 55px;
border-right: 1px solid ${({ theme }) => theme.euiTheme.colors.lightShade};
border-right: ${({ theme }) => theme.euiTheme.border.thin};
`;

function VerticalRule() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ export function Controls() {
);

const [zoom, setZoom] = useState((cy && cy.zoom()) || 1);
// @ts-expect-error
const duration = parseInt(euiTheme.animation.fast, 10);
const duration = euiTheme.animation.fast ? parseInt(euiTheme.animation.fast, 10) : 0;
const downloadUrl = useDebugDownloadUrl(cy);
const viewFullMapUrl = getLegacyApmHref({
basePath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,9 @@ function getBorderWidth(el: cytoscape.NodeSingular) {
const isIE11 = !!window.MSInputMethodContext && !!document.documentMode;

export const getAnimationOptions = (euiTheme: EuiThemeComputed): cytoscape.AnimationOptions => ({
// @ts-expect-error
duration: parseInt(euiTheme.animation.normal, 10),
duration: euiTheme.animation.normal ? parseInt(euiTheme.animation.normal, 10) : 0,
// @ts-expect-error The cubic-bezier options here are not recognized by the cytoscape types
easing: euiTheme.animation.bouncetheme,
easing: euiTheme.animation.bounce,
});

const zIndexNode = 200;
Expand Down Expand Up @@ -124,7 +123,7 @@ const getStyle = (
color: (el: cytoscape.NodeSingular) =>
el.hasClass('primary') || el.selected()
? euiTheme.colors.textPrimary
: euiTheme.colors.text,
: euiTheme.colors.textParagraph,
// theme.euiFontFamily doesn't work here for some reason, so we're just
// specifying a subset of the fonts for the label text.
'font-family': 'Inter UI, Segoe UI, Helvetica, Arial, sans-serif',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ function SummaryMetric({
css={css`
${xlFontSize}
font-weight: ${euiTheme.font.weight.bold};
color: ${euiTheme.colors.text};
color: ${euiTheme.colors.textParagraph};
`}
>
{value}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,14 @@ const WaterfallNode = React.memo((props: WaterfallNodeProps) => {
forceState={node.expanded ? 'open' : 'closed'}
onToggle={toggleAccordion}
css={css`
border-top: 1px solid ${euiTheme.colors.lightShade};
border-top: ${euiTheme.border.thin};
.button_${node.item.id} {
width: 100%;
height: ${ACCORDION_HEIGHT}px;
margin-left: ${marginLeftLevel}px;
border-left: ${hasError
? `2px solid ${euiTheme.colors.danger};`
: `1px solid ${euiTheme.colors.lightShade};`};
? `${euiTheme.border.width.thick} solid ${euiTheme.colors.danger};`
: `${euiTheme.border.thin};`};
&:hover {
background-color: ${euiTheme.colors.lightestShade};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function TimelineAxis({ plotValues, marks = [], topTraceDuration }: Timel
key="topTrace"
x={topTraceDurationPosition}
y={0}
fill={euiTheme.colors.text}
fill={euiTheme.colors.textParagraph}
textAnchor="middle"
>
{tickFormatter(topTraceDuration).formatted}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const Description = styled.div`
`;

const ListItem = styled.li`
font-size: ${() => useEuiFontSize('s').fontSize};
font-size: ${() => useEuiFontSize('xs').fontSize};
height: ${({ theme }) => theme.euiTheme.size.xl};
align-items: center;
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function MLCallout({
}
| undefined;

const getLearnMoreLink = (color: 'primary' | 'accentSecondary') => {
const getLearnMoreLink = (color: 'primary' | 'success') => {
return (
<EuiButton
data-test-subj="apmGetLearnMoreLinkButton"
Expand Down Expand Up @@ -106,7 +106,7 @@ export function MLCallout({
primaryAction: isOnSettingsPage ? (
<EuiButton
data-test-subj="apmMLCalloutUpdateJobsButton"
color="accentSecondary"
color="success"
isLoading={loading}
onClick={() => {
setLoading(true);
Expand All @@ -120,7 +120,7 @@ export function MLCallout({
})}
</EuiButton>
) : (
getLearnMoreLink('accentSecondary')
getLearnMoreLink('success')
),
};
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const LineNumber = styled.div<{ highlight: boolean }>`
color: ${({ theme }) => theme.euiTheme.colors.mediumShade};
line-height: ${LINE_HEIGHT}px;
text-align: right;
border-right: 1px solid ${({ theme }) => theme.euiTheme.colors.lightShade};
border-right: ${({ theme }) => theme.euiTheme.border.thin};
background-color: ${({ highlight, theme }) =>
highlight ? tint(0.9, theme.euiTheme.colors.warning) : null};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,11 @@ export function expectTextsInDocument(output: any, texts: string[]) {
});
}

export function renderWithTheme(
component: React.ReactNode,
params?: any,
{ darkMode = false } = {}
) {
export function renderWithTheme(component: React.ReactNode, params?: any) {
return render(<EuiThemeProvider>{component}</EuiThemeProvider>, params);
}

export function mountWithTheme(tree: React.ReactElement<any>, { darkMode = false } = {}) {
export function mountWithTheme(tree: React.ReactElement<any>) {
function WrappingThemeProvider(props: any) {
return <EuiThemeProvider>{props.children}</EuiThemeProvider>;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { max } from 'lodash';
import * as React from 'react';
import styled from '@emotion/styled';
import { LogEntriesSummaryBucket } from '@kbn/logs-shared-plugin/common';
import { COLOR_MODES_STANDARD } from '@elastic/eui';

interface DensityChartProps {
buckets: LogEntriesSummaryBucket[];
Expand Down Expand Up @@ -66,14 +67,14 @@ export const DensityChart: React.FC<DensityChartProps> = ({

const DensityChartPositiveBackground = styled.rect`
fill: ${(props) =>
props.theme.colorMode === 'DARK'
props.theme.colorMode === COLOR_MODES_STANDARD.dark
? props.theme.euiTheme.colors.lightShade
: props.theme.euiTheme.colors.lightestShade};
`;

const PositiveAreaPath = styled.path`
fill: ${(props) =>
props.theme.colorMode === 'DARK'
props.theme.colorMode === COLOR_MODES_STANDARD.dark
? props.theme.euiTheme.colors.mediumShade
: props.theme.euiTheme.colors.lightShade};
`;
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
import { scaleLinear } from 'd3-scale';
import moment from 'moment';
import * as React from 'react';
import { COLOR_MODES_STANDARD } from '@elastic/eui';
import { DensityChart } from './density_chart';
import { HighlightedInterval } from './highlighted_interval';
import { SearchMarkers } from './search_markers';
Expand Down Expand Up @@ -166,7 +167,7 @@ const TimeCursor = styled.line`
pointer-events: none;
stroke-width: 1px;
stroke: ${(props) =>
props.theme.colorMode === 'DARK'
props.theme.colorMode === COLOR_MODES_STANDARD.dark
? props.theme.euiTheme.colors.darkestShade
: props.theme.euiTheme.colors.darkShade};
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { scaleTime } from 'd3-scale';
import * as React from 'react';
import styled from '@emotion/styled';
import { useEuiFontSize } from '@elastic/eui';
import { COLOR_MODES_STANDARD, useEuiFontSize } from '@elastic/eui';
import { useKibanaTimeZoneSetting } from '../../../hooks/use_kibana_time_zone_setting';
import { getTimeLabelFormat } from './time_label_formatter';

Expand Down Expand Up @@ -69,7 +69,7 @@ const TimeRulerTickLabel = styled.text`

const TimeRulerGridLine = styled.line`
stroke: ${(props) =>
props.theme.colorMode === 'DARK'
props.theme.colorMode === COLOR_MODES_STANDARD.dark
? props.theme.euiTheme.colors.darkestShade
: props.theme.euiTheme.colors.darkShade};
stroke-opacity: 0.5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
*/

import { LIGHT_THEME, DARK_THEME, PartialTheme } from '@elastic/charts';
import { useEuiTheme } from '@elastic/eui';
import { useEuiTheme, COLOR_MODES_STANDARD } from '@elastic/eui';
import { useMemo } from 'react';

export function useChartThemes() {
const theme = useEuiTheme();
const baseTheme = theme.colorMode === 'DARK' ? DARK_THEME : LIGHT_THEME;
const baseTheme = theme.colorMode === COLOR_MODES_STANDARD.dark ? DARK_THEME : LIGHT_THEME;

return useMemo(() => {
const themeOverrides: PartialTheme = {
Expand Down

0 comments on commit ceaf0a3

Please sign in to comment.