themesberg / flowbite-svelte

Official Svelte components built for Flowbite and Tailwind CSS
https://flowbite-svelte.com
MIT License
2.11k stars 255 forks source link

NavHamburger styling btnClass not working on latest flowbite version #1105

Open lltr opened 11 months ago

lltr commented 11 months ago

Describe the bug

From the docs https://flowbite-svelte.com/docs/components/navbar#NavHamburger_styling

It says using class prop will allow to overwrite btnClass, but trying to set class="lg:hidden" does not overwrite the default md:hidden. I am trying to make the navbar appear on a larger screen size '1024px' than '768px', referencing from https://github.com/shinokada/flowbite-sveltekit-responsive-sidebar-layout/blob/main/src/routes/%2Blayout.svelte

However, if I downgrade my version to flowbite 1.7.0 and flowbite-svelte 0.40.2 to match the above repository, it will work.

Reproduction

Copy the +layout.svelte into a new Sveltekit project with the latest flowbite and flowbite-svelte versions and it will not work as expected from the demo of https://github.com/shinokada/flowbite-sveltekit-responsive-sidebar-layout/blob/main/src/routes/%2Blayout.svelte

Even after setting class="focus:outline-none whitespace-normal rounded-lg focus:ring-2 p-1.5 focus:ring-gray-400 hover:bg-gray-100 dark:hover:bg-gray-600 m-0 mr-3 lg:hidden" or using the same btnClass from the demo code, it is not working.

The NavHamburger will also not trigger the correct menu to open, instead of opening the Drawer, it will open the Navbar.

Flowbite version and System Info

System:
    OS: Linux 5.15 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish)
    CPU: (8) x64 Common KVM processor
    Memory: 13.93 GB / 15.61 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 16.15.0 - ~/.nvm/versions/node/v16.15.0/bin/node
    npm: 9.6.1 - ~/.nvm/versions/node/v16.15.0/bin/npm
    pnpm: 8.7.6 - ~/.nvm/versions/node/v16.15.0/bin/pnpm
  npmPackages:
    @sveltejs/kit: ^1.20.4 => 1.25.1
    flowbite-svelte: ^0.44.18 => 0.44.18
    svelte: ^4.0.5 => 4.2.1
    vite: ^4.4.2 => 4.4.9
gi4no commented 11 months ago

@lltr try to use class="md:block lg:hidden"

niemyjski commented 10 months ago

Another reason why this should be fixed: https://github.com/themesberg/flowbite-svelte/issues/1156