Skip to content

Commit

Permalink
[Data visualizer] Improve design of expanded rows (elastic#118125)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreadelrio committed Nov 17, 2021
1 parent 0e04e22 commit b7edd97
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
@import 'components/field_data_row/index';

$panelWidthS: #{'max(20%, 225px)'};
$panelWidthM: #{'max(30%, 300px)'};
$panelWidthL: #{'max(40%, 450px)'};

.dvExpandedRow {
Expand Down Expand Up @@ -52,9 +53,6 @@ $panelWidthL: #{'max(40%, 450px)'};
}

.dvSummaryTable {
.euiTableRow > .euiTableRowCell {
border-bottom: 0;
}
.euiTableHeaderCell {
display: none;
}
Expand All @@ -63,6 +61,11 @@ $panelWidthL: #{'max(40%, 450px)'};
.dvSummaryTable__wrapper {
min-width: $panelWidthS;
max-width: $panelWidthS;

&.dvPanel__dateSummary {
min-width: $panelWidthM;
max-width: $panelWidthM;
}
}

.dvTopValues__wrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
*/

import React, { FC, ReactNode, useMemo } from 'react';
import { EuiBasicTable, EuiSpacer, RIGHT_ALIGNMENT, HorizontalAlignment } from '@elastic/eui';
import {
EuiBasicTable,
EuiSpacer,
RIGHT_ALIGNMENT,
LEFT_ALIGNMENT,
HorizontalAlignment,
} from '@elastic/eui';
import { Axis, BarSeries, Chart, Settings, ScaleType } from '@elastic/charts';

import { FormattedMessage } from '@kbn/i18n/react';
Expand Down Expand Up @@ -73,12 +79,13 @@ export const BooleanContent: FC<FieldDataRowProps> = ({ config }) => {
name: '',
render: (_: string, summaryItem: { display: ReactNode }) => summaryItem.display,
width: '25px',
align: RIGHT_ALIGNMENT as HorizontalAlignment,
align: LEFT_ALIGNMENT as HorizontalAlignment,
},
{
field: 'value',
name: '',
render: (v: string) => <strong>{v}</strong>,
align: RIGHT_ALIGNMENT as HorizontalAlignment,
},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
*/

import React, { FC, ReactNode } from 'react';
import { EuiBasicTable, HorizontalAlignment } from '@elastic/eui';
import { EuiBasicTable, HorizontalAlignment, LEFT_ALIGNMENT, RIGHT_ALIGNMENT } from '@elastic/eui';
// @ts-ignore
import { formatDate } from '@elastic/eui/lib/services/format';
import { FormattedMessage } from '@kbn/i18n/react';

import { i18n } from '@kbn/i18n';
import { RIGHT_ALIGNMENT } from '@elastic/eui';
import type { FieldDataRowProps } from '../../types/field_data_row';
import { ExpandedRowFieldHeader } from '../expanded_row_field_header';
import { DocumentStatsTable } from './document_stats';
Expand Down Expand Up @@ -65,19 +64,20 @@ export const DateContent: FC<FieldDataRowProps> = ({ config }) => {
field: 'function',
render: (func: string, summaryItem: { display: ReactNode }) => summaryItem.display,
width: '70px',
align: RIGHT_ALIGNMENT as HorizontalAlignment,
align: LEFT_ALIGNMENT as HorizontalAlignment,
},
{
field: 'value',
name: '',
render: (v: string) => <strong>{v}</strong>,
align: RIGHT_ALIGNMENT as HorizontalAlignment,
},
];

return (
<ExpandedRowContent dataTestSubj={'dataVisualizerDateContent'}>
<DocumentStatsTable config={config} />
<ExpandedRowPanel className={'dvSummaryTable__wrapper dvPanel__wrapper'}>
<ExpandedRowPanel className={'dvSummaryTable__wrapper dvPanel__wrapper dvPanel__dateSummary'}>
<ExpandedRowFieldHeader>{summaryTableTitle}</ExpandedRowFieldHeader>
<EuiBasicTable<SummaryTableItem>
className={'dvSummaryTable'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { FormattedMessage } from '@kbn/i18n/react';
import React, { FC, ReactNode } from 'react';
import { i18n } from '@kbn/i18n';
import { EuiBasicTable, HorizontalAlignment, RIGHT_ALIGNMENT } from '@elastic/eui';
import { EuiBasicTable, HorizontalAlignment, LEFT_ALIGNMENT, RIGHT_ALIGNMENT } from '@elastic/eui';
import { ExpandedRowFieldHeader } from '../expanded_row_field_header';
import { FieldDataRowProps } from '../../types';
import { roundToDecimalPlace } from '../../../utils';
Expand All @@ -20,12 +20,13 @@ const metaTableColumns = [
name: '',
render: (_: string, metaItem: { display: ReactNode }) => metaItem.display,
width: '25px',
align: RIGHT_ALIGNMENT as HorizontalAlignment,
align: LEFT_ALIGNMENT as HorizontalAlignment,
},
{
field: 'value',
name: '',
render: (v: string) => <strong>{v}</strong>,
align: RIGHT_ALIGNMENT as HorizontalAlignment,
},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const ExpandedRowPanel: FC<Props> = ({ children, dataTestSubj, grow, clas
<EuiPanel
data-test-subj={dataTestSubj}
hasShadow={false}
hasBorder={true}
hasBorder={false}
grow={!!grow}
className={className ?? ''}
paddingSize={'s'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
EuiFlexItem,
EuiText,
HorizontalAlignment,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
} from '@elastic/eui';

Expand Down Expand Up @@ -91,12 +92,13 @@ export const NumberContent: FC<FieldDataRowProps> = ({ config, onAddFilter }) =>
name: '',
render: (summaryItem: { display: ReactNode }) => summaryItem.display,
width: '25px',
align: RIGHT_ALIGNMENT as HorizontalAlignment,
align: LEFT_ALIGNMENT as HorizontalAlignment,
},
{
field: 'value',
name: '',
render: (v: string) => <strong>{v}</strong>,
align: RIGHT_ALIGNMENT as HorizontalAlignment,
},
];

Expand Down

0 comments on commit b7edd97

Please sign in to comment.