From bbfbc65b57acfb1835b31e28f8ee96b4780cd051 Mon Sep 17 00:00:00 2001 From: Tim Sullivan Date: Wed, 4 Dec 2024 10:39:22 -0700 Subject: [PATCH] [SharedUX] Replace Sass with Emotion, Round 1 (#199885) Part of https://github.com/elastic/kibana-team/issues/1082 Selects certain Sass files to replace with styles declared with Emotion. This PR does not include any changes that would be noticeable by end-users. It changes the internals to use a different technology for styling components. ~~Some `className` attributes have been kept, because they are referenced in JS and tests.~~ Update: all classNames that are no longer needed for styling purposes have been removed. * If the className was needed for tests, it has been replaced with a test-subj. * If the className was used as a selector in production code, it has been replaced with alternative JS. 1. https://emotion.sh/docs/globals 2. https://emotion.sh/docs/best-practices 3. https://github.com/elastic/eui/discussions/6828#discussioncomment-10825360 --------- Co-authored-by: Jatin Kathuria (cherry picked from commit d86896bac0bbc5ed48b43e695e0a73c55b21450c) --- .../loading_indicator.test.tsx.snap | 73 +++++++++++++------ .../collapsible_nav.test.tsx.snap | 40 +++++++--- .../header/__snapshots__/header.test.tsx.snap | 6 +- .../src/ui/header/collapsible_nav.scss | 46 ------------ .../src/ui/header/collapsible_nav.tsx | 15 ++-- .../ui/header/get_collapsible_nav_styles.ts | 72 ++++++++++++++++++ .../src/ui/header/header_logo.scss | 11 --- .../src/ui/header/header_logo.tsx | 25 ++++++- .../src/ui/loading_indicator.scss | 4 - .../src/ui/loading_indicator.test.tsx | 4 +- .../src/ui/loading_indicator.tsx | 47 ++++++++---- .../chrome/navigation/src/ui/header_logo.scss | 4 - .../timelines/components/timeline/helpers.tsx | 2 +- x-pack/test/custom_branding/tests/settings.ts | 3 +- 14 files changed, 222 insertions(+), 130 deletions(-) delete mode 100644 packages/core/chrome/core-chrome-browser-internal/src/ui/header/collapsible_nav.scss create mode 100644 packages/core/chrome/core-chrome-browser-internal/src/ui/header/get_collapsible_nav_styles.ts delete mode 100644 packages/core/chrome/core-chrome-browser-internal/src/ui/header/header_logo.scss delete mode 100644 packages/core/chrome/core-chrome-browser-internal/src/ui/loading_indicator.scss delete mode 100644 packages/shared-ux/chrome/navigation/src/ui/header_logo.scss diff --git a/packages/core/chrome/core-chrome-browser-internal/src/ui/__snapshots__/loading_indicator.test.tsx.snap b/packages/core/chrome/core-chrome-browser-internal/src/ui/__snapshots__/loading_indicator.test.tsx.snap index b221e4e9a64ab..c8e702f228b20 100644 --- a/packages/core/chrome/core-chrome-browser-internal/src/ui/__snapshots__/loading_indicator.test.tsx.snap +++ b/packages/core/chrome/core-chrome-browser-internal/src/ui/__snapshots__/loading_indicator.test.tsx.snap @@ -1,31 +1,62 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`kbnLoadingIndicator is hidden by default 1`] = ` - + + + + `; exports[`kbnLoadingIndicator is visible when loadingCount is > 0 1`] = ` - + + + + `; exports[`kbnLoadingIndicator shows logo image when customLogo is set 1`] = ` - + + + + `; diff --git a/packages/core/chrome/core-chrome-browser-internal/src/ui/header/__snapshots__/collapsible_nav.test.tsx.snap b/packages/core/chrome/core-chrome-browser-internal/src/ui/header/__snapshots__/collapsible_nav.test.tsx.snap index 62b40f0d05e9b..167c919d6f498 100644 --- a/packages/core/chrome/core-chrome-browser-internal/src/ui/header/__snapshots__/collapsible_nav.test.tsx.snap +++ b/packages/core/chrome/core-chrome-browser-internal/src/ui/header/__snapshots__/collapsible_nav.test.tsx.snap @@ -168,7 +168,7 @@ Array [ >