Skip to content

Commit

Permalink
Merge pull request #12 from cchaos/discover/responsive-layout
Browse files Browse the repository at this point in the history
Using EUI Page components
  • Loading branch information
kertal authored Nov 26, 2020
2 parents 06896a7 + a44ef6f commit 5106a76
Show file tree
Hide file tree
Showing 29 changed files with 662 additions and 806 deletions.
156 changes: 0 additions & 156 deletions src/plugins/discover/public/application/_discover.scss

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export function ActionBar({
</EuiButtonEmpty>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiFormRow>
<EuiFormRow display="center">
<EuiFieldNumber
aria-label={
isSuccessor
Expand All @@ -130,6 +130,7 @@ export function ActionBar({
defaultMessage: 'Number of newer documents',
})
}
compressed
className="cxtSizePicker"
data-test-subj={`${type}CountPicker`}
disabled={isDisabled}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
@import 'histogram';
@import 'uninitialized';

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export const DiscoverUninitialized = ({ onRefresh }: Props) => {
<I18nProvider>
<EuiEmptyPrompt
iconType="discoverApp"
className="dscUninitialized"
title={
<h2>
<FormattedMessage id="discover.uninitializedTitle" defaultMessage="Start searching" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/

import $ from 'jquery';

interface LazyScope extends ng.IScope {
[key: string]: any;
}
Expand All @@ -33,20 +36,20 @@ export function createInfiniteScrollDirective() {
* and have therefore to be considered for calculation of infinite scrolling
*/
const scrollDiv = $element.parents('.dscTable');
const scrollDivMobile = $element.parents('.dscApp__frame');
const scrollDivMobile = $(window);

function onScroll() {
if (!$scope.more) return;
const usedScrollDiv = document.getElementsByClassName('dscSidebar__mobile').length
? scrollDivMobile
: scrollDiv;
const isMobileView = document.getElementsByClassName('dscSidebar__mobile').length > 0;
const usedScrollDiv = isMobileView ? scrollDivMobile : scrollDiv;
const scrollTop = usedScrollDiv.scrollTop();

const winHeight = Number(usedScrollDiv.height());
const winBottom = Number(winHeight) + Number(usedScrollDiv.scrollTop());
const winBottom = Number(winHeight) + Number(scrollTop);
const elTop = $element.get(0).offsetTop || 0;
const remaining = elTop - winBottom;

if (remaining <= winHeight * 0.5) {
if (remaining <= winHeight) {
$scope[$scope.$$phase ? '$eval' : '$apply'](function () {
$scope.more();
});
Expand All @@ -62,11 +65,11 @@ export function createInfiniteScrollDirective() {
}

scrollDiv.on('scroll', scheduleCheck);
scrollDivMobile.on('scroll', scheduleCheck);
window.addEventListener('scroll', scheduleCheck);
$scope.$on('$destroy', function () {
clearTimeout(checkTimer);
scrollDiv.off('scroll', scheduleCheck);
scrollDivMobile.off('scroll', scheduleCheck);
window.removeEventListener('scroll', scheduleCheck);
});
scheduleCheck();
},
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
import './context_app_legacy.scss';
import React from 'react';
import { FormattedMessage, I18nProvider } from '@kbn/i18n/react';
import { EuiPanel, EuiText, EuiPageContent, EuiPage } from '@elastic/eui';
import { EuiHorizontalRule, EuiText, EuiPageContent, EuiPage } from '@elastic/eui';
import { ContextErrorMessage } from '../context_error_message';
import {
DocTableLegacy,
Expand Down Expand Up @@ -100,14 +99,9 @@ export function ContextAppLegacy(renderProps: ContextAppProps) {
const loadingFeedback = () => {
if (status === LOADING_STATUS.UNINITIALIZED || status === LOADING_STATUS.LOADING) {
return (
<EuiPanel paddingSize="l" data-test-subj="contextApp_loadingIndicator">
<EuiText textAlign="center">
<FormattedMessage
id="discover.context.loadingDescription"
defaultMessage="Loading..."
/>
</EuiText>
</EuiPanel>
<EuiText textAlign="center" data-test-subj="contextApp_loadingIndicator">
<FormattedMessage id="discover.context.loadingDescription" defaultMessage="Loading..." />
</EuiText>
);
}
return null;
Expand All @@ -122,13 +116,13 @@ export function ContextAppLegacy(renderProps: ContextAppProps) {
<EuiPageContent paddingSize="s" className="dscCxtAppContent">
<ActionBar {...actionBarProps(PREDECESSOR_TYPE)} />
{loadingFeedback()}
<EuiHorizontalRule margin="xs" />
{isLoaded ? (
<EuiPanel paddingSize="none">
<div className="discover-table">
<DocTableLegacy {...docTableProps()} />
</div>
</EuiPanel>
<div className="discover-table">
<DocTableLegacy {...docTableProps()} />
</div>
) : null}
<EuiHorizontalRule margin="xs" />
<ActionBar {...actionBarProps(SUCCESSOR_TYPE)} />
</EuiPageContent>
</EuiPage>
Expand Down
Loading

0 comments on commit 5106a76

Please sign in to comment.