From 94898bf4bc9a71342d24bf055ac35eab73b1a3d5 Mon Sep 17 00:00:00 2001 From: Mason McElvain <52104630+masonmcelvain@users.noreply.github.com> Date: Sun, 15 Oct 2023 14:59:27 -0700 Subject: [PATCH 1/3] feat(images): use tailwind --- src/components/CardImage.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/CardImage.tsx b/src/components/CardImage.tsx index 79e48fee..43d7980e 100644 --- a/src/components/CardImage.tsx +++ b/src/components/CardImage.tsx @@ -1,7 +1,6 @@ import * as React from "react"; -import { Icon, Image } from "@chakra-ui/react"; +import { Image } from "react-feather"; import { LinkData } from "@models/link-state"; -import { Image as FeatherImageIcon } from "react-feather"; type CardImageProps = { linkData: LinkData; @@ -9,8 +8,8 @@ type CardImageProps = { export default function CardImage({ linkData }: CardImageProps) { const { name, imageUrl } = linkData; return imageUrl ? ( - {name} + {name} ) : ( - + ); } From fd326cc6b922afdb16f6d7f1ecd162202401f5e2 Mon Sep 17 00:00:00 2001 From: Mason McElvain <52104630+masonmcelvain@users.noreply.github.com> Date: Sun, 15 Oct 2023 15:22:00 -0700 Subject: [PATCH 2/3] fix(style): simplify card text hover styles --- src/components/Card.tsx | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/components/Card.tsx b/src/components/Card.tsx index 01316c10..3bd3961a 100644 --- a/src/components/Card.tsx +++ b/src/components/Card.tsx @@ -1,4 +1,4 @@ -import { Button, Text, useBoolean, VStack } from "@chakra-ui/react"; +import { Button } from "@chakra-ui/react"; import { LinkData } from "@models/link-state"; import * as React from "react"; import { useDrag } from "react-dnd"; @@ -19,7 +19,6 @@ type CardProps = { export function Card({ linkData, isInEditMode, onClick }: CardProps) { const { id, name, url } = linkData; const item: CardDragItem = { id }; - const [isMouseOver, setIsMouseOver] = useBoolean(); const [{ isDragEventInProgress }, drag] = useDrag( () => ({ type: DragItemTypes.CARD, @@ -42,6 +41,7 @@ export function Card({ linkData, isInEditMode, onClick }: CardProps) { return ( ); } From 43789095c44cf058950ea6b0415dc66b02952e99 Mon Sep 17 00:00:00 2001 From: Mason McElvain <52104630+masonmcelvain@users.noreply.github.com> Date: Thu, 23 Nov 2023 08:32:49 -0800 Subject: [PATCH 3/3] feat(card): use tailwind --- src/components/Card.tsx | 49 ++++++++++++++--------------------------- src/components/Cell.tsx | 4 ++-- 2 files changed, 18 insertions(+), 35 deletions(-) diff --git a/src/components/Card.tsx b/src/components/Card.tsx index 3bd3961a..c69c52bb 100644 --- a/src/components/Card.tsx +++ b/src/components/Card.tsx @@ -1,4 +1,3 @@ -import { Button } from "@chakra-ui/react"; import { LinkData } from "@models/link-state"; import * as React from "react"; import { useDrag } from "react-dnd"; @@ -31,45 +30,29 @@ export function Card({ linkData, isInEditMode, onClick }: CardProps) { [id], ); - const conditionalButtonProps = isDragEventInProgress - ? { - _hover: {}, - _active: {}, - _focus: {}, - } - : {}; - + const dragPseudo = isDragEventInProgress + ? "" + : "hover:bg-white hover:bg-opacity-10 focus-visible:outline-none focus-visible:ring focus-visible:ring-blue-500/50 active:bg-white active:bg-opacity-[.16] dark:hover:bg-[#EDF2F7] dark:active:bg-[#E2E8F0]"; + const dragTruncate = isDragEventInProgress + ? "" + : "group-hover:overflow-visible group-hover:whitespace-normal"; return ( - + ); } diff --git a/src/components/Cell.tsx b/src/components/Cell.tsx index 8be94579..18f99c1e 100644 --- a/src/components/Cell.tsx +++ b/src/components/Cell.tsx @@ -45,7 +45,7 @@ export default function Cell({ const onClick = React.useCallback( (event: React.MouseEvent | KeyboardEvent) => { - if (!link?.url) return; + if (isInEditMode || !link?.url) return; if (event.ctrlKey) { event.preventDefault(); openInNewTab(link.url); @@ -53,7 +53,7 @@ export default function Cell({ navigateCurrentTab(link.url); } }, - [link?.url], + [isInEditMode, link?.url], ); const onKeyDown = React.useCallback( (event: KeyboardEvent) => {