Skip to content

Commit

Permalink
[Code]: minor UI adjustment (#34659)
Browse files Browse the repository at this point in the history
  • Loading branch information
zfy0701 authored Apr 5, 2019
1 parent 0e69d70 commit 9aaf4ed
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 23 deletions.
2 changes: 1 addition & 1 deletion x-pack/plugins/code/public/components/admin_page/admin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class AdminPage extends React.PureComponent<Props, State> {
},
{
id: AdminTabs.languageServers,
name: 'Language Servers',
name: 'Language servers',
disabled: false,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ export const EmptyProject = ({ isAdmin }: { isAdmin: boolean }) => (
<EuiSpacer size="xl" />
<div className="code-projects-tab__empty_header">
<EuiText>
<h1>You don't have any projects yet.</h1>
<h1>You don't have any projects yet</h1>
</EuiText>
<EuiText color="subdued">{isAdmin && <p>Let's import your first one.</p>}</EuiText>
<EuiText color="subdued">{isAdmin && <p>Let's import your first one</p>}</EuiText>
</div>
{isAdmin && <ImportProject />}
<EuiSpacer />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { InstallationType } from '../../../common/installation';
import { LanguageServer, LanguageServerStatus } from '../../../common/language_server';
import { requestInstallLanguageServer } from '../../actions/language_server';
import { RootState } from '../../reducers';
import { JavaIcon, TypeScriptIcon } from '../shared/icons';
import { JavaIcon, TypeScriptIcon, GoIcon } from '../shared/icons';

const LanguageServerState = styled(EuiTextColor)`
color: ${props => props.color};
Expand All @@ -46,6 +46,8 @@ const LanguageServerLi = (props: {
return <TypeScriptIcon />;
} else if (name === 'Java') {
return <JavaIcon />;
} else if (name === 'Go') {
return <GoIcon />
}
};

Expand Down Expand Up @@ -135,9 +137,9 @@ class AdminLanguageSever extends React.PureComponent<Props, State> {
<h3>
{this.props.languageServers.length}
{this.props.languageServers.length > 1 ? (
<span> Language Servers</span>
<span> Language servers</span>
) : (
<span> Language Server</span>
<span> Language server</span>
)}
</h3>
</EuiText>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import {
EuiButton,
EuiButtonEmpty,
EuiFieldText,
EuiFlexGroup,
EuiFlexItem,
Expand Down Expand Up @@ -153,7 +154,7 @@ class CodeProjectTab extends React.PureComponent<Props, State> {
<EuiOverlayMask>
<EuiModal onClose={this.closeModal}>
<EuiModalHeader>
<EuiModalHeaderTitle>Add New Project</EuiModalHeaderTitle>
<EuiModalHeaderTitle>Add new project</EuiModalHeaderTitle>
</EuiModalHeader>
<EuiModalBody>
<EuiTitle size="xs">
Expand All @@ -176,9 +177,9 @@ class CodeProjectTab extends React.PureComponent<Props, State> {
</EuiForm>
</EuiModalBody>
<EuiModalFooter>
<EuiButton onClick={this.closeModal}>Cancel</EuiButton>
<EuiButtonEmpty onClick={this.closeModal}>Cancel</EuiButtonEmpty>
<EuiButton fill onClick={this.submitImportProject} disabled={this.props.importLoading}>
Import Project
Import project
</EuiButton>
</EuiModalFooter>
</EuiModal>
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/code/public/components/main/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@
width: calc(100% - $euiSizeXL);

&:hover {
background: $euiColorLightShade;
background: $euiFocusBackgroundColor;
}
}

.codeSearch__suggestion-item--active {
background: $euiColorLightShade;
background: $euiFocusBackgroundColor;
}

.codeSearch-suggestion--inner {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ export class SuggestionsComponent extends Component<Props> {
private childNodes: HTMLDivElement[] = [];
private parentNode: HTMLDivElement | null = null;

private viewMoreUrl() {
return url.format({
pathname: '/search',
query: {
q: this.props.query,
},
});
}

public render() {
if (!this.props.show || isEmpty(this.props.suggestionGroups)) {
return null;
Expand All @@ -42,7 +51,9 @@ export class SuggestionsComponent extends Component<Props> {
<div className="kbnTypeahead">
<div className="kbnTypeahead__popover">
{this.renderSuggestionGroups()}
<div className="codeSearch__full-text-button">Press ⮐ Return for Full Text Search</div>
<Link to={this.viewMoreUrl()}>
<div className="codeSearch__full-text-button">Press ⮐ Return for Full Text Search</div>
</Link>
</div>
</div>
</div>
Expand Down Expand Up @@ -102,15 +113,9 @@ export class SuggestionsComponent extends Component<Props> {
</EuiFlexGroup>
);

const viewMoreUrl = url.format({
pathname: '/search',
query: {
q: this.props.query,
},
});
const viewMore = (
<div className="codeSearch-suggestion__link">
<Link to={viewMoreUrl}>View More</Link>
<Link to={this.viewMoreUrl()}>View More</Link>
</div>
);

Expand Down
13 changes: 13 additions & 0 deletions x-pack/plugins/code/public/components/shared/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ export const JavaIcon = () => (
</svg>
);

// TODO: design a go icon
export const GoIcon = () => (
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
<g fill="none" fillRule="evenodd">
<rect width="32" height="32" />
<path
className="codeIcon__language"
fillRule="nonzero"
/>
</g>
</svg>
);

export const BinaryFileIcon = () => (
<svg
width="320"
Expand Down

0 comments on commit 9aaf4ed

Please sign in to comment.