From d2ff6f8b64a0f7b924932e82e0fe194d690b9963 Mon Sep 17 00:00:00 2001 From: TURMEL Kevin Date: Mon, 14 Mar 2022 18:20:26 +0100 Subject: [PATCH] Group overlay review --- .../pages/groups/groups-list-item.tsx | 32 ++++++++----------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/src/renderer/pages/groups/groups-list-item.tsx b/src/renderer/pages/groups/groups-list-item.tsx index 170ab300..b04b6180 100644 --- a/src/renderer/pages/groups/groups-list-item.tsx +++ b/src/renderer/pages/groups/groups-list-item.tsx @@ -21,21 +21,21 @@ type Props = { const GroupsListItem = ({ group, onDelete, onEdit }: Props) => { const { t } = useTranslation() const [isDisplayPreview, setDisplayPreview] = useState(false) - const [isEnter, setEnter] = useState(false) + const [isHoveringItem, setHoveringItem] = useState(false) const onMouseEnter = useCallback(() => { - setEnter(true) + setHoveringItem(true) }, []) const onMouseLeave = useCallback(() => { - setEnter(false) + setHoveringItem(false) }, []) useEffect(() => { let timerDisplay: NodeJS.Timeout if (!group.isEmpty) { - if (isEnter) { + if (isHoveringItem) { timerDisplay = setTimeout(() => { setDisplayPreview(true) }, 500) @@ -51,7 +51,7 @@ const GroupsListItem = ({ group, onDelete, onEdit }: Props) => { clearTimeout(timerDisplay) } } - }, [isEnter, group.isEmpty]) + }, [isHoveringItem, group.isEmpty]) return (
{ onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave} > - {/* Group review */} + {/* Group preview */}
-
-

- {t('page.groups.group', { name: group.name })} -

-
+

+ {t('page.groups.group', { name: group.name })} +

{/* Group list in preview */} -
- {group.isEmpty ? ( -
{t('page.groups.noScripts')}
- ) : ( - group.scripts.map(script => { - return
{script.name}
- }) - )} +
+ {group.scripts.map(script => { + return
{script.name}
+ })}