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

Replace resize handle with border, and small UI touchups #7

Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 15 additions & 3 deletions packages/kbn-resizable-layout/src/panels_resizable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ export const PanelsResizable = ({
() => setResizeWithPortalsHackIsResizing(false),
[]
);
const baseButtonCss = css`
background-color: transparent !important;
gap: 0 !important;

&:not(:hover):not(:focus) {
&:before,
&:after {
width: 0;
}
}
`;
const defaultButtonCss = css`
z-index: 3;
`;
Expand Down Expand Up @@ -207,9 +218,10 @@ export const PanelsResizable = ({
</EuiResizablePanel>
<EuiResizableButton
className={resizeButtonClassName}
css={
resizeWithPortalsHackIsResizing ? resizeWithPortalsHackButtonCss : defaultButtonCss
}
css={[
baseButtonCss,
resizeWithPortalsHackIsResizing ? resizeWithPortalsHackButtonCss : defaultButtonCss,
]}
data-test-subj={`${dataTestSubj}ResizableButton`}
/>
<EuiResizablePanel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
.euiDataGrid--rowHoverHighlight .euiDataGridRow:hover .euiDataGridRowCell__contentByHeight + .euiDataGridRowCell__expandActions {
background-color: tintOrShade($euiColorLightShade, 50%, 0);
}

.euiDataGrid__scrollOverlay .euiDataGrid__scrollBarOverlayRight {
background-color: transparent; // otherwise the grid scrollbar border visually conflicts with the grid toolbar controls
}
}

.unifiedDataTable__table {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
EuiScreenReaderOnly,
EuiSpacer,
EuiText,
EuiHorizontalRule,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { css } from '@emotion/react';
Expand Down Expand Up @@ -330,16 +329,13 @@ function DiscoverDocumentsComponent({

if (isDataViewLoading || (isEmptyDataResult && isDataLoading)) {
return (
<>
<EuiHorizontalRule />
<div className="dscDocuments__loading">
<EuiText size="xs" color="subdued">
<EuiLoadingSpinner />
<EuiSpacer size="s" />
<FormattedMessage id="discover.loadingDocuments" defaultMessage="Loading documents" />
</EuiText>
</div>
</>
<div className="dscDocuments__loading">
<EuiText size="xs" color="subdued">
<EuiLoadingSpinner />
<EuiSpacer size="s" />
<FormattedMessage id="discover.loadingDocuments" defaultMessage="Loading documents" />
</EuiText>
</div>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,6 @@ discover-app {
height: 100%;
}

.dscSidebarResizeButton {
background-color: transparent !important;

&:not(:hover):not(:focus) {
&:before, &:after {
width: 0;
}
}
}

.dscPageContent__wrapper {
overflow: hidden; // Ensures horizontal scroll of table
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem, EuiHorizontalRule } from '@elastic/eui';
import { DragDrop, type DropType, DropOverlayWrapper } from '@kbn/dom-drag-drop';
import React, { useCallback, useMemo } from 'react';
import { DataView } from '@kbn/data-views-plugin/common';
Expand All @@ -20,6 +20,7 @@ import { DiscoverStateContainer } from '../../services/discover_state';
import { FieldStatisticsTab } from '../field_stats_table';
import { DiscoverDocuments } from './discover_documents';
import { DOCUMENTS_VIEW_CLICK, FIELD_STATISTICS_VIEW_CLICK } from '../field_stats_table/constants';
import { useAppStateSelector } from '../../services/discover_app_state_container';

const DROP_PROPS = {
value: {
Expand Down Expand Up @@ -80,6 +81,8 @@ export const DiscoverMainContent = ({
) : undefined;
}, [viewMode, setDiscoverViewMode, isPlainRecord]);

const showChart = useAppStateSelector((state) => !state.hideChart);

return (
<DragDrop
draggable={false}
Expand All @@ -96,6 +99,7 @@ export const DiscoverMainContent = ({
responsive={false}
data-test-subj="dscMainContent"
>
{showChart && <EuiHorizontalRule margin="none" />}
{viewMode === VIEW_MODE.DOCUMENT_LEVEL ? (
<DiscoverDocuments
viewModeToggle={viewModeToggle}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ export const DiscoverResizableLayout = ({
minFlexPanelSize={minMainPanelWidth}
fixedPanel={<OutPortal node={sidebarPanelNode} />}
flexPanel={<OutPortal node={mainPanelNode} />}
resizeButtonClassName="dscSidebarResizeButton"
data-test-subj="discoverLayout"
onFixedPanelSizeChange={setSidebarWidth}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.dscGridToolbar {
padding: $euiSizeS;
border-bottom: $euiBorderThin;
}

.dscGridToolbarControlButton .euiDataGrid__controlBtn {
Expand Down Expand Up @@ -33,7 +32,7 @@
}

.dscGridToolbarControlGroup {
border: $euiBorderThin;
box-shadow: inset 0 0 0 $euiBorderWidthThin $euiBorderColor;
Copy link
Author

Choose a reason for hiding this comment

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

Using border here makes the buttons 34px instead of 32px, so they're slightly larger than the ones next to them. Using box-shadow instead seems to avoid this.

border-radius: $euiBorderRadiusSmall;
display: inline-flex;
align-items: stretch;
Expand All @@ -57,10 +56,6 @@
}
}

.dscGridToolbar .euiTabs {
transform: translateY(9px);
}

.dscGridToolbarBottom {
position: relative; // for placing a loading indicator correctly
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// stylelint-disable selector-no-qualifying-type
.kbnDocTableWrapper {
@include euiScrollBar;
@include euiOverflowShadow;
Copy link
Author

Choose a reason for hiding this comment

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

Added an overflow shadow to the legacy grid to improve the look of it with the new tabs design. It also looks good in the embeddable IMO.

overflow: auto;
display: flex;
flex: 1 1 100%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ export const DocumentViewModeToggle = ({
const isLegacy = useMemo(() => uiSettings.get(DOC_TABLE_LEGACY), [uiSettings]);
const includesNormalTabsStyle = viewMode === VIEW_MODE.AGGREGATED_LEVEL || isLegacy;

const tabsPadding = includesNormalTabsStyle ? euiTheme.size.s : 0;
const tabsCss = css`
padding: 0 ${includesNormalTabsStyle ? euiTheme.size.s : 0};
margin-top: ${includesNormalTabsStyle ? '17px' : 0};
padding: ${tabsPadding} ${tabsPadding} 0 ${tabsPadding};

.euiTab__content {
line-height: ${euiTheme.size.xl};
}
`;

const showViewModeToggle = uiSettings.get(SHOW_FIELD_STATISTICS) ?? false;
Expand All @@ -38,24 +42,17 @@ export const DocumentViewModeToggle = ({
}

return (
<EuiTabs
size="m"
css={tabsCss}
data-test-subj="dscViewModeToggle"
bottomBorder={includesNormalTabsStyle}
>
<EuiTabs size="m" css={tabsCss} data-test-subj="dscViewModeToggle" bottomBorder={false}>
<EuiTab
isSelected={viewMode === VIEW_MODE.DOCUMENT_LEVEL}
onClick={() => setDiscoverViewMode(VIEW_MODE.DOCUMENT_LEVEL)}
className="dscViewModeToggle__tab"
data-test-subj="dscViewModeDocumentButton"
>
<FormattedMessage id="discover.viewModes.document.label" defaultMessage="Documents" />
</EuiTab>
<EuiTab
isSelected={viewMode === VIEW_MODE.AGGREGATED_LEVEL}
onClick={() => setDiscoverViewMode(VIEW_MODE.AGGREGATED_LEVEL)}
className="dscViewModeToggle__tab"
data-test-subj="dscViewModeFieldStatsButton"
>
<FormattedMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,26 @@ export const SavedSearchEmbeddableBase: React.FC<SavedSearchEmbeddableBaseProps>
data-test-subj={dataTestSubj}
>
{isLoading && <EuiProgress size="xs" color="accent" position="absolute" />}
<EuiFlexItem grow={false}>
<EuiFlexGroup
justifyContent="flexEnd"
alignItems="center"
gutterSize="xs"
responsive={false}
wrap={true}
>
{Boolean(prepend) && <EuiFlexItem grow={false}>{prepend}</EuiFlexItem>}

{!!totalHitCount && (
<EuiFlexItem grow={false} data-test-subj="toolBarTotalDocsText">
<TotalDocuments totalHitCount={totalHitCount} />
</EuiFlexItem>
)}
</EuiFlexGroup>
</EuiFlexItem>
{(prepend || totalHitCount) && (
Copy link
Author

Choose a reason for hiding this comment

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

This gets rid of a few pixels in the embeddable due to the flex group gap when there is no content in the flex item.

<EuiFlexItem grow={false}>
<EuiFlexGroup
justifyContent="flexEnd"
alignItems="center"
gutterSize="xs"
responsive={false}
wrap={true}
>
{Boolean(prepend) && <EuiFlexItem grow={false}>{prepend}</EuiFlexItem>}

{!!totalHitCount && (
<EuiFlexItem grow={false} data-test-subj="toolBarTotalDocsText">
<TotalDocuments totalHitCount={totalHitCount} />
</EuiFlexItem>
)}
</EuiFlexGroup>
</EuiFlexItem>
)}

<EuiFlexItem style={{ minHeight: 0 }}>{children}</EuiFlexItem>

Expand Down
Loading