Skip to content

Commit 608ae93

Browse files
shivamhwpclaude
andcommitted
fix(web): mark checked projects with a small check on their icon
Checked rows keep their project icon with main's small check in the corner. The checkbox still takes the icon's place on hover, so a click adds or removes a project without Shift. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 0a4c5e5 commit 608ae93

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

‎apps/web/src/components/ProjectComboboxRow.tsx‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
import { CheckIcon } from "lucide-react";
12
import type { ReactNode } from "react";
23

34
import { cn } from "~/lib/utils";
45
import { CheckboxMark } from "./ui/checkbox";
56

67
/**
7-
* A project row's icon slot. With `selection`, a checkbox takes the icon's place on the highlighted
8-
* row and stays while the row is checked. Touch has no hover, so it always shows the checkbox.
8+
* A project row's icon slot. With `selection`, a checked row marks its icon with a small check, and
9+
* a checkbox takes the icon's place on the highlighted row. Touch has no hover, so it always shows
10+
* the checkbox.
911
*/
1012
export function ProjectRowLeading(props: {
1113
readonly icon: ReactNode;
@@ -21,24 +23,24 @@ export function ProjectRowLeading(props: {
2123
<span className="grid shrink-0">
2224
<span
2325
className={cn(
24-
"col-start-1 row-start-1 flex",
25-
selection &&
26-
(selection.checked
27-
? "invisible"
28-
: "pointer-coarse:invisible pointer-fine:in-data-highlighted:invisible"),
26+
"relative col-start-1 row-start-1 flex",
27+
selection && "pointer-coarse:invisible pointer-fine:in-data-highlighted:invisible",
2928
)}
3029
>
3130
{props.icon}
31+
{selection?.checked ? (
32+
<span className="pointer-events-none absolute -right-1 -bottom-1 grid size-3 place-items-center rounded-full bg-primary ring-2 ring-popover">
33+
<CheckIcon className="size-2 text-primary-foreground" strokeWidth={4} aria-hidden />
34+
</span>
35+
) : null}
3236
</span>
3337
{selection ? (
3438
<button
3539
type="button"
3640
tabIndex={-1}
3741
aria-hidden="true"
3842
className={cn(
39-
"col-start-1 row-start-1 flex cursor-pointer items-center justify-center",
40-
!selection.checked &&
41-
"invisible pointer-coarse:visible pointer-fine:in-data-highlighted:visible",
43+
"invisible col-start-1 row-start-1 flex cursor-pointer items-center justify-center pointer-coarse:visible pointer-fine:in-data-highlighted:visible",
4244
)}
4345
onPointerDown={(event) => event.stopPropagation()}
4446
onMouseDown={(event) => event.preventDefault()}

0 commit comments

Comments
 (0)