docs: add query searching to components overview (#41095)

This commit is contained in:
Paul van Dyk 2023-03-07 07:39:55 +01:00 committed by GitHub
parent 48d9c625df
commit 767db3c6ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -99,7 +99,13 @@ const Overview: React.FC = () => {
const { search: urlSearch } = useLocation();
const { locale, formatMessage } = useIntl();
const [search, setSearch] = useState<string>('');
const [search, setSearch] = useState<string>(() => {
const params = new URLSearchParams(urlSearch);
if (params.has('s')) {
return params.get('s');
}
return '';
});
const sectionRef = useRef<HTMLElement>(null);