Skip to content

Commit

Permalink
Update copy and remove intl
Browse files Browse the repository at this point in the history
Update "Filter Invalid:" to sentence case
Remove inject intl wrapper from CheckupControls component
Remove unnecessary grow={true}
  • Loading branch information
jloleysens committed Feb 14, 2020
1 parent b4cdaf0 commit 518d010
Showing 1 changed file with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import React, { FunctionComponent, useState } from 'react';
import { i18n } from '@kbn/i18n';
import { EuiButton, EuiFieldSearch, EuiFlexGroup, EuiFlexItem, EuiCallOut } from '@elastic/eui';
import { FormattedMessage, injectI18n } from '@kbn/i18n/react';
import { FormattedMessage } from '@kbn/i18n/react';

import { DeprecationInfo } from 'src/legacy/core_plugins/elasticsearch';
import { GroupByOption, LevelFilterOption, LoadingState } from '../../types';
Expand All @@ -16,7 +16,7 @@ import { GroupByBar } from './group_by_bar';

import { validateRegExpString } from '../../../utils';

interface CheckupControlsProps extends ReactIntl.InjectedIntlProps {
interface CheckupControlsProps {
allDeprecations?: DeprecationInfo[];
loadingState: LoadingState;
loadData: () => void;
Expand All @@ -28,7 +28,7 @@ interface CheckupControlsProps extends ReactIntl.InjectedIntlProps {
onGroupByChange: (groupBy: GroupByOption) => void;
}

export const CheckupControlsUI: FunctionComponent<CheckupControlsProps> = ({
export const CheckupControls: FunctionComponent<CheckupControlsProps> = ({
allDeprecations,
loadingState,
loadData,
Expand All @@ -38,22 +38,26 @@ export const CheckupControlsUI: FunctionComponent<CheckupControlsProps> = ({
availableGroupByOptions,
currentGroupBy,
onGroupByChange,
intl,
}) => {
const [searchTermError, setSearchTermError] = useState<null | string>(null);
const filterInvalid = Boolean(searchTermError);
return (
<EuiFlexGroup direction="column" responsive={false}>
<EuiFlexItem grow={true}>
<EuiFlexGroup alignItems="center" wrap={true} responsive={false}>
<EuiFlexItem grow={true}>
<EuiFlexItem>
<EuiFieldSearch
isInvalid={filterInvalid}
aria-label="Filter"
placeholder={intl.formatMessage({
id: 'xpack.upgradeAssistant.checkupTab.controls.searchBarPlaceholder',
defaultMessage: 'Filter',
})}
aria-label={i18n.translate(
'xpack.upgradeAssistant.checkupTab.controls.searchBarPlaceholderAriaLabel',
{ defaultMessage: 'Filter' }
)}
placeholder={i18n.translate(
'xpack.upgradeAssistant.checkupTab.controls.searchBarPlaceholder',
{
defaultMessage: 'Filter',
}
)}
onChange={e => {
const string = e.target.value;
const errorMessage = validateRegExpString(string);
Expand Down Expand Up @@ -97,7 +101,7 @@ export const CheckupControlsUI: FunctionComponent<CheckupControlsProps> = ({
title={i18n.translate(
'xpack.upgradeAssistant.checkupTab.controls.filterErrorMessageLabel',
{
defaultMessage: 'Filter Invalid: {searchTermError}',
defaultMessage: 'Filter invalid: {searchTermError}',
values: { searchTermError },
}
)}
Expand All @@ -108,5 +112,3 @@ export const CheckupControlsUI: FunctionComponent<CheckupControlsProps> = ({
</EuiFlexGroup>
);
};

export const CheckupControls = injectI18n(CheckupControlsUI);

0 comments on commit 518d010

Please sign in to comment.