Skip to content

Commit

Permalink
Fix: Remove extra outline from search boxes (#1438)
Browse files Browse the repository at this point in the history
* remove search box outline

* fix linting error

* add correct types on History component
  • Loading branch information
Onokaev authored Feb 15, 2022
1 parent df516d9 commit ab90380
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 12 deletions.
14 changes: 14 additions & 0 deletions src/app/utils/searchbox.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export const searchBoxStyles: any = () => ({
field: [
{
paddingLeft: 10
},
{
selectors: {
':focus': {
outline: 'none !important'
}
}
}
]
})
2 changes: 1 addition & 1 deletion src/app/views/app-sections/ResponseMessages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function responseMessages(graphResponse: IGraphResponse, sampleQuery: IQu
if (odataLink) {
return (
<MessageBar messageBarType={MessageBarType.info}>
<FormattedMessage id={'This response contains an @odata property'} />: @odata.{odataLink!.name}
<FormattedMessage id={'This response contains an @odata property.'} />: @odata.{odataLink!.name}
<Link onClick={() => setQuery()}>
&nbsp;<FormattedMessage id='Click here to follow the link' />
</Link>
Expand Down
3 changes: 2 additions & 1 deletion src/app/views/query-runner/request/permissions/PanelList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { IPermission } from '../../../../../types/permissions';
import { IRootState } from '../../../../../types/root';
import { dynamicSort } from '../../../../utils/dynamic-sort';
import { generateGroupsFromList } from '../../../../utils/generate-groups';
import { searchBoxStyles } from '../../../../utils/searchbox.styles';
import { setConsentedStatus } from './util';

interface IPanelList {
Expand Down Expand Up @@ -84,7 +85,7 @@ const PanelList = ({ messages,
placeholder={messages['Search permissions']}
onChange={(event?: React.ChangeEvent<HTMLInputElement>, newValue?: string) =>
searchValueChanged(event, newValue)}
styles={{ field: { paddingLeft: 10 } }}
styles={searchBoxStyles}
/>
<Announced message={`${permissions.length} search results available.`} />
<hr />
Expand Down
20 changes: 12 additions & 8 deletions src/app/views/sidebar/history/History.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { dynamicSort } from '../../../utils/dynamic-sort';
import { generateGroupsFromList } from '../../../utils/generate-groups';
import { sanitizeQueryUrl } from '../../../utils/query-url-sanitization';
import { parseSampleUrl } from '../../../utils/sample-url-generation';
import { searchBoxStyles } from '../../../utils/searchbox.styles';
import { translateMessage } from '../../../utils/translate-messages';
import { classNames } from '../../classnames';
import { sidebarStyles } from '../Sidebar.styles';
Expand Down Expand Up @@ -72,12 +73,12 @@ export class History extends Component<IHistoryProps, any> {
return `${year}-${month}-${day}`;
};

public getItems(history: any[]) {
public getItems(history: History[]) {
const {
intl: { messages }
}: any = this.props;

const items: any[] = [];
const items: History[] = [];

// tslint:disable-next-line:no-string-literal
const olderText = messages.older;
Expand All @@ -101,11 +102,14 @@ export class History extends Component<IHistoryProps, any> {
element.category = date;
items.push(element);
});
items
.sort(dynamicSort('createdAt', SortOrder.DESC))
.forEach((value, index) => {
value.index = index;
});
return this.sortItems(items);
}

private sortItems = ( items: History[] ) => {
items.sort(dynamicSort('createdAt', SortOrder.DESC));
items.forEach((value : any, index: number) => {
value.index = index;
});
return items;
}

Expand Down Expand Up @@ -509,7 +513,7 @@ export class History extends Component<IHistoryProps, any> {
placeholder={messages['Search history items']}
className={classes.searchBox}
onChange={this.searchValueChanged}
styles={{ field: { paddingLeft: 10 } }}
styles={searchBoxStyles}
/>
<hr />
<MessageBar
Expand Down
3 changes: 2 additions & 1 deletion src/app/views/sidebar/resource-explorer/ResourceExplorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { IRootState } from '../../../../types/root';
import { setSampleQuery } from '../../../services/actions/query-input-action-creators';
import { addResourcePaths } from '../../../services/actions/resource-explorer-action-creators';
import { GRAPH_URL } from '../../../services/graph-constants';
import { searchBoxStyles } from '../../../utils/searchbox.styles';
import { translateMessage } from '../../../utils/translate-messages';
import { classNames } from '../../classnames';
import { sidebarStyles } from '../Sidebar.styles';
Expand Down Expand Up @@ -197,7 +198,7 @@ const unstyledResourceExplorer = (props: any) => {
placeholder={translateMessage('Search resources')}
onChange={changeSearchValue}
disabled={!!isolated}
styles={{ field: { paddingLeft: 10 } }}
styles={searchBoxStyles}
/>
<hr />
<Stack wrap tokens={{ childrenGap: 10, padding: 10 }}>
Expand Down
3 changes: 2 additions & 1 deletion src/app/views/sidebar/sample-queries/SampleQueries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { substituteTokens } from '../../../utils/token-helpers';
import { classNames } from '../../classnames';
import { sidebarStyles } from '../Sidebar.styles';
import { isJsonString } from './sample-query-utils';
import { searchBoxStyles } from '../../../utils/searchbox.styles';

export class SampleQueries extends Component<ISampleQueriesProps, any> {
constructor(props: ISampleQueriesProps) {
Expand Down Expand Up @@ -410,7 +411,7 @@ export class SampleQueries extends Component<ISampleQueriesProps, any> {
className={classes.searchBox}
placeholder={messages['Search sample queries']}
onChange={this.searchValueChanged}
styles={{ field: { paddingLeft: 10 } }}
styles={searchBoxStyles}
aria-label={'Search'}
/>
<hr />
Expand Down

0 comments on commit ab90380

Please sign in to comment.