@greghowe79/the-lib 0.1.8 → 0.2.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.
@@ -7,6 +7,7 @@ const styles = require("./styles.css.qwik.cjs");
7
7
  const button = require("../button/button.qwik.cjs");
8
8
  require("@fontsource/roboto-condensed/500.css");
9
9
  const NavigationMenu = qwik.component$(({ ariaLabel, logoComponent, listItems, actions }) => {
10
+ const location = qwikCity.useLocation();
10
11
  qwik.useStyles$(styles);
11
12
  return /* @__PURE__ */ jsxRuntime.jsx("nav", {
12
13
  class: "menu",
@@ -25,10 +26,12 @@ const NavigationMenu = qwik.component$(({ ariaLabel, logoComponent, listItems, a
25
26
  /* @__PURE__ */ jsxRuntime.jsx("ul", {
26
27
  class: "menu-list",
27
28
  children: listItems?.map((item) => {
29
+ const isActive = location.url.pathname === item.href;
28
30
  return /* @__PURE__ */ jsxRuntime.jsx("li", {
29
31
  children: /* @__PURE__ */ jsxRuntime.jsx(qwikCity.Link, {
30
32
  href: item.href,
31
33
  class: "menu-link",
34
+ "aria-current": isActive ? "page" : void 0,
32
35
  children: item.label
33
36
  })
34
37
  }, item.label);
@@ -41,7 +44,8 @@ const NavigationMenu = qwik.component$(({ ariaLabel, logoComponent, listItems, a
41
44
  children: actions?.map((action) => {
42
45
  return /* @__PURE__ */ jsxRuntime.jsx(button.Button, {
43
46
  id: action.id,
44
- label: action.label
47
+ label: action.label,
48
+ onClick$: action.onClick$
45
49
  }, action.id);
46
50
  })
47
51
  })
@@ -1,10 +1,11 @@
1
1
  import { jsx, jsxs } from "@builder.io/qwik/jsx-runtime";
2
2
  import { component$, useStyles$ } from "@builder.io/qwik";
3
- import { Link } from "@builder.io/qwik-city";
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
6
  import "@fontsource/roboto-condensed/500.css";
7
7
  const NavigationMenu = component$(({ ariaLabel, logoComponent, listItems, actions }) => {
8
+ const location = useLocation();
8
9
  useStyles$(styles);
9
10
  return /* @__PURE__ */ jsx("nav", {
10
11
  class: "menu",
@@ -23,10 +24,12 @@ const NavigationMenu = component$(({ ariaLabel, logoComponent, listItems, action
23
24
  /* @__PURE__ */ jsx("ul", {
24
25
  class: "menu-list",
25
26
  children: listItems?.map((item) => {
27
+ const isActive = location.url.pathname === item.href;
26
28
  return /* @__PURE__ */ jsx("li", {
27
29
  children: /* @__PURE__ */ jsx(Link, {
28
30
  href: item.href,
29
31
  class: "menu-link",
32
+ "aria-current": isActive ? "page" : void 0,
30
33
  children: item.label
31
34
  })
32
35
  }, item.label);
@@ -39,7 +42,8 @@ const NavigationMenu = component$(({ ariaLabel, logoComponent, listItems, action
39
42
  children: actions?.map((action) => {
40
43
  return /* @__PURE__ */ jsx(Button, {
41
44
  id: action.id,
42
- label: action.label
45
+ label: action.label,
46
+ onClick$: action.onClick$
43
47
  }, action.id);
44
48
  })
45
49
  })
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
- const styles = ".menu {\r\n background-color: #fff;\r\n padding: 1rem;\r\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);\r\n}\r\n.menu-container {\r\n max-width: 75rem;\r\n margin: 0 auto;\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n}\r\n.menu-left {\r\n display: flex;\r\n align-items: center;\r\n gap: 2rem;\r\n}\r\n.menu-list {\r\n display: flex;\r\n list-style: none;\r\n gap: 1.5rem;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n\r\n.menu-link {\r\n display: inline-block;\r\n padding: 0.5rem 1rem;\r\n color: #333;\r\n text-decoration: none;\r\n border-radius: 4px;\r\n font-family: 'Roboto Condensed', sans-serif;\r\n transition:\r\n background-color 0.2s,\r\n color 0.2s;\r\n}\r\n\r\n.menu-link:hover {\r\n background-color: #f0f0f0;\r\n color: #333;\r\n}\r\n.menu-right {\r\n display: flex;\r\n gap: 0.75rem;\r\n}\r\n";
2
+ const styles = ".menu {\r\n background-color: #fff;\r\n padding: 1rem;\r\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);\r\n}\r\n.menu-container {\r\n max-width: 75rem;\r\n margin: 0 auto;\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n}\r\n.menu-left {\r\n display: flex;\r\n align-items: center;\r\n gap: 2rem;\r\n}\r\n.menu-list {\r\n display: flex;\r\n list-style: none;\r\n gap: 1.5rem;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n\r\n.menu-link {\r\n display: inline-block;\r\n padding: 0.5rem 1rem;\r\n color: #333;\r\n text-decoration: none;\r\n border-radius: 4px;\r\n font-family: 'Roboto Condensed', sans-serif;\r\n transition:\r\n background-color 0.2s,\r\n color 0.2s;\r\n}\r\n\r\n.menu-link:hover,\r\n.menu-link[aria-current='page'] {\r\n background-color: #f0f0f0;\r\n color: #333;\r\n}\r\n.menu-right {\r\n display: flex;\r\n gap: 0.75rem;\r\n}\r\n";
3
3
  module.exports = styles;
@@ -1,4 +1,4 @@
1
- const styles = ".menu {\r\n background-color: #fff;\r\n padding: 1rem;\r\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);\r\n}\r\n.menu-container {\r\n max-width: 75rem;\r\n margin: 0 auto;\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n}\r\n.menu-left {\r\n display: flex;\r\n align-items: center;\r\n gap: 2rem;\r\n}\r\n.menu-list {\r\n display: flex;\r\n list-style: none;\r\n gap: 1.5rem;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n\r\n.menu-link {\r\n display: inline-block;\r\n padding: 0.5rem 1rem;\r\n color: #333;\r\n text-decoration: none;\r\n border-radius: 4px;\r\n font-family: 'Roboto Condensed', sans-serif;\r\n transition:\r\n background-color 0.2s,\r\n color 0.2s;\r\n}\r\n\r\n.menu-link:hover {\r\n background-color: #f0f0f0;\r\n color: #333;\r\n}\r\n.menu-right {\r\n display: flex;\r\n gap: 0.75rem;\r\n}\r\n";
1
+ const styles = ".menu {\r\n background-color: #fff;\r\n padding: 1rem;\r\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);\r\n}\r\n.menu-container {\r\n max-width: 75rem;\r\n margin: 0 auto;\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n}\r\n.menu-left {\r\n display: flex;\r\n align-items: center;\r\n gap: 2rem;\r\n}\r\n.menu-list {\r\n display: flex;\r\n list-style: none;\r\n gap: 1.5rem;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n\r\n.menu-link {\r\n display: inline-block;\r\n padding: 0.5rem 1rem;\r\n color: #333;\r\n text-decoration: none;\r\n border-radius: 4px;\r\n font-family: 'Roboto Condensed', sans-serif;\r\n transition:\r\n background-color 0.2s,\r\n color 0.2s;\r\n}\r\n\r\n.menu-link:hover,\r\n.menu-link[aria-current='page'] {\r\n background-color: #f0f0f0;\r\n color: #333;\r\n}\r\n.menu-right {\r\n display: flex;\r\n gap: 0.75rem;\r\n}\r\n";
2
2
  export {
3
3
  styles as default
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greghowe79/the-lib",
3
- "version": "0.1.8",
3
+ "version": "0.2.0",
4
4
  "description": "Collection of fast components for Qwik",
5
5
  "main": "./lib/index.qwik.mjs",
6
6
  "qwik": "./lib/index.qwik.mjs",