diff --git a/src/common/app-link/app-link.tsx b/src/common/app-link/app-link.tsx index c37024e..652fc03 100644 --- a/src/common/app-link/app-link.tsx +++ b/src/common/app-link/app-link.tsx @@ -13,29 +13,35 @@ import type { Params, RouteName } from "../../routes/routes"; defined in this project. To link outside, use tags as usual. */ +type Route = { + pathParams?: Params; + queryParams?: Params; + routeName: RouteName; +}; + // Extract pathParams from the routeName -type AppLinkProps = { +type AppLinkProps = { children: React.ReactNode; className?: string; - pathParams?: Params; - queryParams?: Params; - routeName: R; + route: Route; targetBlank?: boolean; + replace?: boolean; + preventScrollReset?: boolean; + state?: any; + reloadDocument?: boolean; }; const defaultProps = { className: "", - pathParams: {}, - queryParams: {}, targetBlank: false, + replace: false, + preventScrollReset: false, + reloadDocument: false, }; -const AppLink = (props: AppLinkProps) => { - const routePath = getRouteFor( - props.routeName, - props.pathParams, - props.queryParams, - ); +const AppLink = (props: AppLinkProps) => { + const { routeName, pathParams, queryParams } = props.route; + const routePath = getRouteFor(routeName, pathParams, queryParams); let targetBlankProps = {}; if (props.targetBlank) { targetBlankProps = { @@ -44,7 +50,15 @@ const AppLink = (props: AppLinkProps) => { }; } return ( - + {props.children} ); diff --git a/src/common/app-redirect/app-redirect.tsx b/src/common/app-redirect/app-redirect.tsx index 16043c0..0d30153 100644 --- a/src/common/app-redirect/app-redirect.tsx +++ b/src/common/app-redirect/app-redirect.tsx @@ -13,26 +13,24 @@ import type { Params, RouteName } from "../../routes/routes"; defined in this project. To link outside, use tags as usual. */ -type AppRedirectProps = { +type Route = { pathParams?: Params; queryParams?: Params; - routeName: R; + routeName: RouteName; }; -const defaultProps = { - pathParams: {}, - queryParams: {}, +type AppRedirectProps = { + route: Route; }; -const AppRedirect = (props: AppRedirectProps) => { +const AppRedirect = (props: AppRedirectProps) => { + const { routeName, pathParams, queryParams } = props.route; const goToPage = useGoToPage(); useEffect(() => { - goToPage(props.routeName, props.pathParams, props.queryParams); + goToPage(routeName, pathParams, queryParams); }, []); return null; }; -AppRedirect.defaultProps = defaultProps; - export { AppRedirect }; diff --git a/src/common/navbar/navbar.tsx b/src/common/navbar/navbar.tsx index 0db9172..baf61e2 100644 --- a/src/common/navbar/navbar.tsx +++ b/src/common/navbar/navbar.tsx @@ -10,11 +10,16 @@ export const Navbar = () => (
- Logo goes here + + Logo goes here +