Skip to content

Commit

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

Part of elastic/kibana-team#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.

## References
1. https://emotion.sh/docs/globals
2. https://emotion.sh/docs/best-practices
3.
elastic/eui#6828 (comment)

---------

Co-authored-by: Jatin Kathuria <[email protected]>
  • Loading branch information
tsullivan and logeekal authored Dec 4, 2024
1 parent 16817cc commit d86896b
Show file tree
Hide file tree
Showing 14 changed files with 222 additions and 135 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 d86896b

Please sign in to comment.