Skip to content

Commit

Permalink
Fix hardcoded content warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
BPScott committed May 3, 2019
1 parent 76f9bb7 commit 9f586c0
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 5 deletions.
7 changes: 6 additions & 1 deletion src/components/SkeletonPage/SkeletonPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class SkeletonPage extends React.PureComponent<CombinedProps, never> {
secondaryActions,
title = '',
breadcrumbs,
polaris: {intl},
} = this.props;

const className = classNames(
Expand Down Expand Up @@ -80,7 +81,11 @@ export class SkeletonPage extends React.PureComponent<CombinedProps, never> {
) : null;

return (
<div className={className} role="status" aria-label="Page loading">
<div
className={className}
role="status"
aria-label={intl.translate('Polaris.SkeletonPage.loadingLabel')}
>
{headerMarkup}
<div className={styles.Content}>{children}</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/components/TopBar/TopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export class TopBar extends React.PureComponent<ComposedProps, State> {
onSearchResultsDismiss,
contextControl,
polaris: {
intl,
theme: {logo},
},
} = this.props;
Expand All @@ -77,7 +78,7 @@ export class TopBar extends React.PureComponent<ComposedProps, State> {
onClick={onNavigationToggle}
onFocus={this.handleFocus}
onBlur={this.handleBlur}
aria-label="Toggle menu"
aria-label={intl.translate('Polaris.TopBar.toggleMenuLabel')}
>
<Icon source={MobileHamburgerMajorMonotone} color="white" />
</button>
Expand Down
18 changes: 15 additions & 3 deletions src/components/TopBar/components/SearchField/SearchField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {classNames} from '@shopify/react-utilities/styles';

import {noop} from '../../../../utilities/other';
import Icon from '../../../Icon';
import {withAppProvider, WithAppProviderProps} from '../../../AppProvider';

import styles from './SearchField.scss';

Expand All @@ -26,7 +27,9 @@ export interface Props {
onCancel?(): void;
}

export default class SearchField extends React.Component<Props, never> {
export type ComposedProps = Props & WithAppProviderProps;

export class SearchField extends React.Component<ComposedProps, never> {
private input: React.RefObject<HTMLInputElement> = React.createRef();

componentDidMount() {
Expand Down Expand Up @@ -58,12 +61,20 @@ export default class SearchField extends React.Component<Props, never> {
}

render() {
const {value, focused, active, placeholder} = this.props;
const {
value,
focused,
active,
placeholder,
polaris: {intl},
} = this.props;

const clearMarkup = value !== '' && (
<button
type="button"
aria-label="Clear"
aria-label={intl.translate(
'Polaris.TopBar.SearchField.clearButtonLabel',
)}
className={styles.Clear}
onClick={this.handleClear}
>
Expand Down Expand Up @@ -148,3 +159,4 @@ function preventDefault(event: React.KeyboardEvent<HTMLInputElement>) {
event.preventDefault();
}
}
export default withAppProvider<Props>()(SearchField);
12 changes: 12 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@
}
},

"SkeletonPage": {
"loadingLabel": "Page loading"
},

"Spinner": {
"warningMessage": "The color {color} is not meant to be used on {size} spinners. The colors available on large spinners are: {colors}"
},
Expand All @@ -222,6 +226,14 @@
"TextField": {
"characterCount": "{count} characters",
"characterCountWithMaxLength": "{count} of {limit} characters used"
},

"TopBar": {
"toggleMenuLabel": "Toggle menu",

"SearchField": {
"clearButtonLabel": "Clear"
}
}
}
}

0 comments on commit 9f586c0

Please sign in to comment.