menu icon indicating copy to clipboard operation
menu copied to clipboard

Merging Attr to links

Open YnievesDotNet opened this issue 1 year ago • 3 comments

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 avatar Aug 22 '22 05:08 YnievesDotNet