diff --git a/src/components/ButtonLink.tsx b/src/components/ButtonLink.tsx
index 08c83b8..b9e5091 100644
--- a/src/components/ButtonLink.tsx
+++ b/src/components/ButtonLink.tsx
@@ -1,21 +1,23 @@
import Link from "next/link";
-import { ReactNode } from "react";
+import { CSSProperties, ReactNode } from "react";
export default function ButtonLink({
href = "#",
onClick,
children,
+ style = {},
}: {
href?: string;
onClick?: (...args: any) => any;
children: ReactNode;
+ style?: CSSProperties;
}) {
const handleClick = (event) => {
event.preventDefault();
onClick && onClick();
};
return (
-
+
{children}
);
diff --git a/src/components/Links/Links.tsx b/src/components/Links/Links.tsx
index e87365e..1466955 100644
--- a/src/components/Links/Links.tsx
+++ b/src/components/Links/Links.tsx
@@ -1,3 +1,4 @@
+import { motion } from "framer-motion";
import LinkTag from "next/link";
import { Category, Link } from "types";
@@ -6,15 +7,21 @@ import EditItem from "components/QuickActions/EditItem";
import RemoveItem from "components/QuickActions/RemoveItem";
import LinkItem from "./LinkItem";
-import { motion } from "framer-motion";
+import ButtonLink from "components/ButtonLink";
+import CreateItem from "components/QuickActions/CreateItem";
+import { RxHamburgerMenu } from "react-icons/rx";
import styles from "./links.module.scss";
export default function Links({
category,
toggleFavorite,
+ isMobile,
+ openMobileModal,
}: {
category: Category;
toggleFavorite: (linkId: Link["id"]) => void;
+ isMobile: boolean;
+ openMobileModal: () => void;
}) {
if (category === null) {
return (
@@ -29,13 +36,27 @@ export default function Links({
return (
-
+
+ {isMobile && (
+
+
+
+ )}
{name}
{links.length > 0 && (
— {links.length}
)}
+
diff --git a/src/components/Modal/modal.module.scss b/src/components/Modal/modal.module.scss
index cfa2310..e4909b8 100644
--- a/src/components/Modal/modal.module.scss
+++ b/src/components/Modal/modal.module.scss
@@ -49,3 +49,11 @@
align-items: center;
flex-direction: column;
}
+
+@media (max-width: 768px) {
+ .modal-container {
+ width: calc(100% - 2em);
+ min-width: unset;
+ margin-top: 1em;
+ }
+}
diff --git a/src/pages/index.tsx b/src/pages/index.tsx
index ad12794..444cfd6 100644
--- a/src/pages/index.tsx
+++ b/src/pages/index.tsx
@@ -3,20 +3,21 @@ import { useRouter } from "next/router";
import { useCallback, useMemo, useState } from "react";
import { useHotkeys } from "react-hotkeys-hook";
+import BlockWrapper from "components/BlockWrapper/BlockWrapper";
import Links from "components/Links/Links";
import Modal from "components/Modal/Modal";
import PageTransition from "components/PageTransition";
import SearchModal from "components/SearchModal/SearchModal";
+import Categories from "components/SideMenu/Categories/Categories";
import SideMenu from "components/SideMenu/SideMenu";
import * as Keys from "constants/keys";
import PATHS from "constants/paths";
-import useModal from "hooks/useModal";
-import { Category, Link, SearchItem } from "types";
-
import { useMediaQuery } from "hooks/useMediaQuery";
+import useModal from "hooks/useModal";
import getUserCategories from "lib/category/getUserCategories";
import getUser from "lib/user/getUser";
+import { Category, Link, SearchItem } from "types";
import { pushStateVanilla } from "utils/link";
import { getSession } from "utils/session";
@@ -104,15 +105,17 @@ function Home(props: HomePageProps) {
const handleSelectCategory = (category: Category) => {
setCategoryActive(category);
pushStateVanilla(`${PATHS.HOME}?categoryId=${category.id}`);
+ mobileModal.close();
};
+ const areHokeysEnabled = { enabled: !searchModal.isShowing };
useHotkeys(
Keys.OPEN_SEARCH_KEY,
(event) => {
event.preventDefault();
searchModal.open();
},
- { enabled: !searchModal.isShowing }
+ areHokeysEnabled
);
useHotkeys(Keys.CLOSE_SEARCH_KEY, searchModal.close, {
enabled: searchModal.isShowing,
@@ -124,40 +127,32 @@ function Home(props: HomePageProps) {
() => {
router.push(`${PATHS.LINK.CREATE}?categoryId=${categoryActive.id}`);
},
- {
- enabled: !searchModal.isShowing,
- }
+ areHokeysEnabled
);
useHotkeys(
Keys.OPEN_CREATE_CATEGORY_KEY,
() => {
router.push("/category/create");
},
- {
- enabled: !searchModal.isShowing,
- }
+ areHokeysEnabled
);
return (
{isMobile ? (
- <>
-
-
- {mobileModal.isShowing && (
-
-
+ {mobileModal.isShowing && (
+
+
+
-
- )}
-
- >
+
+
+ )}
+
) : (
)}
-
+
{searchModal.isShowing && (