jeroennoten / Laravel-AdminLTE

Easy AdminLTE integration with Laravel
MIT License
3.78k stars 1.08k forks source link

[QUESTION] I can't use more than one top navbar per page? #1273

Closed felpinhou closed 2 months ago

felpinhou commented 2 months ago

Describe the bug

I wanted to use the navbars from my own template, is this possible?

Steps To Reproduce

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem or to shown the issue.

Environment

Complete the next environment information.

Item Version
Laravel
Project
OS

Additional context

Add any other context about the problem here. If you already have ideas to solve the issue, add them here or create a Pull Request (PR).

dfsmania commented 2 months ago

@felpinhou Please, take the time to add more details, add screenshots, etc. Otherwise it'll hard to imagine what are your goals.

You can add your own customizations to the layout template provided by the package, but it'll be up to you to make it work nicely. In order to add or change the layout template, follow the instructions on Views Customizations

felpinhou commented 2 months ago

I want to use two navbars, one on the home page and one on the dashboard, but whenever I do this, the page is broken Captura de tela 2024-04-24 101839 this dashboard

Captura de tela 2024-04-24 101911

this is home, but Whenever I enter a dashboard page, the navbar keeps flashing without css

felpinhou commented 2 months ago

https://github.com/jeroennoten/Laravel-AdminLTE/assets/88860868/70e48b6e-b10b-47ce-b47b-92693ca76f12

:C

felpinhou commented 2 months ago

https://github.com/jeroennoten/Laravel-AdminLTE/assets/88860868/9ae05159-d88a-44a9-a683-d04f9cb6d370

this is my code... im brasilian kkkk, I have to deliver this project today without these css breaks

dfsmania commented 2 months ago

@felpinhou You need to understand that this isn't a problem on this package, it's related to your integration. I can see something weird in your index.blade.php file. You are defining a new body tag without closing it:

@section('header')
    {{-- The next body tag is really wrong here!!! REMOVE THIS!! --}}
    <body class="hold-transition layout-top-nav sidebar-collapse sidebar-closed">

    @component('parts.top-navbar-dashboard')
    @endcomponent
@endsection

The body tag is already defined in the adminlte::page blade layout, and it's dynamically managed by the AdminLTE package. Defining it again, even more without closing it, will cause a lot of conflicts. I'm not sure what you've tried to do there but it's really weird.

felpinhou commented 2 months ago

image

the body is already closed, in the default-template

felpinhou commented 2 months ago

but these css breaks still persist, but when I remove the navbar from the pages this break still continues :((

dfsmania commented 2 months ago

Do not add an extra body tag, remove it completely from your code, an HTML page can only have one body or head tags and that is already defined in the adminlte::page layout you're extending.

felpinhou commented 2 months ago

image

like this?

dfsmania commented 2 months ago

No, keep your original code that you showed first, but remove lines:

<body class="hold-transition layout-top-nav sidebar-collapse sidebar-closed">

and

</body>
felpinhou commented 2 months ago

image

like this? So, I put the class that made the sidebar collapsed in ''classes_body"

but it still gives those css loading errors

felpinhou commented 2 months ago

https://github.com/jeroennoten/Laravel-AdminLTE/assets/88860868/537c38cb-1a60-4cbf-be15-561cbd7dfe10

the page works normally when it doesn't have the top-navbar-dashboard, but when we enter the dashboard where the menu appears, it keeps giving these css errors

dfsmania commented 2 months ago

Yes, like that. You don't need to add sidebar_collapsed class, Since I see you're using layout_topnav=true, and that's mean without sidebar. Read Layout Configuration.

Also, please review Usage section, to check how the package should be used.

felpinhou commented 2 months ago

Before arriving at this result, I tried to use the adminlte:config navbar, but I can't use different navbars on different pages, there are pages where I can't use the navbar, there are pages where the navbar has to be different and it doesn't work with this navbar from adminlte:config

dfsmania commented 2 months ago

@felpinhou it's hard to guess what are you trying to achieve. In your Laravel project, you may extend the layout provided by this package to create an admin panel, the pages that don't need to show an admin panel, like your home page or other landing pages may be created with your own template. Once you arrive at the administration panel, there is no way to use different navbars while you keep navigating on it.

However, what you mean with different navbars? they have different links, or they have a different look/style?

felpinhou commented 2 months ago

differente look/style, is that, the only way to use a navbar without causing these css loading bugs, is to use the adminlte:config navbar, understand? And I want to use more than one navbar within my project

dfsmania commented 2 months ago

Well, I'm sure you can have a landing page, designed with your own style and with your own navbar implementation. The admin panel might then by accessed after the login process. Please, review your code, use the browser's console tool to check for errors, etc.

I can't help you much more here, the admin panel layout we offer here is bound to the underlying AdminLTE package, and it do not support replacing the navbar with your custom navbar.

dfsmania commented 2 months ago

@felpinhou If you're using Firefox on your testing, please check if you have this bug called Flash of Unstyled Content:

https://stackoverflow.com/questions/21147149/flash-of-unstyled-content-fouc-in-firefox-only-is-ff-slow-renderer

Some solutions are provided there...

dfsmania commented 2 months ago

Closed, no more feedback, not a package bug.