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

[Discover] Fix discover footer width #109403

Merged
merged 3 commits into from
Aug 23, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
Expand Up @@ -5,6 +5,7 @@
.kbnDocTableWrapper {
@include euiScrollBar;
overflow: auto;
display: flex;
flex: 1 1 100%;
flex-direction: column; /* 1 */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { EuiButtonEmpty } from '@elastic/eui';
import { DocTableProps, DocTableRenderProps, DocTableWrapper } from './doc_table_wrapper';
import { SkipBottomButton } from '../skip_bottom_button';

const FOOTER_PADDING = { padding: 0 };

const DocTableInfiniteContent = (props: DocTableRenderProps) => {
const [limit, setLimit] = useState(props.minimumVisibleRows);

Expand Down Expand Up @@ -74,29 +76,38 @@ const DocTableInfiniteContent = (props: DocTableRenderProps) => {
<table className="kbn-table table" data-test-subj="docTable">
<thead>{props.renderHeader()}</thead>
<tbody>{props.renderRows(props.rows.slice(0, limit))}</tbody>
</table>
{props.rows.length === props.sampleSize ? (
<div
className="kbnDocTable__footer"
data-test-subj="discoverDocTableFooter"
tabIndex={-1}
id="discoverBottomMarker"
>
<FormattedMessage
id="discover.howToSeeOtherMatchingDocumentsDescription"
defaultMessage="These are the first {sampleSize} documents matching
<tfoot>
<tr>
<td colSpan={(props.columnLength || 1) + 2} style={FOOTER_PADDING}>
{props.rows.length === props.sampleSize ? (
<div
className="kbnDocTable__footer"
data-test-subj="discoverDocTableFooter"
tabIndex={-1}
id="discoverBottomMarker"
>
<FormattedMessage
id="discover.howToSeeOtherMatchingDocumentsDescription"
defaultMessage="These are the first {sampleSize} documents matching
your search, refine your search to see others."
values={{ sampleSize: props.sampleSize }}
/>
<EuiButtonEmpty onClick={onBackToTop} data-test-subj="discoverBackToTop">
<FormattedMessage id="discover.backToTopLinkText" defaultMessage="Back to top." />
</EuiButtonEmpty>
</div>
) : (
<span tabIndex={-1} id="discoverBottomMarker">
&#8203;
</span>
)}
values={{ sampleSize: props.sampleSize }}
/>
<EuiButtonEmpty onClick={onBackToTop} data-test-subj="discoverBackToTop">
<FormattedMessage
id="discover.backToTopLinkText"
defaultMessage="Back to top."
/>
</EuiButtonEmpty>
</div>
) : (
<span tabIndex={-1} id="discoverBottomMarker">
&#8203;
</span>
)}
</td>
</tr>
</tfoot>
</table>
</Fragment>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export interface DocTableProps {
}

export interface DocTableRenderProps {
columnLength: number;
rows: DocTableRow[];
minimumVisibleRows: number;
sampleSize: number;
Expand Down Expand Up @@ -219,6 +220,7 @@ export const DocTableWrapper = ({
>
{rows.length !== 0 &&
render({
columnLength: columns.length,
rows,
minimumVisibleRows,
sampleSize,
Expand Down