Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Laravel rendering duplicated classes. How to fix it?

I’m new to Laravel.

I have the following snippet in my navigation.blade.php:

<div class="space-x-8 text-xl sm:-my-px sm:ml-10 sm:flex">
    <x-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')" >
        {{ __('Licenses') }}
    </x-nav-link>
    <!-- some more links -->
</div>

And this snippet is being rendered like this:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

<div class="space-x-8 text-xl sm:-my-px sm:ml-10 sm:flex">
    <a class="inline-flex 
              items-center 
              px-1 
              pt-1 
              border-b-2 
              border-indigo-400 
/* issue-> */ text-sm 
              font-medium 
              leading-5 
              text-gray-900 
              focus:outline-none 
              focus:border-indigo-700 
              transition 
              duration-150 
              ease-in-out 
/* issue-> */ text-base"
       href="https://my.domain/licenses">
        Licenses
    </a>
</div>

I marked the problematic points with /* issue-> */.

I tried looking for the base renderer that convert x-nav-link to an HTML <a href="...">...</a> without success.

Does anyone have any idea how to fix it?

>Solution :

<x-nav-link> points to a Laravel view component, which by default should reside in:

app/View/Components/NavLink.php

it has an associated view file in:

resources/views/components/nav-link.blade.php

Either one of those files contains the logic that adds text-sm and/or text-base classes.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading