Skip to content

Commit

Permalink
fix(navbar): do not close menu if no url provided #217
Browse files Browse the repository at this point in the history
  • Loading branch information
jcfauchet committed Nov 19, 2024
1 parent 0d87495 commit 0ce1222
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion apps/web/src/generated-examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1538,7 +1538,7 @@ export const examples: Record<string, Example[]> = {
description: 'This example can be used to show a secondary dropdown menu when clicking on one of the navigation links.',
url: '/examples/[theme-rtl]/navbar/03-with-dropdown',
content:
'import { component$ } from \'@builder.io/qwik\'\nimport { Dropdown, Navbar } from \'flowbite-qwik\'\nimport { Link, StaticGenerateHandler } from \'@builder.io/qwik-city\'\n\nexport default component$(() => {\n return (\n <Navbar fluid rounded>\n <Navbar.Brand tag={Link} href="https://flowbite-qwik.com/">\n <img src="/small-logo.png" alt="Flowbite qwik logo" width="215" height="195" class="h-8 w-auto" />\n <span class="self-center whitespace-nowrap text-xl font-semibold dark:text-white">Flowbite Qwik</span>\n </Navbar.Brand>\n <div class="flex items-center md:order-2">\n <Dropdown\n as={\n <img\n class="h-8 w-8 rounded-full"\n src="https://res.cloudinary.com/dkht4mwqi/image/upload/f_auto,q_auto/v1718462568/flowbite-qwik/jpnykkz8ojq7ojgg4qta.jpg"\n alt="user photo"\n />\n }\n >\n <Dropdown.Item header>\n <span class="block text-sm">Bonnie Green</span>\n <span class="block truncate text-sm font-medium">[email protected]</span>\n </Dropdown.Item>\n <Dropdown.Item>Dashboard</Dropdown.Item>\n <Dropdown.Item>Settings</Dropdown.Item>\n <Dropdown.Item>Earnings</Dropdown.Item>\n <Dropdown.Item divider />\n <Dropdown.Item>Sign out</Dropdown.Item>\n </Dropdown>\n <Navbar.Toggle />\n </div>\n <Navbar.Collapse>\n <Navbar.Link href="/navbars" active>\n Home\n </Navbar.Link>\n <Navbar.Link href="/navbars">About</Navbar.Link>\n <Navbar.Link href="/navbars" tag="div">\n <Dropdown label="Services" inline>\n <Dropdown.Item>Dashboard</Dropdown.Item>\n <Dropdown.Item>Settings</Dropdown.Item>\n <Dropdown.Item>Earnings</Dropdown.Item>\n </Dropdown>\n </Navbar.Link>\n <Navbar.Link href="/navbars">Pricing</Navbar.Link>\n <Navbar.Link href="/navbars">Contact</Navbar.Link>\n </Navbar.Collapse>\n </Navbar>\n )\n})',
'import { component$ } from \'@builder.io/qwik\'\nimport { Dropdown, Navbar } from \'flowbite-qwik\'\nimport { Link, StaticGenerateHandler } from \'@builder.io/qwik-city\'\n\nexport default component$(() => {\n return (\n <Navbar fluid rounded>\n <Navbar.Brand tag={Link} href="https://flowbite-qwik.com/">\n <img src="/small-logo.png" alt="Flowbite qwik logo" width="215" height="195" class="h-8 w-auto" />\n <span class="self-center whitespace-nowrap text-xl font-semibold dark:text-white">Flowbite Qwik</span>\n </Navbar.Brand>\n <div class="flex items-center md:order-2">\n <Dropdown\n as={\n <img\n class="h-8 w-8 rounded-full"\n src="https://res.cloudinary.com/dkht4mwqi/image/upload/f_auto,q_auto/v1718462568/flowbite-qwik/jpnykkz8ojq7ojgg4qta.jpg"\n alt="user photo"\n />\n }\n >\n <Dropdown.Item header>\n <span class="block text-sm">Bonnie Green</span>\n <span class="block truncate text-sm font-medium">[email protected]</span>\n </Dropdown.Item>\n <Dropdown.Item>Dashboard</Dropdown.Item>\n <Dropdown.Item>Settings</Dropdown.Item>\n <Dropdown.Item>Earnings</Dropdown.Item>\n <Dropdown.Item divider />\n <Dropdown.Item>Sign out</Dropdown.Item>\n </Dropdown>\n <Navbar.Toggle />\n </div>\n <Navbar.Collapse>\n <Navbar.Link href="/navbars" active>\n Home\n </Navbar.Link>\n <Navbar.Link href="/navbars">About</Navbar.Link>\n <Navbar.Link tag="div">\n <Dropdown label="Services" inline>\n <Dropdown.Item>Dashboard</Dropdown.Item>\n <Dropdown.Item>Settings</Dropdown.Item>\n <Dropdown.Item>Earnings</Dropdown.Item>\n </Dropdown>\n </Navbar.Link>\n <Navbar.Link href="/navbars">Pricing</Navbar.Link>\n <Navbar.Link href="/navbars">Contact</Navbar.Link>\n </Navbar.Collapse>\n </Navbar>\n )\n})',
height: '400',
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default component$(() => {
Home
</Navbar.Link>
<Navbar.Link href="/navbars">About</Navbar.Link>
<Navbar.Link href="/navbars" tag="div">
<Navbar.Link tag="div">
<Dropdown label="Services" inline>
<Dropdown.Item>Dashboard</Dropdown.Item>
<Dropdown.Item>Settings</Dropdown.Item>
Expand Down
4 changes: 2 additions & 2 deletions packages/lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "flowbite-qwik",
"version": "0.37.9",
"version": "0.37.10",
"description": "Official Qwik components built for Flowbite and Tailwind CSS",
"keywords": [
"design-system",
Expand All @@ -17,8 +17,8 @@
"license": "MIT",
"module": "./lib/flowbite.qwik.mjs",
"main": "./lib/flowbite.qwik.cjs",
"types": "./lib-types/index.d.ts",
"qwik": "./lib/flowbite.qwik.mjs",
"types": "./lib-types/index.d.ts",
"type": "module",
"style": "./lib/style.css",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/src/components/Navbar/NavbarLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const NavbarLink = component$<NavbarLinkProps>(({ active = false, tag: Co
const { themeName } = useFlowbiteThemable()

const handleClick = $(() => {
setIsOpen(false)
if (props.href) setIsOpen(false)
})

return (
Expand Down

0 comments on commit 0ce1222

Please sign in to comment.