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

[ML] [File data visualizer] Removing scss files #178314

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
@import 'common/components/index';
@import 'file_data_visualizer/index';

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import { css } from '@emotion/react';
import { euiThemeVars } from '@kbn/ui-theme';
import type { FC } from 'react';
import React from 'react';

Expand All @@ -28,6 +30,13 @@ interface Props {
hasPermissionToImport: boolean;
}

const aboutPanelContentStyle = css`
.euiFilePicker__icon {
width: ${euiThemeVars.euiSizeXXL};
height: ${euiThemeVars.euiSizeXXL};
}
`;

export const AboutPanel: FC<Props> = ({ onFilePickerChange, hasPermissionToImport }) => {
return (
<EuiPageTemplate.Section alignment="center" data-test-subj="dataVisualizerPageFileUpload">
Expand All @@ -40,14 +49,15 @@ export const AboutPanel: FC<Props> = ({ onFilePickerChange, hasPermissionToImpor
<div css={{ textAlign: 'center' }}>
<EuiFilePicker
id="filePicker"
fullWidth
initialPromptText={i18n.translate(
'xpack.dataVisualizer.file.aboutPanel.selectOrDragAndDropFileDescription',
{
defaultMessage: 'Select or drag and drop a file',
}
)}
onChange={(files) => onFilePickerChange(files)}
className="file-datavisualizer-file-picker"
css={aboutPanelContentStyle}
/>
</div>
<EuiSpacer size="l" />
Expand All @@ -59,11 +69,7 @@ export const AboutPanel: FC<Props> = ({ onFilePickerChange, hasPermissionToImpor

export const LoadingPanel: FC = () => {
return (
<EuiPageTemplate.Section
alignment="center"
data-test-subj="dataVisualizerPageFileLoading"
className="file-datavisualizer-about-panel__content"
>
<EuiPageTemplate.Section alignment="center" data-test-subj="dataVisualizerPageFileLoading">
<EuiPageTemplate.EmptyPrompt
title={
<EuiTitle size="s">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,18 @@
import { FormattedMessage } from '@kbn/i18n-react';
import type { FC } from 'react';
import React from 'react';
import { euiThemeVars } from '@kbn/ui-theme';
import { css } from '@emotion/react';

import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiSpacer, EuiText, EuiTitle } from '@elastic/eui';

import { useDataVisualizerKibana } from '../../../kibana_context';

const docIconStyle = css({
marginLeft: euiThemeVars.euiSizeL,
marginTop: euiThemeVars.euiSizeXS,
});

interface Props {
hasPermissionToImport: boolean;
}
Expand All @@ -28,7 +35,16 @@ export const WelcomeContent: FC<Props> = ({ hasPermissionToImport }) => {
return (
<EuiFlexGroup gutterSize="xl" alignItems="center">
<EuiFlexItem grow={false}>
<EuiIcon size="xxl" type="addDataApp" className="file-datavisualizer-about-panel__icon" />
<EuiIcon
size="xxl"
type="addDataApp"
css={{
width: '96px',
height: '96px',
marginLeft: euiThemeVars.euiSizeXL,
marginRight: euiThemeVars.euiSizeL,
}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be reformatted for Emotion? Something like:

Suggested change
css={{
width: '96px',
height: '96px',
marginLeft: euiThemeVars.euiSizeXL,
marginRight: euiThemeVars.euiSizeL,
}}
css={css`
width: 96px;
height: 96px;
${logicalCSS('margin-left', euiThemeVars.euiSizeXL)}
${logicalCSS('margin-right', euiThemeVars.euiSizeL)}
`}

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the review. I'm not sure I understand the advantage of using a template literal over an object for these styles?
Looking at the generated css, it's basically the same.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, technically it'll result in the same outcome. I was just thinking in terms of consistency in the writing of styles. That said, it's not a deal-breaker by any means. If ya'll prefer to write your styles in a mix of formats, I'll defer to you.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree consistency is better. I've switched away from using template literals in this whole PR in favour of plain objects, which read better to me.
Updated in 584db08

/>
</EuiFlexItem>
<EuiFlexItem>
<EuiTitle size="m">
Expand Down Expand Up @@ -65,8 +81,8 @@ export const WelcomeContent: FC<Props> = ({ hasPermissionToImport }) => {
</p>
</EuiText>
<EuiSpacer size="m" />
<EuiFlexGroup gutterSize="l">
<EuiFlexItem grow={false} className="file-datavisualizer-about-panel__doc-icon">
<EuiFlexGroup gutterSize="m">
<EuiFlexItem grow={false} css={docIconStyle}>
<EuiIcon size="m" type="document" />
</EuiFlexItem>
<EuiFlexItem>
Expand All @@ -81,8 +97,8 @@ export const WelcomeContent: FC<Props> = ({ hasPermissionToImport }) => {
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer size="s" />
<EuiFlexGroup gutterSize="l">
<EuiFlexItem grow={false} className="file-datavisualizer-about-panel__doc-icon">
<EuiFlexGroup gutterSize="m">
<EuiFlexItem grow={false} css={docIconStyle}>
<EuiIcon size="m" type="document" />
</EuiFlexItem>
<EuiFlexItem>
Expand All @@ -97,8 +113,8 @@ export const WelcomeContent: FC<Props> = ({ hasPermissionToImport }) => {
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer size="s" />
<EuiFlexGroup gutterSize="l">
<EuiFlexItem grow={false} className="file-datavisualizer-about-panel__doc-icon">
<EuiFlexGroup gutterSize="m">
<EuiFlexItem grow={false} css={docIconStyle}>
<EuiIcon size="m" type="document" />
</EuiFlexItem>
<EuiFlexItem>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import { FormattedMessage } from '@kbn/i18n-react';
import React, { Component } from 'react';
import { euiThemeVars } from '@kbn/ui-theme';

import { EuiAccordion, EuiPagination } from '@elastic/eui';

Expand Down Expand Up @@ -56,11 +57,11 @@ export class Failures extends Component<Props, State> {
}
paddingSize="m"
>
<div className="failure-list">
<div css={{ maxHeight: '200px', overflowY: 'auto' }}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question as above. Reformat for Emotion?

Suggested change
<div css={{ maxHeight: '200px', overflowY: 'auto' }}>
<div css={css`
${logicalCSS('max-height', '200px')}
overflow-y: auto;
`}>

{this._renderPaginationControl()}
{this.props.failedDocs.slice(startIndex, endIndex).map(({ item, reason, doc }) => (
<div key={item}>
<div className="error-message">
<div css={{ color: euiThemeVars.euiColorDanger }}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question as above. Reformat for Emotion?

Suggested change
<div css={{ color: euiThemeVars.euiColorDanger }}>
<div css={css`
color: ${euiThemeVars.euiColorDanger};
`}>

{item}: {reason}
</div>
<div>{JSON.stringify(doc)}</div>
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const ResultsView: FC<Props> = ({
</EuiFlexGroup>

<EuiSpacer size="m" />
<div className="results">
<div>
Copy link
Contributor

@MichaelMarcialis MichaelMarcialis Mar 11, 2024

Choose a reason for hiding this comment

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

With the removal of this divs class, I imagine you can also remove the div itself, as it appears to be extraneous at the moment.

<EuiPanel data-test-subj="dataVisualizerFileFileContentPanel" hasShadow={false} hasBorder>
<FileContents
data={data}
Expand Down