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

[Lens/SCSS] Delete and migrate annotations.scss file #209074

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

mariairiartef
Copy link
Contributor

@mariairiartef mariairiartef commented Jan 31, 2025

Summary

Part of #208908

Replaces scss to css-in-js.

Checklist

  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines

@mariairiartef mariairiartef changed the title [Lens] Replace scss for heatmap expression [Lens] Replace scss for heatmap expression and xy annotations Feb 3, 2025
@mariairiartef mariairiartef changed the title [Lens] Replace scss for heatmap expression and xy annotations [Lens] Replace scss for xy annotations Feb 3, 2025
@mariairiartef mariairiartef self-assigned this Feb 4, 2025
@mariairiartef mariairiartef added Feature:Lens backport:version Backport to applied version labels release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v9.1.0 v8.19.0 labels Feb 4, 2025
@mariairiartef mariairiartef marked this pull request as ready for review February 6, 2025 16:39
@mariairiartef mariairiartef requested review from a team as code owners February 6, 2025 16:39
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-visualizations (Team:Visualizations)

@mariairiartef mariairiartef marked this pull request as draft February 7, 2025 13:36
@mariairiartef mariairiartef changed the title [Lens] Replace scss for xy annotations [Lens] Delete and migrate annotations.scss file Feb 7, 2025
@mariairiartef mariairiartef marked this pull request as ready for review February 7, 2025 14:39
@mariairiartef mariairiartef added the technical debt Improvement of the software architecture and operational architecture label Feb 10, 2025
@mariairiartef mariairiartef changed the title [Lens] Delete and migrate annotations.scss file [Lens/SCSS] Delete and migrate annotations.scss file Feb 10, 2025
Copy link
Contributor

@MichaelMarcialis MichaelMarcialis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @mariairiartef! I left a couple of small questions/suggestions below for your review, but otherwise this looks good to me. Assuming you're able to address those, approving now so that I don't hold you up.

Comment on lines 404 to 438
const styles = {
xyAnnotationTooltip: css({
borderRadius: '0 !important',
}),
xyAnnotationTooltipRows: css({
// maxHeight: '60vh',
overflowY: 'hidden',
}),
xyAnnotationTooltipRow: ({ euiTheme }: UseEuiTheme) =>
css({
fontWeight: euiTheme.font.weight.regular,
padding: `${euiTheme.size.s} ${euiTheme.size.m} ${euiTheme.size.s} ${euiTheme.size.s}`,
borderRadius: '0 !important',
}),
xyAnnotationTooltipExtraFields: ({ euiTheme }: UseEuiTheme) =>
css({
color: euiTheme.colors.darkShade,
marginTop: euiTheme.size.s,
}),
xyAnnotationTooltipExtraFieldsKey: css({
overflowWrap: 'anywhere',
hyphens: 'auto',
}),
xyAnnotationTooltipExtraFieldsValue: css({
textAlign: 'right',
overflowWrap: 'anywhere',
hyphens: 'auto',
}),
xyAnnotationTooltipSkippedCount: ({ euiTheme }: UseEuiTheme) =>
css({
position: 'relative',
textAlign: 'right',
fontWeight: euiTheme.font.weight.regular,
}),
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it makes sense to keep the whole prefix-y name. The styles are collocated so it's ok to simplify:

Suggested change
const styles = {
xyAnnotationTooltip: css({
borderRadius: '0 !important',
}),
xyAnnotationTooltipRows: css({
// maxHeight: '60vh',
overflowY: 'hidden',
}),
xyAnnotationTooltipRow: ({ euiTheme }: UseEuiTheme) =>
css({
fontWeight: euiTheme.font.weight.regular,
padding: `${euiTheme.size.s} ${euiTheme.size.m} ${euiTheme.size.s} ${euiTheme.size.s}`,
borderRadius: '0 !important',
}),
xyAnnotationTooltipExtraFields: ({ euiTheme }: UseEuiTheme) =>
css({
color: euiTheme.colors.darkShade,
marginTop: euiTheme.size.s,
}),
xyAnnotationTooltipExtraFieldsKey: css({
overflowWrap: 'anywhere',
hyphens: 'auto',
}),
xyAnnotationTooltipExtraFieldsValue: css({
textAlign: 'right',
overflowWrap: 'anywhere',
hyphens: 'auto',
}),
xyAnnotationTooltipSkippedCount: ({ euiTheme }: UseEuiTheme) =>
css({
position: 'relative',
textAlign: 'right',
fontWeight: euiTheme.font.weight.regular,
}),
};
const styles = {
tooltip: css({
borderRadius: '0 !important',
}),
rows: css({
// maxHeight: '60vh',
overflowY: 'hidden',
}),
row: ({ euiTheme }: UseEuiTheme) =>
css({
fontWeight: euiTheme.font.weight.regular,
padding: `${euiTheme.size.s} ${euiTheme.size.m} ${euiTheme.size.s} ${euiTheme.size.s}`,
borderRadius: '0 !important',
}),
extraFields: ({ euiTheme }: UseEuiTheme) =>
css({
color: euiTheme.colors.darkShade,
marginTop: euiTheme.size.s,
}),
extraFieldKey: css({
overflowWrap: 'anywhere',
hyphens: 'auto',
}),
extraFieldValue: css({
textAlign: 'right',
overflowWrap: 'anywhere',
hyphens: 'auto',
}),
skippedCount: ({ euiTheme }: UseEuiTheme) =>
css({
position: 'relative',
textAlign: 'right',
fontWeight: euiTheme.font.weight.regular,
}),
};

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok! I've only removed the xyAnnotation prefix here since the first style refers to the tooltip and the rest are related. Let me know if it makes sense too

Comment on lines 12 to 14
import { EuiFlexGroup, EuiIcon, EuiIconProps, EuiText, useEuiFontSize } from '@elastic/eui';
import { css } from '@emotion/react';
import { UseEuiTheme } from '@elastic/eui';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { EuiFlexGroup, EuiIcon, EuiIconProps, EuiText, useEuiFontSize } from '@elastic/eui';
import { css } from '@emotion/react';
import { UseEuiTheme } from '@elastic/eui';
import { EuiFlexGroup, EuiIcon, EuiIconProps, EuiText, useEuiFontSize, UseEuiTheme } from '@elastic/eui';
import { css } from '@emotion/react';

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mariairiartef mariairiartef requested a review from mbondyra March 3, 2025 09:44
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
expressionXY 294 285 -9

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
expressionXY 125.5KB 121.0KB -4.4KB

History

cc @mariairiartef

Comment on lines +236 to +248
xyAnnotationNumberIcon: ({ euiTheme }: UseEuiTheme) =>
css({
borderRadius: euiTheme.size.base,
minWidth: euiTheme.size.base,
height: euiTheme.size.base,
backgroundColor: 'currentColor',
}),
xyAnnotationNumberIconText: ({ euiTheme }: UseEuiTheme) =>
css({
fontWeight: euiTheme.font.weight.medium,
letterSpacing: '-.5px',
}),
xyAnnotationIconRotate90: css({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you have done in the src/platform/plugins/shared/chart_expressions/expression_xy/public/components/annotations.tsx file you can probably remove the xyAnnotation prefix on each style

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:version Backport to applied version labels Feature:Lens release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure technical debt Improvement of the software architecture and operational architecture v8.18.0 v8.19.0 v9.0.0 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants