Skip to content

Commit 48329cd

Browse files
CopilotoBusk
andcommitted
Refine Trust Level UI based on feedback
- Move Info icon inline with trust level labels (Provenance/Trusted Publisher) - Reserve space in left column with invisible placeholder for alignment - Replace PackageOpen icon with FileCode (looks less like an insect) - Change compare button from outline to secondary variant (filled like npm diff button) - Add bottom margin (mb-4) to Trust Level section for spacing from Packagephobia - All tests pass, linting passes, build succeeds Co-authored-by: oBusk <13413409+oBusk@users.noreply.github.com>
1 parent e4fb352 commit 48329cd

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

src/app/[...parts]/_page/TrustComparison/TrustComparison.tsx

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import {
44
CheckCircle2,
5+
FileCode,
56
GitCompareArrows,
67
Info,
7-
PackageOpen,
88
Shield,
99
XCircle,
1010
} from "lucide-react";
@@ -109,16 +109,20 @@ const TrustBox: FunctionComponent<TrustBoxProps> = ({
109109
)}
110110
>
111111
<div aria-hidden="true">{icon}</div>
112-
<p className="text-sm font-semibold">{label}</p>
113-
<Tooltip label={tooltip}>
114-
<button
115-
type="button"
116-
className="inline-flex cursor-help opacity-60 hover:opacity-100"
117-
aria-label="More information"
118-
>
119-
<Info className="size-4" />
120-
</button>
121-
</Tooltip>
112+
<div className="flex items-center gap-1">
113+
<p className="text-sm font-semibold">{label}</p>
114+
{evidence !== undefined ? (
115+
<Tooltip label={tooltip}>
116+
<button
117+
type="button"
118+
className="inline-flex cursor-help opacity-60 hover:opacity-100"
119+
aria-label="More information"
120+
>
121+
<Info className="size-4" />
122+
</button>
123+
</Tooltip>
124+
) : null}
125+
</div>
122126
</div>
123127
{isDowngrade ? (
124128
<p className="text-xs text-red-600 dark:text-red-400">
@@ -129,14 +133,17 @@ const TrustBox: FunctionComponent<TrustBoxProps> = ({
129133
<p className="text-xs text-green-600 dark:text-green-400">
130134
✓ Trust improvement
131135
</p>
132-
) : null}
136+
) : (
137+
// Reserve space to keep alignment when there's no upgrade/downgrade message
138+
<p className="invisible text-xs">Placeholder</p>
139+
)}
133140
{provenanceUrl ? (
134141
<div className="text-xs">
135142
<ExternalLink
136143
href={provenanceUrl}
137144
className="inline-flex items-center gap-1 text-blue-600 hover:underline dark:text-blue-400"
138145
>
139-
<PackageOpen className="size-3" />
146+
<FileCode className="size-3" />
140147
Source
141148
</ExternalLink>
142149
</div>
@@ -201,8 +208,8 @@ const TrustComparison: FunctionComponent<TrustComparisonProps> = ({
201208
}
202209
/>
203210
{compareUrl ? (
204-
<div className="mt-2 text-center">
205-
<Button variant="outline" size="sm" asChild>
211+
<div className="mb-4 mt-2 text-center">
212+
<Button variant="secondary" size="sm" asChild>
206213
<ExternalLink
207214
href={compareUrl}
208215
className="inline-flex items-center gap-2"
@@ -212,7 +219,9 @@ const TrustComparison: FunctionComponent<TrustComparisonProps> = ({
212219
</ExternalLink>
213220
</Button>
214221
</div>
215-
) : null}
222+
) : (
223+
<div className="mb-4" />
224+
)}
216225
</>
217226
);
218227
};

0 commit comments

Comments
 (0)