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

[Code] align search page border and correct the rendering of empty search page #33378

Merged
merged 1 commit into from
Mar 18, 2019
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@
flex-grow: 1;
flex-shrink: 1;
overflow: auto;
}
}

.codeSearchbar__container {
height: 3.5rem;
padding: $euiSizeS;
border-bottom: $euiBorderWidthThin solid $euiBorderColor;
}
7 changes: 3 additions & 4 deletions x-pack/plugins/code/public/components/search_page/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class SearchPage extends React.PureComponent<Props, State> {
const statsComp = (
<EuiTitle size="m">
<h1>
Showing {from + 1} - {to} of {total} results.
Showing {total > 0 ? from : 0} - {to} of {total} results.
</h1>
</EuiTitle>
);
Expand All @@ -181,17 +181,16 @@ class SearchPage extends React.PureComponent<Props, State> {
} else if (
scope === SearchScope.DEFAULT &&
documentSearchResults &&
documentSearchResults.total > 0
(documentSearchResults.total > 0 || languages!.size > 0 || repositories!.size > 0)
) {
const { stats, results } = documentSearchResults!;
const { total, from, to, page, totalPage } = stats!;
languageStats = stats!.languageStats;
repoStats = stats!.repoStats;

const statsComp = (
<EuiTitle size="m">
<h1>
Showing {from} - {to} of {total} results.
Showing {total > 0 ? from : 0} - {to} of {total} results.
</h1>
</EuiTitle>
);
Expand Down
12 changes: 2 additions & 10 deletions x-pack/plugins/code/public/components/search_page/search_bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/

import theme from '@elastic/eui/dist/eui_theme_light.json';
import querystring from 'querystring';
import React from 'react';
import styled from 'styled-components';
import Url from 'url';

import { SearchScope } from '../../../model';
Expand All @@ -23,12 +21,6 @@ import {
SymbolSuggestionsProvider,
} from '../query_bar';

const SearchBarContainer = styled.div`
height: 4rem;
padding: ${theme.paddingSizes.s};
border-bottom: ${theme.euiBorderWidthThin} solid ${theme.euiBorderColor};
`;

interface Props {
query: string;
onSearchScopeChanged: (s: SearchScope) => void;
Expand Down Expand Up @@ -67,7 +59,7 @@ export class SearchBar extends React.PureComponent<Props> {
];

return (
<SearchBarContainer>
<div className="codeSearchbar__container">
<Shortcut
keyCode="p"
help={SearchScopeText[SearchScope.REPOSITORY]}
Expand Down Expand Up @@ -97,7 +89,7 @@ export class SearchBar extends React.PureComponent<Props> {
suggestionProviders={suggestionProviders}
onSearchScopeChanged={this.props.onSearchScopeChanged}
/>
</SearchBarContainer>
</div>
);
}
}