generated from kevisual/vite-react-template
feat: 优化 RepoCard 组件,添加条件渲染和样式调整
This commit is contained in:
@@ -21,6 +21,7 @@ import { myOrgs } from '../store/build'
|
||||
import { app, cnb } from '@/agents/app'
|
||||
import { toast } from 'sonner'
|
||||
import { useNavigate } from '@tanstack/react-router'
|
||||
import clsx from 'clsx'
|
||||
|
||||
interface RepoCardProps {
|
||||
repo: any
|
||||
@@ -298,25 +299,30 @@ export function RepoCard({ showReturn = false, repo }: RepoCardProps) {
|
||||
)}
|
||||
<Badge variant="outline" className="text-xs border-neutral-300 text-neutral-700 hover:bg-neutral-100 transition-colors">{repo.visibility_level}</Badge>
|
||||
</div>
|
||||
|
||||
{repo.site && (
|
||||
<div
|
||||
className="text-xs text-neutral-500 hover:text-neutral-900 hover:underline flex transition-colors"
|
||||
onClick={() => {
|
||||
window.open(repo.site, '_blank')
|
||||
}}
|
||||
>
|
||||
<LinkIcon className="w-4 h-4 shrink-0 mr-2" />
|
||||
<div className='truncate grow'>
|
||||
{repo.site}
|
||||
<div className={clsx("flex flex-col sm:flex-row sm:items-center gap-4", !showReturn && "cursor-pointer")} onClick={() => {
|
||||
if (!showReturn) {
|
||||
window.open(repo.site, '_blank')
|
||||
}
|
||||
}}>
|
||||
{repo.site && (
|
||||
<div
|
||||
className="text-xs text-neutral-500 hover:text-neutral-900 hover:underline flex transition-colors"
|
||||
onClick={() => {
|
||||
window.open(repo.site, '_blank')
|
||||
}}
|
||||
>
|
||||
<LinkIcon className="w-4 h-4 shrink-0 mr-2" />
|
||||
<div className='truncate grow'>
|
||||
{repo.site}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{repo.description && (
|
||||
<p className="ml-2 text-sm text-neutral-600 line-clamp-2 min-h-10 grow">
|
||||
{repo.description}
|
||||
</p>
|
||||
)}
|
||||
)}
|
||||
{repo.description && (
|
||||
<p className="ml-2 text-sm text-neutral-600 line-clamp-2 min-h-10 grow">
|
||||
{repo.description}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
|
||||
<div className="absolute bottom-0 left-0 right-0 flex items-center gap-4 text-xs text-neutral-500 px-6 py-3 border-t border-neutral-100 bg-neutral-50">
|
||||
|
||||
Reference in New Issue
Block a user