mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-03-26 06:18:04 +00:00
Rename frontend directory (#472)
* Rename directory * Cleanup * Recover lost images * remove lint
This commit is contained in:
24
frontend/src/components/LinkWithSearchParams.tsx
Normal file
24
frontend/src/components/LinkWithSearchParams.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import { NavLink, useLocation } from "react-router-dom";
|
||||
|
||||
const LinkWithSearchParams = ({
|
||||
to,
|
||||
...props
|
||||
}: {
|
||||
to: string;
|
||||
end?: boolean;
|
||||
exclude?: string[];
|
||||
className?: string;
|
||||
children: React.ReactNode;
|
||||
}) => {
|
||||
const { search } = useLocation();
|
||||
const params = new URLSearchParams(search);
|
||||
|
||||
// For state we don't want to keep while navigating
|
||||
props.exclude?.forEach((key) => {
|
||||
params.delete(key);
|
||||
});
|
||||
|
||||
return <NavLink to={`${to}/?${params.toString()}`} {...props} />;
|
||||
};
|
||||
|
||||
export default LinkWithSearchParams;
|
||||
Reference in New Issue
Block a user