mirror of
https://github.com/iflytek/skillhub.git
synced 2026-11-16 09:21:18 +00:00
fix(web): keep long skill card content from overlapping
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
This commit is contained in:
parent
751d2a7d0e
commit
e41867af9e
2 changed files with 40 additions and 29 deletions
|
|
@ -34,7 +34,7 @@ export function SkillCard({ skill, onClick, highlightStarred = true }: SkillCard
|
|||
|
||||
return (
|
||||
<Card
|
||||
className="group relative h-full cursor-pointer overflow-hidden rounded-md border border-border/60 bg-card p-4 text-card-foreground transition-[transform,box-shadow,border-color] duration-150 ease-out card-hover focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-ring/15"
|
||||
className="group relative h-full min-w-0 cursor-pointer overflow-hidden rounded-md border border-border/60 bg-card p-4 text-card-foreground transition-[transform,box-shadow,border-color] duration-150 ease-out card-hover focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-ring/15"
|
||||
style={{ borderColor: 'hsl(var(--border-card))', boxShadow: 'var(--shadow-card)' }}
|
||||
onClick={onClick}
|
||||
onKeyDown={(event) => {
|
||||
|
|
@ -51,15 +51,24 @@ export function SkillCard({ skill, onClick, highlightStarred = true }: SkillCard
|
|||
tabIndex={isInteractive ? 0 : undefined}
|
||||
>
|
||||
<div className="flex h-full flex-col">
|
||||
<div className="flex items-start justify-between mb-3">
|
||||
<div className="flex min-w-0 items-center gap-3">
|
||||
<SkillAvatar name={skill.displayName} url={skill.avatarUrl} />
|
||||
<h3 className="font-semibold text-base group-hover:text-primary transition-colors duration-150" style={{ color: 'hsl(var(--foreground))' }}>
|
||||
<div className="mb-3 flex min-w-0 items-start gap-3">
|
||||
<SkillAvatar name={skill.displayName} url={skill.avatarUrl} />
|
||||
<div className="min-w-0 flex-1">
|
||||
<h3
|
||||
className="line-clamp-2 text-base font-semibold [overflow-wrap:anywhere] group-hover:text-primary transition-colors duration-150"
|
||||
style={{ color: 'hsl(var(--foreground))' }}
|
||||
title={skill.displayName}
|
||||
>
|
||||
{skill.displayName}
|
||||
</h3>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<NamespaceBadge type="TEAM" name={`@${skill.namespace}`} />
|
||||
<div className="mt-2 grid justify-items-start">
|
||||
<NamespaceBadge
|
||||
className="block max-w-full truncate"
|
||||
type="TEAM"
|
||||
name={`@${skill.namespace}`}
|
||||
title={`@${skill.namespace}`}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -77,11 +86,11 @@ export function SkillCard({ skill, onClick, highlightStarred = true }: SkillCard
|
|||
{complianceItems.slice(0, 2).map((item, index) => (
|
||||
<span
|
||||
key={`${item.standard ?? 'standard'}-${item.controlId ?? index}`}
|
||||
className="inline-flex items-center gap-1 rounded-full border border-emerald-500/20 bg-emerald-500/10 px-2 py-0.5 text-xs font-medium text-emerald-700 dark:text-emerald-300"
|
||||
className="inline-flex max-w-full items-center gap-1 rounded-full border border-emerald-500/20 bg-emerald-500/10 px-2 py-0.5 text-xs font-medium text-emerald-700 dark:text-emerald-300"
|
||||
title={item.title}
|
||||
>
|
||||
<ShieldCheck className="h-3 w-3" />
|
||||
{[item.standard, item.controlId].filter(Boolean).join(' · ')}
|
||||
<ShieldCheck className="h-3 w-3 shrink-0" />
|
||||
<span className="truncate">{[item.standard, item.controlId].filter(Boolean).join(' · ')}</span>
|
||||
</span>
|
||||
))}
|
||||
{complianceItems.length > 2 ? (
|
||||
|
|
@ -92,9 +101,9 @@ export function SkillCard({ skill, onClick, highlightStarred = true }: SkillCard
|
|||
</div>
|
||||
) : null}
|
||||
|
||||
<div className="mt-auto flex items-center gap-4 text-xs text-muted-foreground">
|
||||
<div className="mt-auto flex flex-wrap items-center gap-x-3 gap-y-2 text-xs text-muted-foreground">
|
||||
{headlineVersion && (
|
||||
<span className="px-2.5 py-1 rounded-full bg-secondary/60 font-mono text-[11px] font-semibold" style={{ color: 'hsl(215 30% 35%)' }}>
|
||||
<span title={`v${headlineVersion.version}`} className="max-w-full truncate px-2.5 py-1 rounded-full bg-secondary/60 font-mono text-[11px] font-semibold text-secondary-foreground">
|
||||
v{headlineVersion.version}
|
||||
</span>
|
||||
)}
|
||||
|
|
@ -122,15 +131,15 @@ export function SkillCard({ skill, onClick, highlightStarred = true }: SkillCard
|
|||
)}
|
||||
</div>
|
||||
{(skill.ownerDisplayName || skill.updatedAt) && (
|
||||
<div className="mt-2 pt-2 border-t border-border/50 flex items-center gap-3 text-xs text-muted-foreground">
|
||||
<div className="mt-2 pt-2 border-t border-border/50 flex flex-wrap items-center gap-x-3 gap-y-2 text-xs text-muted-foreground">
|
||||
{skill.ownerDisplayName && (
|
||||
<span className="flex items-center gap-1">
|
||||
<User className="w-3 h-3" />
|
||||
{skill.ownerDisplayName}
|
||||
<span className="flex min-w-0 flex-1 items-center gap-1" title={skill.ownerDisplayName}>
|
||||
<User className="h-3 w-3 shrink-0" />
|
||||
<span className="truncate">{skill.ownerDisplayName}</span>
|
||||
</span>
|
||||
)}
|
||||
{skill.updatedAt && (
|
||||
<span className="flex items-center gap-1">
|
||||
<span className="flex shrink-0 items-center gap-1 whitespace-nowrap">
|
||||
<Clock className="w-3 h-3" />
|
||||
{formatRelativeTime(skill.updatedAt, i18n.language)}
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export function ResourceCard({ resource, onClick }: { resource: ResourceSummary;
|
|||
const isSuite = resource.resourceType === 'SUITE'
|
||||
return (
|
||||
<Card
|
||||
className="group h-full cursor-pointer p-5 transition-shadow hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/70"
|
||||
className="group h-full min-w-0 cursor-pointer p-5 transition-shadow hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/70"
|
||||
role="link"
|
||||
tabIndex={0}
|
||||
onClick={onClick}
|
||||
|
|
@ -22,22 +22,24 @@ export function ResourceCard({ resource, onClick }: { resource: ResourceSummary;
|
|||
}}
|
||||
>
|
||||
<div className="flex h-full flex-col gap-4">
|
||||
<div className="flex min-w-0 items-start justify-between gap-3">
|
||||
<div className="min-w-0">
|
||||
<div className="min-w-0">
|
||||
<span className="mb-2 inline-flex items-center gap-1 rounded-full bg-secondary px-2 py-1 text-xs font-medium">
|
||||
{isSuite ? <Boxes className="h-3.5 w-3.5" /> : <Wrench className="h-3.5 w-3.5" />}
|
||||
{t(isSuite ? 'suite.resourceTypeSuite' : 'suite.resourceTypeSkill')}
|
||||
</span>
|
||||
<h3 className="break-words text-lg font-semibold group-hover:text-primary">{resource.displayName}</h3>
|
||||
<h3 className="line-clamp-2 text-lg font-semibold [overflow-wrap:anywhere] group-hover:text-primary" title={resource.displayName}>{resource.displayName}</h3>
|
||||
</div>
|
||||
<div className="mt-2 grid justify-items-start">
|
||||
<NamespaceBadge
|
||||
className="block max-w-full truncate"
|
||||
type={resource.namespace === 'global' ? 'GLOBAL' : 'TEAM'}
|
||||
name={`@${resource.namespace}`}
|
||||
title={`@${resource.namespace}`}
|
||||
/>
|
||||
</div>
|
||||
<NamespaceBadge
|
||||
className="max-w-[50%] shrink-0 truncate"
|
||||
type={resource.namespace === 'global' ? 'GLOBAL' : 'TEAM'}
|
||||
name={`@${resource.namespace}`}
|
||||
title={`@${resource.namespace}`}
|
||||
/>
|
||||
</div>
|
||||
<p className="line-clamp-2 min-h-10 text-sm text-muted-foreground">
|
||||
<p className="line-clamp-2 min-h-10 text-sm [overflow-wrap:anywhere] text-muted-foreground">
|
||||
{resource.summary || t('suite.noSummary')}
|
||||
</p>
|
||||
{isSuite && resource.labels?.length ? (
|
||||
|
|
@ -53,7 +55,7 @@ export function ResourceCard({ resource, onClick }: { resource: ResourceSummary;
|
|||
))}
|
||||
</div>
|
||||
) : null}
|
||||
<div className="mt-auto flex items-center gap-3 text-xs text-muted-foreground">
|
||||
<div className="mt-auto flex flex-wrap items-center gap-x-3 gap-y-2 text-xs text-muted-foreground">
|
||||
<span
|
||||
className="max-w-[50%] truncate rounded-full bg-secondary/70 px-2.5 py-1 font-mono"
|
||||
title={`v${resource.version}`}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue