Skip to content

Commit b42ee41

Browse files
authored
style: update color palette in global.css and enhance author handling… (#83)
1 parent 79b98f4 commit b42ee41

File tree

4 files changed

+58
-33
lines changed

4 files changed

+58
-33
lines changed

.changeset/eighty-phones-juggle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@qwik.dev/devtools': patch
3+
---
4+
5+
style: update color palette in global.css and enhance author handling

packages/ui/src/features/Packages/components/DependencyCard/DependencyCard.tsx

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,26 @@ import { Package } from '../../types';
33
import { PackageIcon } from '../PackageIcon';
44

55
export const DependencyCard = component$(({ pkg }: { pkg: Package }) => {
6+
const author = pkg.author;
7+
const authorName =
8+
typeof author === 'string' ? author.trim() : (author?.name || '').trim();
9+
const authorDisplayName = authorName || 'Unknown';
10+
const authorInitials =
11+
authorDisplayName
12+
.split(/\s+/)
13+
.filter(Boolean)
14+
.map((n) => n.charAt(0))
15+
.join('')
16+
.substring(0, 2)
17+
.toUpperCase() || '??';
18+
619
const handleAuthorClick = $(() => {
7-
if (pkg.author?.url) {
8-
window.open(pkg.author.url, '_blank');
9-
} else if (pkg.author?.email) {
10-
window.open(`mailto:${pkg.author.email}`, '_blank');
20+
if (typeof author !== 'string') {
21+
if (author?.url) {
22+
window.open(author.url, '_blank');
23+
} else if (author?.email) {
24+
window.open(`mailto:${author.email}`, '_blank');
25+
}
1126
}
1227
});
1328

@@ -84,25 +99,20 @@ export const DependencyCard = component$(({ pkg }: { pkg: Package }) => {
8499
{/* Footer with author and links */}
85100
<div class="flex items-center justify-between gap-3">
86101
{/* Author Information */}
87-
{pkg.author ? (
102+
{author ? (
88103
<div class="flex min-w-0 flex-1 items-center gap-2">
89104
<div
90105
class="from-accent/20 to-accent/40 border-accent/30 flex h-7 w-7 flex-shrink-0 cursor-pointer items-center justify-center rounded-full border bg-gradient-to-br transition-transform hover:scale-110"
91106
onClick$={handleAuthorClick}
92-
title={`Contact ${pkg.author.name}`}
107+
title={`Contact ${authorDisplayName}`}
93108
>
94109
<span class="text-accent text-[10px] font-semibold">
95-
{pkg.author.name
96-
.split(' ')
97-
.map((n) => n.charAt(0))
98-
.join('')
99-
.substring(0, 2)
100-
.toUpperCase()}
110+
{authorInitials}
101111
</span>
102112
</div>
103113
<span class="text-muted-foreground truncate text-xs">
104114
<span class="text-foreground font-medium">
105-
{pkg.author.name}
115+
{authorDisplayName}
106116
</span>
107117
</span>
108118
</div>

packages/ui/src/features/Packages/types.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,21 @@ export interface Package {
22
name: string;
33
version: string;
44
description: string;
5-
author?: {
6-
name: string;
7-
email?: string;
8-
url?: string;
9-
};
5+
/**
6+
* npm package.json `author` can be:
7+
* - string: "Jane Doe <[email protected]> (https://example.com)"
8+
* - object: { name, email?, url? }
9+
* - missing / partial
10+
*
11+
* Runtime data may not match strict typings, so keep this permissive.
12+
*/
13+
author?:
14+
| string
15+
| {
16+
name?: string;
17+
email?: string;
18+
url?: string;
19+
};
1020
authorAvatar?: string;
1121
packageAvatar?: string;
1222
homepage?: string;

packages/ui/src/global.css

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
/* default (light) tokens; can be overridden by :root rules below */
1010
--color-background: #ffffff;
1111
--color-foreground: #000000;
12-
--color-primary: #10b981;
13-
--color-primary-hover: #f2f2f2;
14-
--color-primary-active: #047857;
12+
--color-primary: #16b6f6;
13+
--color-primary-hover: #38bdf8;
14+
--color-primary-active: #0ea5e9;
1515
--color-secondary: #6b7280;
1616
--color-muted: #9ca3af;
1717
--color-muted-foreground: #6b7280;
18-
--color-accent: #10b981;
18+
--color-accent: #16b6f6;
1919
--color-border: #e5e7eb;
2020
--color-input: #e5e7eb;
21-
--color-ring: #10b981;
21+
--color-ring: #16b6f6;
2222
--color-card: #f2f2f2;
2323
--color-card-item-bg: rgba(0, 0, 0, 0.02);
2424
--color-card-item-hover-bg: rgba(0, 0, 0, 0.03);
@@ -28,9 +28,9 @@
2828
--theme-name: 'light';
2929
--color-background: #ffffff;
3030
--color-foreground: #000000;
31-
--color-primary: #10b981;
32-
--color-primary-hover: #f2f2f2; /* green-600 */
33-
--color-primary-active: #047857; /* green-700 */
31+
--color-primary: #16b6f6;
32+
--color-primary-hover: #38bdf8; /* sky-400 */
33+
--color-primary-active: #0ea5e9; /* sky-500 */
3434
--color-secondary: #6b7280; /* Tailwind's secondary.light */
3535
--color-border: #e5e7eb;
3636
--color-card: #f2f2f2;
@@ -52,7 +52,7 @@
5252
/* Tailwind semantic variables */
5353
--color-muted: #9ca3af; /* Similar to existing --color-text-subtle */
5454
--color-muted-foreground: #6b7280;
55-
--color-accent: #10b981; /* Green accent */
55+
--color-accent: #16b6f6; /* Accent */
5656
--color-input: var(--color-border); /* Alias to border */
5757
--color-ring: var(--color-primary); /* Alias to primary */
5858
}
@@ -65,9 +65,9 @@
6565
--theme-name: 'dark';
6666
--color-background: #18181b;
6767
--color-foreground: #ffffff;
68-
--color-primary: #34d399; /* Tailwind's primary.dark */
69-
--color-primary-hover: #10b981; /* green-500 */
70-
--color-primary-active: #059669; /* green-600 */
68+
--color-primary: #16b6f6; /* primary */
69+
--color-primary-hover: #38bdf8; /* hover */
70+
--color-primary-active: #0ea5e9; /* active */
7171
--color-secondary: #9ca3af; /* Tailwind's secondary.dark */
7272
--color-border: #374151;
7373
--color-card: #27272a;
@@ -83,7 +83,7 @@
8383
/* Tailwind semantic variables */
8484
--color-muted: #374151; /* Similar to existing html.dark --color-border */
8585
--color-muted-foreground: #9ca3af; /* Similar to existing html.dark --color-secondary */
86-
--color-accent: #10b981; /* Matches existing html.dark --color-icon-accent */
86+
--color-accent: #16b6f6; /* Accent */
8787
--color-input: var(--color-border); /* Alias to border */
8888
--color-ring: var(--color-primary); /* Alias to primary */
8989
}
@@ -97,7 +97,7 @@
9797
--theme-name: 'dark';
9898
--color-background: #18181b;
9999
--color-foreground: #ffffff;
100-
--color-primary: #10b981; /* Tailwind's primary.dark */
100+
--color-primary: #16b6f6; /* primary */
101101
--color-secondary: #9ca3af; /* Tailwind's secondary.dark */
102102
--color-border: #374151;
103103
--color-card: #27272a;
@@ -113,7 +113,7 @@
113113
/* Tailwind semantic variables */
114114
--color-muted: #374151; /* Similar to existing html.dark --color-border */
115115
--color-muted-foreground: #9ca3af; /* Similar to existing html.dark --color-secondary */
116-
--color-accent: #10b981; /* Matches existing html.dark --color-icon-accent */
116+
--color-accent: #16b6f6; /* Accent */
117117
--color-input: var(--color-border); /* Alias to border */
118118
--color-ring: var(--color-primary); /* Alias to primary */
119119
}

0 commit comments

Comments
 (0)