@greghowe79/the-lib 2.6.8 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@ const qwik = require("@builder.io/qwik");
5
5
  const qwikCity = require("@builder.io/qwik-city");
6
6
  const styles = require("./styles.css.qwik.cjs");
7
7
  const button = require("../button/button.qwik.cjs");
8
- const NavigationMenu = qwik.component$(({ ariaLabel, logoComponent, listItems, actions, locale, isLoading }) => {
8
+ const NavigationMenu = qwik.component$(({ ariaLabel, logoComponent, listItems, actions, locale, isLoading, logoReload }) => {
9
9
  const location = qwikCity.useLocation();
10
10
  const isOpen = qwik.useSignal(false);
11
11
  qwik.useStyles$(styles);
@@ -16,6 +16,10 @@ const NavigationMenu = qwik.component$(({ ariaLabel, logoComponent, listItems, a
16
16
  menuList?.classList.remove("no-transition");
17
17
  }, 50);
18
18
  }));
19
+ qwik.useVisibleTask$(({ track }) => {
20
+ track(() => location.url.pathname);
21
+ isOpen.value = false;
22
+ });
19
23
  return /* @__PURE__ */ jsxRuntime.jsx("nav", {
20
24
  class: `menu ${isOpen.value ? "open" : ""}`,
21
25
  "aria-label": ariaLabel,
@@ -25,10 +29,13 @@ const NavigationMenu = qwik.component$(({ ariaLabel, logoComponent, listItems, a
25
29
  /* @__PURE__ */ jsxRuntime.jsxs("div", {
26
30
  class: "menu-left",
27
31
  children: [
28
- /* @__PURE__ */ jsxRuntime.jsx(qwikCity.Link, {
32
+ logoReload ? /* @__PURE__ */ jsxRuntime.jsx("a", {
33
+ href: `/${locale}`,
34
+ "aria-label": "Homepage",
35
+ children: logoComponent && logoComponent({}, null, 0)
36
+ }) : /* @__PURE__ */ jsxRuntime.jsx(qwikCity.Link, {
29
37
  href: `/${locale}`,
30
38
  "aria-label": "Homepage",
31
- onClick$: () => isOpen.value = false,
32
39
  children: logoComponent && logoComponent({}, null, 0)
33
40
  }),
34
41
  /* @__PURE__ */ jsxRuntime.jsxs("button", {
@@ -58,7 +65,15 @@ const NavigationMenu = qwik.component$(({ ariaLabel, logoComponent, listItems, a
58
65
  target: item.target,
59
66
  rel: item.rel,
60
67
  class: "menu-link",
61
- onClick$: () => isOpen.value = false,
68
+ children: item.label
69
+ })
70
+ }, item.label);
71
+ }
72
+ if (item.reload === true) {
73
+ return /* @__PURE__ */ jsxRuntime.jsx("li", {
74
+ children: /* @__PURE__ */ jsxRuntime.jsx("a", {
75
+ href: item.href,
76
+ class: location.url.pathname === item.href ? "active" : "menu-link",
62
77
  children: item.label
63
78
  })
64
79
  }, item.label);
@@ -67,7 +82,6 @@ const NavigationMenu = qwik.component$(({ ariaLabel, logoComponent, listItems, a
67
82
  children: /* @__PURE__ */ jsxRuntime.jsx(qwikCity.Link, {
68
83
  href: item.href,
69
84
  class: location.url.pathname === item.href ? "active" : "menu-link",
70
- onClick$: () => isOpen.value = false,
71
85
  children: item.label
72
86
  })
73
87
  }, item.label);
@@ -79,8 +93,11 @@ const NavigationMenu = qwik.component$(({ ariaLabel, logoComponent, listItems, a
79
93
  return /* @__PURE__ */ jsxRuntime.jsx(button.Button, {
80
94
  id,
81
95
  label: label ?? "",
96
+ // onClick$={() => {
97
+ // isOpen.value = false;
98
+ // onClick$?.();
99
+ // }}
82
100
  onClick$: () => {
83
- isOpen.value = false;
84
101
  onClick$?.();
85
102
  },
86
103
  icon,
@@ -1,9 +1,9 @@
1
1
  import { jsx, jsxs } from "@builder.io/qwik/jsx-runtime";
2
- import { component$, useSignal, useStyles$, useOnWindow, $ } from "@builder.io/qwik";
2
+ import { component$, useSignal, useStyles$, useOnWindow, $, useVisibleTask$ } from "@builder.io/qwik";
3
3
  import { useLocation, Link } from "@builder.io/qwik-city";
4
4
  import styles from "./styles.css.qwik.mjs";
5
5
  import { Button } from "../button/button.qwik.mjs";
6
- const NavigationMenu = component$(({ ariaLabel, logoComponent, listItems, actions, locale, isLoading }) => {
6
+ const NavigationMenu = component$(({ ariaLabel, logoComponent, listItems, actions, locale, isLoading, logoReload }) => {
7
7
  const location = useLocation();
8
8
  const isOpen = useSignal(false);
9
9
  useStyles$(styles);
@@ -14,6 +14,10 @@ const NavigationMenu = component$(({ ariaLabel, logoComponent, listItems, action
14
14
  menuList?.classList.remove("no-transition");
15
15
  }, 50);
16
16
  }));
17
+ useVisibleTask$(({ track }) => {
18
+ track(() => location.url.pathname);
19
+ isOpen.value = false;
20
+ });
17
21
  return /* @__PURE__ */ jsx("nav", {
18
22
  class: `menu ${isOpen.value ? "open" : ""}`,
19
23
  "aria-label": ariaLabel,
@@ -23,10 +27,13 @@ const NavigationMenu = component$(({ ariaLabel, logoComponent, listItems, action
23
27
  /* @__PURE__ */ jsxs("div", {
24
28
  class: "menu-left",
25
29
  children: [
26
- /* @__PURE__ */ jsx(Link, {
30
+ logoReload ? /* @__PURE__ */ jsx("a", {
31
+ href: `/${locale}`,
32
+ "aria-label": "Homepage",
33
+ children: logoComponent && logoComponent({}, null, 0)
34
+ }) : /* @__PURE__ */ jsx(Link, {
27
35
  href: `/${locale}`,
28
36
  "aria-label": "Homepage",
29
- onClick$: () => isOpen.value = false,
30
37
  children: logoComponent && logoComponent({}, null, 0)
31
38
  }),
32
39
  /* @__PURE__ */ jsxs("button", {
@@ -56,7 +63,15 @@ const NavigationMenu = component$(({ ariaLabel, logoComponent, listItems, action
56
63
  target: item.target,
57
64
  rel: item.rel,
58
65
  class: "menu-link",
59
- onClick$: () => isOpen.value = false,
66
+ children: item.label
67
+ })
68
+ }, item.label);
69
+ }
70
+ if (item.reload === true) {
71
+ return /* @__PURE__ */ jsx("li", {
72
+ children: /* @__PURE__ */ jsx("a", {
73
+ href: item.href,
74
+ class: location.url.pathname === item.href ? "active" : "menu-link",
60
75
  children: item.label
61
76
  })
62
77
  }, item.label);
@@ -65,7 +80,6 @@ const NavigationMenu = component$(({ ariaLabel, logoComponent, listItems, action
65
80
  children: /* @__PURE__ */ jsx(Link, {
66
81
  href: item.href,
67
82
  class: location.url.pathname === item.href ? "active" : "menu-link",
68
- onClick$: () => isOpen.value = false,
69
83
  children: item.label
70
84
  })
71
85
  }, item.label);
@@ -77,8 +91,11 @@ const NavigationMenu = component$(({ ariaLabel, logoComponent, listItems, action
77
91
  return /* @__PURE__ */ jsx(Button, {
78
92
  id,
79
93
  label: label ?? "",
94
+ // onClick$={() => {
95
+ // isOpen.value = false;
96
+ // onClick$?.();
97
+ // }}
80
98
  onClick$: () => {
81
- isOpen.value = false;
82
99
  onClick$?.();
83
100
  },
84
101
  icon,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greghowe79/the-lib",
3
- "version": "2.6.8",
3
+ "version": "2.7.0",
4
4
  "description": "Collection of fast components for Qwik",
5
5
  "main": "./lib/index.qwik.mjs",
6
6
  "qwik": "./lib/index.qwik.mjs",