diff --git a/src/components/Label/Label.css b/src/components/Label/Label.css
deleted file mode 100644
index f52ed4a3..00000000
--- a/src/components/Label/Label.css
+++ /dev/null
@@ -1,6 +0,0 @@
-.label {
- white-space: nowrap;
- display: inline-block;
- margin: 2px;
- color: #eee;
-}
diff --git a/src/components/Label/Label.tsx b/src/components/Label/Label.tsx
index 9d66b372..b9cd380c 100644
--- a/src/components/Label/Label.tsx
+++ b/src/components/Label/Label.tsx
@@ -1,17 +1,16 @@
+import { type ReactNode, useMemo } from "react";
import { twMerge } from "tailwind-merge";
import { contrast, hslColorToCss, hslToHex } from "./color-utils";
-import "./Label.css";
-import { useMemo } from "react";
export function Label({
label,
- icon = "",
+ endSlot,
className = "",
variant = "filled",
showTooltip = false,
}: {
label: string;
- icon?: string;
+ endSlot?: ReactNode;
className?: string;
variant?: "filled" | "outlined";
showTooltip?: boolean;
@@ -22,29 +21,34 @@ export function Label({
const style = useMemo(
() => ({
- backgroundColor: variant === "filled" ? mainColor.hex : hslColorToCss(dimmedMainColor.hsl),
- color: variant === "filled" ? contrastMainColor : mainColor.hex,
+ "--dark-bg-color": hslColorToCss(variant === "filled" ? mainColor.hsl : dimmedMainColor.dark),
+ "--light-bg-color": hslColorToCss(variant === "filled" ? mainColor.hsl : dimmedMainColor.light),
+ "--dark-text-color": variant === "filled" ? contrastMainColor : mainColor.hex,
+ "--light-text-color": variant === "filled" ? contrastMainColor : "#000000",
border: variant === "filled" ? "1px solid transparent" : `1px solid ${mainColor.hex}`,
}),
- [dimmedMainColor, contrastMainColor, variant, mainColor],
+ [contrastMainColor, variant, mainColor, dimmedMainColor],
);
return (
- {icon} {label}
+ {label}
+ {endSlot}
);
}
function dimColor(mainColor: { hsl: [number, number, number] }) {
- const newDimmedSaturation = mainColor.hsl[1] * 0.75;
- const newDimmedLightness = mainColor.hsl[2] / 5;
- const newHsl = [mainColor.hsl[0], newDimmedSaturation, newDimmedLightness] as [number, number, number];
- return { hsl: newHsl };
+ const darkColor = [mainColor.hsl[0], mainColor.hsl[1] * 0.75, mainColor.hsl[2] / 5] as [number, number, number];
+ const lightColor = [mainColor.hsl[0], 80, 90] as [number, number, number];
+ return { dark: darkColor, light: lightColor };
}
function bestTextColor(bgHex: string) {
diff --git a/src/components/NoteManager/NoteManager.css b/src/components/NoteManager/NoteManager.css
index f9c51c89..4c3a15d8 100644
--- a/src/components/NoteManager/NoteManager.css
+++ b/src/components/NoteManager/NoteManager.css
@@ -24,19 +24,6 @@
}
-.note-manager .new-note button {
- width: 100%;
-}
-
-.note-manager textarea,
-.note-manager input {
- padding: 1rem;
- resize: vertical;
- width: 100%;
- box-sizing: border-box;
- border-radius: 6px;
-}
-
.note-manager .validation-message {
padding-bottom: 10px;
color: #f22;
diff --git a/src/components/NoteManager/NoteManager.tsx b/src/components/NoteManager/NoteManager.tsx
index e60599cc..fb95a95f 100644
--- a/src/components/NoteManager/NoteManager.tsx
+++ b/src/components/NoteManager/NoteManager.tsx
@@ -1,5 +1,6 @@
import { memo, useCallback, useContext, useEffect, useState } from "react";
import "./NoteManager.css";
+import { Button, Textarea } from "@fluffylabs/shared-ui";
import { twMerge } from "tailwind-merge";
import { validateMath } from "../../utils/validateMath";
import { type ILocationContext, LocationContext } from "../LocationProvider/LocationProvider";
@@ -75,8 +76,8 @@ function Notes() {
return (
-
) => {
- setNoteDirty({ ...noteDirty, content: ev.currentTarget.value });
- },
- [noteDirty],
- );
+ const handleNoteLabelsChange = useCallback((labels: string[]) => {
+ setNoteDirty((prevNoteDirty) => ({ ...prevNoteDirty, labels }));
+ }, []);
+
+ const handleNoteContentChange = useCallback((ev: ChangeEvent) => {
+ setNoteDirty((prev) => ({ ...prev, content: ev.currentTarget.value }));
+ }, []);
const handleDeleteClick = useCallback(() => {
onDeleteNote(note);
@@ -128,6 +128,7 @@ export function Note({ note, active = false, onEditNote, onDeleteNote }: NotePro
isEditing,
noteDirty,
handleNoteContentChange,
+ handleNoteLabelsChange,
}),
[
note,
@@ -139,6 +140,7 @@ export function Note({ note, active = false, onEditNote, onDeleteNote }: NotePro
isEditing,
noteDirty,
handleNoteContentChange,
+ handleNoteLabelsChange,
],
);
@@ -166,20 +168,11 @@ export function Note({ note, active = false, onEditNote, onDeleteNote }: NotePro
{active && !isEditing && (
<>
-
+
{isEditable && (
-
+
)}
>
@@ -188,9 +181,9 @@ export function Note({ note, active = false, onEditNote, onDeleteNote }: NotePro
<>
<>
-
{noteContentError ? {noteContentError}
: null}
+