diff --git a/components/InputSelect/styles.ts b/components/InputSelect/styles.ts index 2e2be2b..119b887 100644 --- a/components/InputSelect/styles.ts +++ b/components/InputSelect/styles.ts @@ -8,20 +8,27 @@ export const styles: StylesConfig = { ...styles, fontFamily: font, cursor: "pointer", - backgroundColor: state.isSelected ? "#0ea5e9" : "inherit", + backgroundColor: state.isSelected ? "oklch(var(--p))" : "inherit", "&:hover": { - backgroundColor: state.isSelected ? "#0ea5e9" : "#e2e8f0", + backgroundColor: state.isSelected + ? "oklch(var(--p))" + : "oklch(var(--nc))", }, transition: "all 50ms", }), - control: (styles) => ({ + control: (styles, state) => ({ ...styles, fontFamily: font, - border: "none", + borderRadius: "0.375rem", + border: state.isFocused + ? "1px solid oklch(var(--p))" + : "1px solid oklch(var(--nc))", + boxShadow: "none", + height: "2.6rem", }), - container: (styles) => ({ + container: (styles, state) => ({ ...styles, - border: "1px solid #e0f2fe", + height: "full", borderRadius: "0.375rem", lineHeight: "1.25rem", // "@media screen and (min-width: 1024px)": { diff --git a/components/Modal/Link/AddOrEditLink.tsx b/components/Modal/Link/AddOrEditLink.tsx index 5cfdfbc..7e8827a 100644 --- a/components/Modal/Link/AddOrEditLink.tsx +++ b/components/Modal/Link/AddOrEditLink.tsx @@ -156,6 +156,7 @@ export default function AddOrEditLink({ value={link.url} onChange={(e) => setLink({ ...link, url: e.target.value })} placeholder="e.g. http://example.com/" + className="bg-base-200" />
@@ -194,6 +195,7 @@ export default function AddOrEditLink({ value={link.name} onChange={(e) => setLink({ ...link, name: e.target.value })} placeholder="e.g. Example Link" + className="bg-base-200" />
diff --git a/components/Modals/New.tsx b/components/Modals/New.tsx new file mode 100644 index 0000000..b8b3d9c --- /dev/null +++ b/components/Modals/New.tsx @@ -0,0 +1,159 @@ +import { Tab } from "@headlessui/react"; +import React, { useEffect, useState } from "react"; +import TextInput from "../TextInput"; +import { LinkIncludingShortenedCollectionAndTags } from "@/types/global"; +import { useRouter } from "next/router"; +import useCollectionStore from "@/store/collections"; +import useLinkStore from "@/store/links"; +import { useSession } from "next-auth/react"; +import CollectionSelection from "../InputSelect/CollectionSelection"; + +export default function New() { + const { data } = useSession(); + + const [link, setLink] = useState({ + name: "", + url: "", + description: "", + tags: [], + screenshotPath: "", + pdfPath: "", + readabilityPath: "", + textContent: "", + collection: { + name: "", + ownerId: data?.user.id as number, + }, + }); + + const { updateLink, addLink } = useLinkStore(); + + const router = useRouter(); + const { collections } = useCollectionStore(); + + const setCollection = (e: any) => { + if (e?.__isNew__) e.value = null; + + setLink({ + ...link, + collection: { id: e?.value, name: e?.label, ownerId: e?.ownerId }, + }); + }; + + useEffect(() => { + if (router.query.id) { + const currentCollection = collections.find( + (e) => e.id == Number(router.query.id) + ); + + if ( + currentCollection && + currentCollection.ownerId && + router.asPath.startsWith("/collections/") + ) + setLink({ + ...link, + collection: { + id: currentCollection.id, + name: currentCollection.name, + ownerId: currentCollection.ownerId, + }, + }); + } else + setLink({ + ...link, + collection: { + // id: , + name: "Unorganized", + ownerId: data?.user.id as number, + }, + }); + }, []); + + return ( + +
+
+ +
+ + + + + `${ + selected ? "btn-primary" : "btn-ghost" + } outline-none rounded-md btn btn-sm` + } + > + Link + + {/* + `${ + selected ? "btn-primary" : "btn-ghost" + } outline-none rounded-md btn btn-sm` + } + > + File + */} + + `${ + selected ? "btn-primary" : "btn-ghost" + } outline-none rounded-md btn btn-sm` + } + > + Collection + + + + +
+
+

Address (URL)

+ setLink({ ...link, url: e.target.value })} + placeholder="e.g. http://example.com/" + className="bg-base-200" + /> +
+
+

Collection

+ {link.collection.name ? ( + + ) : null} +
+
+
+ {/* Content 2 */} + Content 3 +
+
+
+
+ +
+
+ ); +} diff --git a/components/Navbar.tsx b/components/Navbar.tsx index 5eed5aa..d2c1984 100644 --- a/components/Navbar.tsx +++ b/components/Navbar.tsx @@ -13,6 +13,7 @@ import useModalStore from "@/store/modals"; import useWindowDimensions from "@/hooks/useWindowDimensions"; import ToggleDarkMode from "./ToggleDarkMode"; import useLocalSettingsStore from "@/store/localSettings"; +import New from "./Modals/New"; export default function Navbar() { const { setModal } = useModalStore(); @@ -61,7 +62,7 @@ export default function Navbar() {
- */} + +
@@ -138,6 +154,7 @@ export default function Navbar() { ) : null}
+ ); } diff --git a/styles/globals.css b/styles/globals.css index eb8c364..3ba0edb 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -157,24 +157,16 @@ body { @layer components { .react-select-container .react-select__control { - @apply bg-base-200 dark:hover:border-neutral-500 border-red-500 border; + @apply bg-base-200 hover:border-neutral-content; } .react-select-container .react-select__menu { - @apply dark:bg-neutral-900 dark:border-neutral-700 border; - } - - .react-select-container .react-select__menu { - @apply dark:bg-neutral-900 border; - } - - .react-select-container .react-select__option { - @apply dark:hover:bg-neutral-800; + @apply bg-base-100 border-neutral-content border absolute; } .react-select-container .react-select__input-container, .react-select-container .react-select__single-value { - @apply dark:text-white; + @apply text-base-content; } } .react-select__clear-indicator * {