Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Adding a resolveRouteSegments function #148

Merged
merged 5 commits into from
Feb 9, 2024

Conversation

patricklafrance
Copy link
Member

@patricklafrance patricklafrance commented Feb 9, 2024

Adding a resolveRouteSegments function, allowing dynamic segment in navigation items to property.

const renderLinkItem: RenderLinkItemFunction = ({ label, { to, ...linkProps}, additionalProps }, index, level, userId) => {
    return (
        <li key={`${level}-${index}`}>
            <Link to={resolveRouteSegments(to as string, { userId })} {...linkProps} {...additionalProps}>
                {label}
            </Link>
        </li>
    );
};
export const register: ModuleRegisterFunction<FireflyRuntime> = (runtime) => {
    runtime.registerNavigationItem({
        $label: "User profile",
        to: "/user-profile/:userId"
    }, {
        menuId: "/user-profile"
    });
}

alexasselin008
alexasselin008 previously approved these changes Feb 9, 2024
@patricklafrance patricklafrance merged commit a448347 into main Feb 9, 2024
1 check passed
@patricklafrance patricklafrance deleted the feat/add_nav_items_segments_resolver branch February 9, 2024 20:30
@github-actions github-actions bot mentioned this pull request Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants