mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-09-16 19:45:33 -04:00
re-add next-remote-watch as local dev server
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
import { memo } from "react";
|
import { memo } from "react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import MenuLink from "../MenuLink/MenuLink";
|
import MenuItem from "../MenuItem/MenuItem";
|
||||||
import { menuLinks } from "../../lib/config/menu";
|
import { menuItems } from "../../lib/config/menu";
|
||||||
|
|
||||||
import styles from "./Menu.module.css";
|
import styles from "./Menu.module.css";
|
||||||
|
|
||||||
@@ -15,10 +15,10 @@ const Menu = ({ className }: MenuProps) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<ul className={classNames(styles.menu, className)}>
|
<ul className={classNames(styles.menu, className)}>
|
||||||
{menuLinks.map((link, index) => (
|
{menuItems.map((item, index) => (
|
||||||
<li key={index} className={styles.item}>
|
<li key={index} className={styles.item}>
|
||||||
{/* kinda weird/hacky way to determine if the *first part* of the current path matches this href */}
|
{/* kinda weird/hacky way to determine if the *first part* of the current path matches this href */}
|
||||||
<MenuLink {...link} current={link.href === `/${router.pathname.split("/")[1]}`} />
|
<MenuItem {...item} current={item.href === `/${router.pathname.split("/")[1]}`} />
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
|
|
||||||
import styles from "./MenuLink.module.css";
|
import styles from "./MenuItem.module.css";
|
||||||
|
|
||||||
export type MenuLinkProps = {
|
export type MenuItemProps = {
|
||||||
href?: string;
|
href?: string;
|
||||||
text?: string;
|
text?: string;
|
||||||
current?: boolean;
|
current?: boolean;
|
||||||
@@ -14,19 +14,23 @@ export type MenuLinkProps = {
|
|||||||
icon: any;
|
icon: any;
|
||||||
};
|
};
|
||||||
|
|
||||||
const MenuLink = ({ icon: Icon, href, text, current, className }: MenuLinkProps) => {
|
const MenuItem = ({ icon: Icon, href, text, current, className }: MenuItemProps) => {
|
||||||
|
const linkContent = (
|
||||||
|
<>
|
||||||
|
<Icon className={classNames(styles.icon, className)} /> {text && <span className={styles.label}>{text}</span>}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
// allow both navigational links and/or other interactive react components (e.g. the theme toggle)
|
// allow both navigational links and/or other interactive react components (e.g. the theme toggle)
|
||||||
if (href) {
|
if (href) {
|
||||||
return (
|
return (
|
||||||
<Link href={href} prefetch={false}>
|
<Link href={href} prefetch={false}>
|
||||||
<a className={classNames(styles.link, current && styles.current, className)}>
|
<a className={classNames(styles.link, current && styles.current, className)}>{linkContent}</a>
|
||||||
<Icon className={styles.icon} /> <span className={styles.label}>{text}</span>
|
|
||||||
</a>
|
|
||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return <Icon className={classNames(styles.icon, className)} />;
|
return linkContent;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default MenuLink;
|
export default MenuItem;
|
@@ -1,8 +1,8 @@
|
|||||||
import ThemeToggle from "../../components/ThemeToggle/ThemeToggle";
|
import ThemeToggle from "../../components/ThemeToggle/ThemeToggle";
|
||||||
import { HomeIcon, NotesIcon, ProjectsIcon, ContactIcon } from "../../components/Icons";
|
import { HomeIcon, NotesIcon, ProjectsIcon, ContactIcon } from "../../components/Icons";
|
||||||
import type { MenuLinkProps } from "../../components/MenuLink/MenuLink";
|
import type { MenuItemProps } from "../../components/MenuItem/MenuItem";
|
||||||
|
|
||||||
export const menuLinks: MenuLinkProps[] = [
|
export const menuItems: MenuItemProps[] = [
|
||||||
{
|
{
|
||||||
icon: HomeIcon,
|
icon: HomeIcon,
|
||||||
text: "Home",
|
text: "Home",
|
||||||
|
11
package.json
11
package.json
@@ -14,11 +14,11 @@
|
|||||||
"url": "https://github.com/jakejarvis/jarv.is.git"
|
"url": "https://github.com/jakejarvis/jarv.is.git"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "cross-env NODE_OPTIONS='--inspect' next dev",
|
"dev": "cross-env NODE_OPTIONS='--inspect' next-remote-watch ./notes",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"analyze": "cross-env ANALYZE=true next build",
|
"analyze": "cross-env ANALYZE=true next build",
|
||||||
"lint": "run-s lint:*",
|
"lint": "run-s lint:*",
|
||||||
"lint:next": "eslint .",
|
"lint:js": "eslint .",
|
||||||
"lint:css": "stylelint '**/*.css'",
|
"lint:css": "stylelint '**/*.css'",
|
||||||
"lint:prettier": "prettier --check ."
|
"lint:prettier": "prettier --check ."
|
||||||
},
|
},
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
"@fontsource/roboto-mono": "4.5.3",
|
"@fontsource/roboto-mono": "4.5.3",
|
||||||
"@giscus/react": "^1.1.2",
|
"@giscus/react": "^1.1.2",
|
||||||
"@hcaptcha/react-hcaptcha": "^1.1.0",
|
"@hcaptcha/react-hcaptcha": "^1.1.0",
|
||||||
"@next/bundle-analyzer": "12.0.11-canary.17",
|
"@next/bundle-analyzer": "12.0.11-canary.18",
|
||||||
"@novnc/novnc": "github:novnc/noVNC#679b45fa3b453c7cf32f4b4455f4814818ecf161",
|
"@novnc/novnc": "github:novnc/noVNC#679b45fa3b453c7cf32f4b4455f4814818ecf161",
|
||||||
"@octokit/graphql": "^4.8.0",
|
"@octokit/graphql": "^4.8.0",
|
||||||
"@primer/octicons": "^16.3.1",
|
"@primer/octicons": "^16.3.1",
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
"is-absolute-url": "^4.0.1",
|
"is-absolute-url": "^4.0.1",
|
||||||
"markdown-to-jsx": "^7.1.6",
|
"markdown-to-jsx": "^7.1.6",
|
||||||
"modern-normalize": "^1.1.0",
|
"modern-normalize": "^1.1.0",
|
||||||
"next": "12.0.11-canary.17",
|
"next": "12.0.11-canary.18",
|
||||||
"next-compose-plugins": "^2.2.1",
|
"next-compose-plugins": "^2.2.1",
|
||||||
"next-mdx-remote": "4.0.0-rc.2",
|
"next-mdx-remote": "4.0.0-rc.2",
|
||||||
"next-seo": "^5.1.0",
|
"next-seo": "^5.1.0",
|
||||||
@@ -93,12 +93,13 @@
|
|||||||
"@typescript-eslint/parser": "^5.12.0",
|
"@typescript-eslint/parser": "^5.12.0",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"eslint": "~8.9.0",
|
"eslint": "~8.9.0",
|
||||||
"eslint-config-next": "12.0.11-canary.17",
|
"eslint-config-next": "12.0.11-canary.18",
|
||||||
"eslint-config-prettier": "~8.3.0",
|
"eslint-config-prettier": "~8.3.0",
|
||||||
"eslint-plugin-import": "~2.25.4",
|
"eslint-plugin-import": "~2.25.4",
|
||||||
"eslint-plugin-mdx": "~1.16.0",
|
"eslint-plugin-mdx": "~1.16.0",
|
||||||
"eslint-plugin-prettier": "~4.0.0",
|
"eslint-plugin-prettier": "~4.0.0",
|
||||||
"lint-staged": "^12.3.4",
|
"lint-staged": "^12.3.4",
|
||||||
|
"next-remote-watch": "^1.0.0",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"prettier": "^2.5.1",
|
"prettier": "^2.5.1",
|
||||||
"simple-git-hooks": "^2.7.0",
|
"simple-git-hooks": "^2.7.0",
|
||||||
|
Reference in New Issue
Block a user