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

Merging Attr to links #7

Open
YnievesDotNet opened this issue Aug 22, 2022 · 3 comments
Open

Merging Attr to links #7

YnievesDotNet opened this issue Aug 22, 2022 · 3 comments
Assignees
Labels

Comments

@YnievesDotNet
Copy link

YnievesDotNet commented Aug 22, 2022

I trying to merge some attr to links when is active, but don't work. How is possible make that.

        $backendSideBarMenu = Menu::create('backendSideBarMenu', [
            'auto_activate' => true,
            'active_class' => 'shadow-soft-xl rounded-lg bg-white font-semibold text-slate-700',
            'active_element' => 'link',
        ]);
        $backendSideBarMenu->attr('class', 'flex flex-col pl-0 mb-0');
        $backendSideBarMenu->addItem('dashboard', __('Dashboard'), '/dashboard')->activateOnUrls('dashboard');
        $backendSideBarMenu->addItem('management', __('Management'), '/management')->activateOnUrls('management/*');
        $backendSideBarMenu->items->roots()->attr('class', 'mt-0.5 w-full');
        foreach ($backendSideBarMenu->items->roots() as $item) {
            $item->link->attr('class', 'py-2.7 text-size-sm ease-nav-brand my-0 mx-4 flex items-center whitespace-nowrap px-4 transition-colors');
        }

The active link only have the normal class py-2.7 ... when have to by shadow-soft-... py-2.7 ...

Best Regards.

Yoinier.

@YnievesDotNet
Copy link
Author

Other thing I are using the ServiceProvider method, but not work the auto activate procedure.

Thanks

@fulopattila122
Copy link
Contributor

How do you render the menu in the blade template?

@YnievesDotNet
Copy link
Author

How do you render the menu in the blade template?

{!! Menu::get('backendSideBarMenu')->render('ul') !!}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants