Skip to content

Commit

Permalink
[8.x] [SharedUX] Replace Sass with Emotion, Round 1 (#199885) (#203314)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.x`:
- [[SharedUX] Replace Sass with Emotion, Round 1
(#199885)](#199885)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Tim
Sullivan","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-12-04T17:39:22Z","message":"[SharedUX]
Replace Sass with Emotion, Round 1 (#199885)\n\n## Summary\r\n\r\nPart
of https://github.com/elastic/kibana-team/issues/1082\r\n\r\nSelects
certain Sass files to replace with styles declared with Emotion.\r\nThis
PR does not include any changes that would be noticeable
by\r\nend-users. It changes the internals to use a different technology
for\r\nstyling components.\r\n\r\n~~Some `className` attributes have
been kept, because they are\r\nreferenced in JS and tests.~~ Update: all
classNames that are no longer\r\nneeded for styling purposes have been
removed.\r\n* If the className was needed for tests, it has been
replaced with a\r\ntest-subj.\r\n* If the className was used as a
selector in production code, it has\r\nbeen replaced with alternative
JS.\r\n\r\n## References\r\n1. https://emotion.sh/docs/globals\r\n2.
https://emotion.sh/docs/best-practices\r\n3.\r\nhttps://github.com/elastic/eui/discussions/6828#discussioncomment-10825360\r\n\r\n---------\r\n\r\nCo-authored-by:
Jatin Kathuria
<[email protected]>","sha":"d86896bac0bbc5ed48b43e695e0a73c55b21450c","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport
missing","v9.0.0","backport:prev-minor"],"number":199885,"url":"https://github.com/elastic/kibana/pull/199885","mergeCommit":{"message":"[SharedUX]
Replace Sass with Emotion, Round 1 (#199885)\n\n## Summary\r\n\r\nPart
of https://github.com/elastic/kibana-team/issues/1082\r\n\r\nSelects
certain Sass files to replace with styles declared with Emotion.\r\nThis
PR does not include any changes that would be noticeable
by\r\nend-users. It changes the internals to use a different technology
for\r\nstyling components.\r\n\r\n~~Some `className` attributes have
been kept, because they are\r\nreferenced in JS and tests.~~ Update: all
classNames that are no longer\r\nneeded for styling purposes have been
removed.\r\n* If the className was needed for tests, it has been
replaced with a\r\ntest-subj.\r\n* If the className was used as a
selector in production code, it has\r\nbeen replaced with alternative
JS.\r\n\r\n## References\r\n1. https://emotion.sh/docs/globals\r\n2.
https://emotion.sh/docs/best-practices\r\n3.\r\nhttps://github.com/elastic/eui/discussions/6828#discussioncomment-10825360\r\n\r\n---------\r\n\r\nCo-authored-by:
Jatin Kathuria
<[email protected]>","sha":"d86896bac0bbc5ed48b43e695e0a73c55b21450c"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/199885","number":199885,"mergeCommit":{"message":"[SharedUX]
Replace Sass with Emotion, Round 1 (#199885)\n\n## Summary\r\n\r\nPart
of https://github.com/elastic/kibana-team/issues/1082\r\n\r\nSelects
certain Sass files to replace with styles declared with Emotion.\r\nThis
PR does not include any changes that would be noticeable
by\r\nend-users. It changes the internals to use a different technology
for\r\nstyling components.\r\n\r\n~~Some `className` attributes have
been kept, because they are\r\nreferenced in JS and tests.~~ Update: all
classNames that are no longer\r\nneeded for styling purposes have been
removed.\r\n* If the className was needed for tests, it has been
replaced with a\r\ntest-subj.\r\n* If the className was used as a
selector in production code, it has\r\nbeen replaced with alternative
JS.\r\n\r\n## References\r\n1. https://emotion.sh/docs/globals\r\n2.
https://emotion.sh/docs/best-practices\r\n3.\r\nhttps://github.com/elastic/eui/discussions/6828#discussioncomment-10825360\r\n\r\n---------\r\n\r\nCo-authored-by:
Jatin Kathuria
<[email protected]>","sha":"d86896bac0bbc5ed48b43e695e0a73c55b21450c"}}]}]
BACKPORT-->
  • Loading branch information
tsullivan authored Dec 9, 2024
1 parent 1d3bed7 commit d90731a
Show file tree
Hide file tree
Showing 14 changed files with 222 additions and 130 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import './collapsible_nav.scss';
import {
EuiThemeProvider,
EuiCollapsibleNav,
Expand All @@ -18,6 +17,7 @@ import {
EuiListGroupItem,
EuiCollapsibleNavProps,
EuiButton,
useEuiTheme,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { groupBy, sortBy } from 'lodash';
Expand All @@ -36,6 +36,7 @@ import {
createEuiButtonItem,
createOverviewLink,
} from './nav_link';
import { getCollapsibleNavStyles } from './get_collapsible_nav_styles';

function getAllCategories(allCategorizedLinks: Record<string, ChromeNavLink[]>) {
const allCategories = {} as Record<string, AppCategory | undefined>;
Expand Down Expand Up @@ -149,6 +150,7 @@ export function CollapsibleNav({
...(needsIcon && { basePath }),
});
};
const styles = getCollapsibleNavStyles(useEuiTheme());

return (
<EuiCollapsibleNav
Expand All @@ -162,7 +164,7 @@ export function CollapsibleNav({
button={button}
ownFocus={false}
size={248}
className="kbnCollapsibleNav"
css={styles.navCss}
>
{customNavLink && (
<>
Expand Down Expand Up @@ -275,14 +277,14 @@ export function CollapsibleNav({
color="subdued"
gutterSize="none"
size="s"
className="kbnCollapsibleNav__recentsListGroup"
css={styles.navRecentsListGroupCss}
/>
</EuiCollapsibleNavGroup>
)}

<EuiHorizontalRule margin="none" />

<EuiFlexItem className="kbnCollapsibleNav__solutions">
<EuiFlexItem css={styles.navSolutions}>
{/* Kibana, Observability, Security, and Management sections */}
{orderedCategories.map((categoryName) => {
const category = categoryDictionary[categoryName]!;
Expand All @@ -294,11 +296,12 @@ export function CollapsibleNav({
iconType={category.euiIconType}
iconSize="m"
buttonElement={overviewLink ? 'div' : 'button'}
buttonClassName="kbnCollapsibleNav__solutionGroupButton"
css={styles.navSolutionGroupButton}
title={
overviewLink ? (
<a
className="eui-textInheritColor kbnCollapsibleNav__solutionGroupLink"
className="eui-textInheritColor"
css={styles.navSolutionGroupLink}
{...createOverviewLink({
link: overviewLink,
navigateToUrl,
Expand Down
Loading

0 comments on commit d90731a

Please sign in to comment.