Name query filter on targets (#3144)
* Name query filter on targets * s/name/filter * Apply ?filter=<string> on all Filtered wrappers
This commit is contained in:
parent
449b5f2446
commit
f5efb7769b
@ -2,9 +2,11 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import React from 'react';
|
||||
import queryString from 'query-string';
|
||||
import React, { useEffect } from 'react';
|
||||
import { Input, Toggle } from '@polkadot/react-components';
|
||||
import { useApi } from '@polkadot/react-hooks';
|
||||
import { isString } from '@polkadot/util';
|
||||
|
||||
import { useTranslation } from './translate';
|
||||
|
||||
@ -21,6 +23,16 @@ function Filtering ({ children, className, nameFilter, setNameFilter, setWithIde
|
||||
const { t } = useTranslation();
|
||||
const { api } = useApi();
|
||||
|
||||
// on load, parse the query string and extract the filter
|
||||
useEffect((): void => {
|
||||
const queryFilter = queryString.parse(location.href.split('?')[1]).filter;
|
||||
|
||||
if (isString(queryFilter)) {
|
||||
setNameFilter(queryFilter);
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className={className}>
|
||||
<Input
|
||||
|
||||
Loading…
Reference in New Issue
Block a user