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 { app, cnb } from '@/agents/app'
|
||||||
import { toast } from 'sonner'
|
import { toast } from 'sonner'
|
||||||
import { useNavigate } from '@tanstack/react-router'
|
import { useNavigate } from '@tanstack/react-router'
|
||||||
|
import clsx from 'clsx'
|
||||||
|
|
||||||
interface RepoCardProps {
|
interface RepoCardProps {
|
||||||
repo: any
|
repo: any
|
||||||
@@ -298,7 +299,11 @@ 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>
|
<Badge variant="outline" className="text-xs border-neutral-300 text-neutral-700 hover:bg-neutral-100 transition-colors">{repo.visibility_level}</Badge>
|
||||||
</div>
|
</div>
|
||||||
|
<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 && (
|
{repo.site && (
|
||||||
<div
|
<div
|
||||||
className="text-xs text-neutral-500 hover:text-neutral-900 hover:underline flex transition-colors"
|
className="text-xs text-neutral-500 hover:text-neutral-900 hover:underline flex transition-colors"
|
||||||
@@ -317,6 +322,7 @@ export function RepoCard({ showReturn = false, repo }: RepoCardProps) {
|
|||||||
{repo.description}
|
{repo.description}
|
||||||
</p>
|
</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">
|
<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