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

[FEATURE] Page Title / Header placement next to the Hamburger Menu #1324

Closed
CreativeWolf opened this issue Dec 2, 2024 · 2 comments
Closed
Labels
question Just a question, not an issue or bug

Comments

@CreativeWolf
Copy link

Firstly, thank you for this fantastic work!

Is your request related to a problem? Please describe.

I've chosen to use the sidebar as navbar and with that there's a lot of estate space in the top, in particular the page title / header can be placed there.

Describe the solution you'd like

I'd like to be able to configure the Page title / header and place it next to the hamburger menu

Describe alternatives you've considered

The alternatives are wasting a lot of estate space

Additional context

Attached screenshot for reference and you can see the page title - "Departments" can rather be placed next to the hamburger menu instead, thus saving a lot of estate space.
adminlte-screenshot

@CreativeWolf CreativeWolf added the enhancement Improvement related to this package label Dec 2, 2024
@dfsmania
Copy link
Collaborator

dfsmania commented Dec 2, 2024

Hello @CreativeWolf , that is a such customization you can make by publishing the package views and do some changes on the layout. After publishing the package views, first edit next file to add the content header into the navbar:

resources/views/vendor/adminlte/partials/navbar/navbar.blade.php

@inject('layoutHelper', 'JeroenNoten\LaravelAdminLte\Helpers\LayoutHelper')

<nav class="main-header navbar
    {{ config('adminlte.classes_topnav_nav', 'navbar-expand') }}
    {{ config('adminlte.classes_topnav', 'navbar-white navbar-light') }}">

    {{-- Navbar left links --}}
    <ul class="navbar-nav">
        {{-- Left sidebar toggler link --}}
        @include('adminlte::partials.navbar.menu-item-left-sidebar-toggler')

        {{-- NEW CONTENT HEADER NOW ON NAVBAR --}}
        @hasSection('content_header')
            <span class="content-header p-0 m-0">
                @yield('content_header')
            </span>
        @endif

        {{-- Configured left links --}}
        @each('adminlte::partials.navbar.menu-item', $adminlte->menu('navbar-left'), 'item')

        {{-- Custom left links --}}
        @yield('content_top_nav_left')
    </ul>

    {{-- Navbar right links --}}
    <ul class="navbar-nav ml-auto">
        {{-- Custom right links --}}
        @yield('content_top_nav_right')

        {{-- Configured right links --}}
        @each('adminlte::partials.navbar.menu-item', $adminlte->menu('navbar-right'), 'item')

        {{-- User menu link --}}
        @if(Auth::user())
            @if(config('adminlte.usermenu_enabled'))
                @include('adminlte::partials.navbar.menu-item-dropdown-user-menu')
            @else
                @include('adminlte::partials.navbar.menu-item-logout-link')
            @endif
        @endif

        {{-- Right sidebar toggler link --}}
        @if($layoutHelper->isRightSidebarEnabled())
            @include('adminlte::partials.navbar.menu-item-right-sidebar-toggler')
        @endif
    </ul>

</nav>

Then just comment out the content header section from next file:

resources/views/vendor/adminlte/partials/cwrapper/cwrapper-default.blade.php

@inject('layoutHelper', 'JeroenNoten\LaravelAdminLte\Helpers\LayoutHelper')
@inject('preloaderHelper', 'JeroenNoten\LaravelAdminLte\Helpers\preloaderHelper')

@if($layoutHelper->isLayoutTopnavEnabled())
    @php( $def_container_class = 'container' )
@else
    @php( $def_container_class = 'container-fluid' )
@endif

{{-- Default Content Wrapper --}}
<div class="{{ $layoutHelper->makeContentWrapperClasses() }}">

    {{-- Preloader Animation (cwrapper mode) --}}
    @if($preloaderHelper->isPreloaderEnabled('cwrapper'))
        @include('adminlte::partials.common.preloader')
    @endif

    {{-- Content Header --}}
    {{--
    @hasSection('content_header')
        <div class="content-header">
            <div class="{{ config('adminlte.classes_content_header') ?: $def_container_class }}">
                @yield('content_header')
            </div>
        </div>
    @endif
    --}}

    {{-- Main Content --}}
    <div class="content">
        <div class="{{ config('adminlte.classes_content') ?: $def_container_class }}">
            @stack('content')
            @yield('content')
        </div>
    </div>

</div>

However take note that long titles on the navbar won't look nicely on devices with small screen width (like a cellphone). I can't include this option on the base package because this isn't also compatible with the layout topnav only mode (i.e. when there isn't a sidebar).

@dfsmania dfsmania added question Just a question, not an issue or bug and removed enhancement Improvement related to this package labels Dec 2, 2024
@CreativeWolf
Copy link
Author

Thank you for taking your time for putting this how-to together for me, appreciate it a lot.

I also understand why it may not fit in the base due to the constraints you had mentioned.

I will try these steps and get it done.

Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Just a question, not an issue or bug
Projects
None yet
Development

No branches or pull requests

2 participants