From 6876f36e84b507b2b8cc0a7dc4b3f4a4965fe04f Mon Sep 17 00:00:00 2001
From: Nika Kolesnikova
Date: Tue, 1 Oct 2024 16:19:39 -0400
Subject: [PATCH 1/7] feat: implement custom useImportance hook that manages
and sorts important lists
---
src/utils/hooks.js | 65 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 65 insertions(+)
diff --git a/src/utils/hooks.js b/src/utils/hooks.js
index 92a06ca..54de800 100644
--- a/src/utils/hooks.js
+++ b/src/utils/hooks.js
@@ -19,3 +19,68 @@ export function useStateWithStorage(storageKey, initialValue) {
return [value, setValue];
}
+
+/**
+ * A custom hook that manages the importance of lists and sorts them accordingly.
+ * @param {Array
}
+ placement="left"
+ arrow
+ >
+
+ {isImportant ? (
+
+ ) : (
+
+ )}
+
+
From 74fd8a880e4012d4a604a653b4c3ffe67d7d026c Mon Sep 17 00:00:00 2001
From: Nika Kolesnikova
Date: Tue, 15 Oct 2024 10:43:07 -0400
Subject: [PATCH 7/7] feat: combine tooltipTitle and iconButtonAreaLabel into
importantStatusLabel; simplify MUI icons imports
---
src/components/SingleList.jsx | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/src/components/SingleList.jsx b/src/components/SingleList.jsx
index dc3cc48..b27d294 100644
--- a/src/components/SingleList.jsx
+++ b/src/components/SingleList.jsx
@@ -1,6 +1,5 @@
import { useState } from 'react';
-import PushPinIcon from '@mui/icons-material/PushPin';
-import PushPinOutlinedIcon from '@mui/icons-material/PushPinOutlined';
+import { PushPin, PushPinOutlined } from '@mui/icons-material';
import { Tooltip, IconButton } from '@mui/material';
import './SingleList.css';
@@ -27,9 +26,7 @@ export function SingleList({
marginBlockEnd: '0',
};
- const tooltipTitle = isImportant ? 'Pinned' : 'Not pinned';
-
- const iconButtonAreaLabel = isImportant ? 'Pin list' : 'Unpin list';
+ const importantStatusLabel = isImportant ? 'Unpin list' : 'Pin list';
return (
<>
@@ -39,19 +36,19 @@ export function SingleList({
onMouseLeave={() => setIsHovered(false)}
>
{tooltipTitle}}
+ title={{importantStatusLabel}
}
placement="left"
arrow
>
{isImportant ? (
-
+
) : (
-
+
)}