@greghowe79/the-lib 0.2.2 → 0.2.4

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.
@@ -2,11 +2,12 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
4
4
  const qwik = require("@builder.io/qwik");
5
- const NavLink = require("./NavLink.qwik.cjs");
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
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",
@@ -17,7 +18,7 @@ const NavigationMenu = qwik.component$(({ ariaLabel, logoComponent, listItems, a
17
18
  /* @__PURE__ */ jsxRuntime.jsxs("div", {
18
19
  class: "menu-left",
19
20
  children: [
20
- /* @__PURE__ */ jsxRuntime.jsx(NavLink.NavLink, {
21
+ /* @__PURE__ */ jsxRuntime.jsx(qwikCity.Link, {
21
22
  href: "/",
22
23
  "aria-label": "Homepage",
23
24
  children: logoComponent && logoComponent({}, null, 0)
@@ -26,10 +27,9 @@ const NavigationMenu = qwik.component$(({ ariaLabel, logoComponent, listItems, a
26
27
  class: "menu-list",
27
28
  children: listItems?.map((item) => {
28
29
  return /* @__PURE__ */ jsxRuntime.jsx("li", {
29
- children: /* @__PURE__ */ jsxRuntime.jsx(NavLink.NavLink, {
30
+ children: /* @__PURE__ */ jsxRuntime.jsx(qwikCity.Link, {
30
31
  href: item.href,
31
- class: "menu-link",
32
- activeClass: "active-link",
32
+ class: `${location.url.pathname === item.href ? "active" : "menu-link"}`,
33
33
  children: item.label
34
34
  })
35
35
  }, item.label);
@@ -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 { NavLink } from "./NavLink.qwik.mjs";
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",
@@ -15,7 +16,7 @@ const NavigationMenu = component$(({ ariaLabel, logoComponent, listItems, action
15
16
  /* @__PURE__ */ jsxs("div", {
16
17
  class: "menu-left",
17
18
  children: [
18
- /* @__PURE__ */ jsx(NavLink, {
19
+ /* @__PURE__ */ jsx(Link, {
19
20
  href: "/",
20
21
  "aria-label": "Homepage",
21
22
  children: logoComponent && logoComponent({}, null, 0)
@@ -24,10 +25,9 @@ const NavigationMenu = component$(({ ariaLabel, logoComponent, listItems, action
24
25
  class: "menu-list",
25
26
  children: listItems?.map((item) => {
26
27
  return /* @__PURE__ */ jsx("li", {
27
- children: /* @__PURE__ */ jsx(NavLink, {
28
+ children: /* @__PURE__ */ jsx(Link, {
28
29
  href: item.href,
29
- class: "menu-link",
30
- activeClass: "active-link",
30
+ class: `${location.url.pathname === item.href ? "active" : "menu-link"}`,
31
31
  children: item.label
32
32
  })
33
33
  }, item.label);
@@ -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\r\n.active-link {\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.active {\r\n background-color: #f0f0f0;\r\n color: #333;\r\n}\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\r\n.active-link {\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.active {\r\n background-color: #f0f0f0;\r\n color: #333;\r\n}\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.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Collection of fast components for Qwik",
5
5
  "main": "./lib/index.qwik.mjs",
6
6
  "qwik": "./lib/index.qwik.mjs",
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
4
- const qwik = require("@builder.io/qwik");
5
- const qwikCity = require("@builder.io/qwik-city");
6
- const NavLink = qwik.component$(({ activeClass, ...props }) => {
7
- const location = qwikCity.useLocation();
8
- const toPathname = props.href ?? "";
9
- const locationPathname = location.url.pathname;
10
- const startSlashPosition = toPathname !== "/" && toPathname.startsWith("/") ? toPathname.length - 1 : toPathname.length;
11
- const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
12
- const isActive = locationPathname === toPathname || locationPathname.endsWith(toPathname) && (locationPathname.charAt(endSlashPosition) === "/" || locationPathname.charAt(startSlashPosition) === "/");
13
- return /* @__PURE__ */ jsxRuntime.jsx(qwikCity.Link, {
14
- ...props,
15
- class: [
16
- props.class,
17
- isActive && activeClass ? activeClass : ""
18
- ],
19
- children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
20
- });
21
- });
22
- exports.NavLink = NavLink;
@@ -1,22 +0,0 @@
1
- import { jsx } from "@builder.io/qwik/jsx-runtime";
2
- import { component$, Slot } from "@builder.io/qwik";
3
- import { useLocation, Link } from "@builder.io/qwik-city";
4
- const NavLink = component$(({ activeClass, ...props }) => {
5
- const location = useLocation();
6
- const toPathname = props.href ?? "";
7
- const locationPathname = location.url.pathname;
8
- const startSlashPosition = toPathname !== "/" && toPathname.startsWith("/") ? toPathname.length - 1 : toPathname.length;
9
- const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
10
- const isActive = locationPathname === toPathname || locationPathname.endsWith(toPathname) && (locationPathname.charAt(endSlashPosition) === "/" || locationPathname.charAt(startSlashPosition) === "/");
11
- return /* @__PURE__ */ jsx(Link, {
12
- ...props,
13
- class: [
14
- props.class,
15
- isActive && activeClass ? activeClass : ""
16
- ],
17
- children: /* @__PURE__ */ jsx(Slot, {})
18
- });
19
- });
20
- export {
21
- NavLink
22
- };