Skip to content

Commit 6e88cf2

Browse files
mbondyraJoseLuisGJ
authored andcommitted
[Lens/SCSS] Replace scss to css-in-js for Lens codebase (elastic#209768)
Replace SCSS in css-in-js for Lens codebase
1 parent 7744f7e commit 6e88cf2

File tree

127 files changed

+1674
-1981
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+1674
-1981
lines changed

src/platform/packages/shared/kbn-chart-icons/src/assets/drop_illustration.tsx

Lines changed: 90 additions & 35 deletions
Large diffs are not rendered by default.

src/platform/packages/shared/kbn-chart-icons/tsconfig.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,11 @@
22
"extends": "../../../../../tsconfig.base.json",
33
"compilerOptions": {
44
"outDir": "target/types",
5-
"types": [
6-
"jest",
7-
"node",
8-
"react",
9-
"@emotion/css/types"
10-
],
115
},
126
"include": [
137
"**/*.ts",
148
"**/*.tsx",
9+
"../../../../../typings/**/*"
1510
],
1611
"kbn_references": [
1712
"@kbn/ui-theme"

src/platform/packages/shared/kbn-visualization-ui-components/components/dimension_buttons/dimension_button.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,12 @@ function DimensionButtonImpl({
7575
<EuiFlexItem>
7676
<EuiToolTip content={message?.content} position="left">
7777
<EuiLink
78-
className="lnsLayerPanel__dimensionLink"
7978
css={css`
8079
width: 100%;
80+
&:focus {
81+
background-color: transparent;
82+
text-decoration-thickness: ${euiTheme.border.thin} !important;
83+
}
8184
&:hover {
8285
text-decoration: none;
8386
}

src/platform/packages/shared/kbn-visualization-ui-components/components/dimension_buttons/trigger.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ export const DimensionTrigger = ({
5959
<span
6060
className="dimensionTrigger__textLabel"
6161
css={css`
62+
.domDroppable--replacing & {
63+
text-decoration: line-through;
64+
}
6265
transition: background-color ${euiThemeVars.euiAnimSpeedFast} ease-in-out;
6366
6467
&:hover {

src/platform/test/functional/apps/discover/group3/_lens_vis.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
256256
'10'
257257
);
258258

259-
await testSubjects.click('unifiedHistogramEditFlyoutVisualization');
260259
expect(await getCurrentVisTitle()).to.be('Line');
261260
expect(await discover.getVisContextSuggestionType()).to.be('histogramForESQL');
262261
});

x-pack/platform/plugins/shared/lens/public/_mixins.scss

Lines changed: 0 additions & 69 deletions
This file was deleted.

x-pack/platform/plugins/shared/lens/public/_variables.scss

Lines changed: 0 additions & 10 deletions
This file was deleted.

x-pack/platform/plugins/shared/lens/public/app_plugin/app.scss

Lines changed: 0 additions & 40 deletions
This file was deleted.

x-pack/platform/plugins/shared/lens/public/app_plugin/app.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
* 2.0.
66
*/
77

8-
import './app.scss';
98
import React, { useState, useEffect, useCallback, useMemo, useRef } from 'react';
109
import { i18n } from '@kbn/i18n';
1110
import type { TimeRange } from '@kbn/es-query';
1211
import { EuiConfirmModal } from '@elastic/eui';
1312
import { useExecutionContext, useKibana } from '@kbn/kibana-react-plugin/public';
1413
import { OnSaveProps } from '@kbn/saved-objects-plugin/public';
1514
import type { VisualizeFieldContext } from '@kbn/ui-actions-plugin/public';
15+
import { css } from '@emotion/react';
1616
import { LensAppProps, LensAppServices } from './types';
1717
import { LensTopNavMenu } from './lens_top_nav';
1818
import { AddUserMessages, EditorFrameInstance, Simplify, UserMessagesGetter } from '../types';
@@ -437,7 +437,18 @@ export function App({
437437

438438
return (
439439
<>
440-
<div className="lnsApp" data-test-subj="lnsApp" role="main">
440+
<div
441+
data-test-subj="lnsApp"
442+
className="lnsApp"
443+
role="main"
444+
css={css`
445+
flex: 1 1 auto;
446+
display: flex;
447+
flex-direction: column;
448+
height: 100%;
449+
overflow: hidden;
450+
`}
451+
>
441452
<LensTopNavMenu
442453
initialInput={initialInput}
443454
redirectToOrigin={redirectToOrigin}

x-pack/platform/plugins/shared/lens/public/app_plugin/lens_top_nav.tsx

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ import { useKibana } from '@kbn/kibana-react-plugin/public';
1717
import { DataViewPickerProps } from '@kbn/unified-search-plugin/public';
1818
import { getManagedContentBadge } from '@kbn/managed-content-badge';
1919
import moment from 'moment';
20-
import { EuiCallOut } from '@elastic/eui';
20+
import { EuiCallOut, UseEuiTheme, euiBreakpoint } from '@elastic/eui';
2121
import { FormattedMessage } from '@kbn/i18n-react';
22+
import { SerializedStyles, css } from '@emotion/react';
2223
import { LENS_APP_LOCATOR } from '../../common/locator/locator';
2324
import { LENS_APP_NAME } from '../../common/constants';
2425
import { LensAppServices, LensTopNavActions, LensTopNavMenuProps } from './types';
@@ -102,6 +103,23 @@ function getSaveButtonMeta({
102103
}
103104
}
104105

106+
const navItemWithDividerStyles = (euiThemeContext: UseEuiTheme) => css`
107+
${euiBreakpoint(euiThemeContext, ['m', 'l', 'xl'])} {
108+
margin-right: ${euiThemeContext.euiTheme.size.m};
109+
position: relative;
110+
&:after {
111+
border-right: ${euiThemeContext.euiTheme.border.thin};
112+
bottom: 0;
113+
content: '';
114+
display: block;
115+
pointer-events: none;
116+
position: absolute;
117+
right: -${euiThemeContext.euiTheme.size.s};
118+
top: 0;
119+
}
120+
}
121+
`;
122+
105123
function getLensTopNavConfig(options: {
106124
isByValueMode: boolean;
107125
actions: LensTopNavActions;
@@ -123,7 +141,10 @@ function getLensTopNavConfig(options: {
123141
contextFromEmbeddable,
124142
isByValueMode,
125143
} = options;
126-
const topNavMenu: TopNavMenuData[] = [];
144+
145+
const topNavMenu: Array<
146+
TopNavMenuData | ({ css: ({ euiTheme }: UseEuiTheme) => SerializedStyles } & TopNavMenuData)
147+
> = [];
127148

128149
const showSaveAndReturn = actions.saveAndReturn.visible;
129150

@@ -150,13 +171,13 @@ function getLensTopNavConfig(options: {
150171
values: { contextOriginatingApp },
151172
}),
152173
run: actions.goBack.execute,
153-
className: 'lnsNavItem__withDivider',
154174
testId: 'lnsApp_goBackToAppButton',
155175
description: i18n.translate('xpack.lens.app.goBackLabel', {
156176
defaultMessage: `Go back to {contextOriginatingApp}`,
157177
values: { contextOriginatingApp },
158178
}),
159179
disableButton: !actions.goBack.enabled,
180+
css: navItemWithDividerStyles,
160181
});
161182
}
162183

@@ -169,12 +190,12 @@ function getLensTopNavConfig(options: {
169190
label: exploreDataInDiscoverLabel,
170191
run: actions.getUnderlyingDataUrl.execute,
171192
testId: 'lnsApp_openInDiscover',
172-
className: 'lnsNavItem__withDivider',
173193
description: exploreDataInDiscoverLabel,
174194
disableButton: !actions.getUnderlyingDataUrl.enabled,
175195
tooltip: actions.getUnderlyingDataUrl.tooltip,
176196
target: '_blank',
177197
href: actions.getUnderlyingDataUrl.getLink?.(),
198+
css: navItemWithDividerStyles,
178199
});
179200
}
180201

@@ -210,11 +231,11 @@ function getLensTopNavConfig(options: {
210231
defaultMessage: 'Settings',
211232
}),
212233
run: actions.openSettings.execute,
213-
className: 'lnsNavItem__withDivider',
214234
testId: 'lnsApp_settingsButton',
215235
description: i18n.translate('xpack.lens.app.settingsAriaLabel', {
216236
defaultMessage: 'Open the Lens settings menu',
217237
}),
238+
css: navItemWithDividerStyles,
218239
});
219240

220241
if (actions.cancel.visible) {

0 commit comments

Comments
 (0)