Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
className={styles.searchBox}
placeholder={`Search ${pageTitle}`}
value={searchQuery}
onChange={this._onSearchQueryChanged}
onClick={this._onSearchBoxClick}
underlined={true}
styles={searchBoxStyles}
/>
public constructor(props: INavProps) {
super(props);
this._localItems = !!window.localStorage
? {
defaultSortState: NavSortType[localStorage.getItem('defaultSortState') as keyof typeof NavSortType]
}
: {};
this.state = {
defaultSortState: this._localItems.defaultSortState ? NavSortType[this._localItems.defaultSortState] : NavSortType.categories,
searchQuery: '',
sortState: this._localItems.defaultSortState ? NavSortType[this._localItems.defaultSortState] : NavSortType.categories
};
}
private _setSortTypeCategories = (): void => {
this.setState(
{
defaultSortState: NavSortType.categories,
sortState: NavSortType.categories
},
() => {
localStorage.setItem('defaultSortState', NavSortType[NavSortType.categories]);
}
);
};
public constructor(props: INavProps) {
super(props);
this._localItems = !!window.localStorage
? {
defaultSortState: NavSortType[localStorage.getItem('defaultSortState') as keyof typeof NavSortType]
}
: {};
this.state = {
defaultSortState: this._localItems.defaultSortState ? NavSortType[this._localItems.defaultSortState] : NavSortType.categories,
searchQuery: '',
sortState: this._localItems.defaultSortState ? NavSortType[this._localItems.defaultSortState] : NavSortType.categories
};
}
() => {
localStorage.setItem('defaultSortState', NavSortType[NavSortType.categories]);
}
);
private _setSortTypeCategories = (): void => {
this.setState(
{
defaultSortState: NavSortType.categories,
sortState: NavSortType.categories
},
() => {
localStorage.setItem('defaultSortState', NavSortType[NavSortType.categories]);
}
);
};