perf: plugin market layout

This commit is contained in:
Junyan Qin
2025-11-05 18:34:40 +08:00
parent 76a69ecc7e
commit 74a5e37892
2 changed files with 25 additions and 23 deletions
@@ -283,7 +283,7 @@ function MarketPageContent({
// }; // };
return ( return (
<div className="container mx-auto px-4 py-6 space-y-6"> <div className="container mx-auto px-3 sm:px-4 py-4 sm:py-6 space-y-4 sm:space-y-6">
{/* 搜索框 */} {/* 搜索框 */}
<div className="flex items-center justify-center"> <div className="flex items-center justify-center">
<div className="relative w-full max-w-2xl"> <div className="relative w-full max-w-2xl">
@@ -301,19 +301,19 @@ function MarketPageContent({
handleSearch(searchQuery); handleSearch(searchQuery);
} }
}} }}
className="pl-10 pr-4" className="pl-10 pr-4 text-sm sm:text-base"
/> />
</div> </div>
</div> </div>
{/* 排序下拉框 */} {/* 排序下拉框 */}
<div className="flex items-center justify-center"> <div className="flex items-center justify-center">
<div className="w-full max-w-2xl flex items-center gap-3"> <div className="w-full max-w-2xl flex items-center gap-2 sm:gap-3">
<span className="text-sm text-muted-foreground whitespace-nowrap"> <span className="text-xs sm:text-sm text-muted-foreground whitespace-nowrap">
{t('market.sortBy')}: {t('market.sortBy')}:
</span> </span>
<Select value={sortOption} onValueChange={handleSortChange}> <Select value={sortOption} onValueChange={handleSortChange}>
<SelectTrigger className="w-48"> <SelectTrigger className="w-40 sm:w-48 text-xs sm:text-sm">
<SelectValue /> <SelectValue />
</SelectTrigger> </SelectTrigger>
<SelectContent> <SelectContent>
@@ -329,7 +329,7 @@ function MarketPageContent({
{/* 搜索结果统计 */} {/* 搜索结果统计 */}
{total > 0 && ( {total > 0 && (
<div className="text-center text-muted-foreground"> <div className="text-center text-muted-foreground text-sm">
{searchQuery {searchQuery
? t('market.searchResults', { count: total }) ? t('market.searchResults', { count: total })
: t('market.totalPlugins', { count: total })} : t('market.totalPlugins', { count: total })}
@@ -15,35 +15,37 @@ export default function PluginMarketCardComponent({
return ( return (
<div <div
className="w-[100%] h-[9rem] bg-white rounded-[10px] shadow-[0px_0px_4px_0_rgba(0,0,0,0.2)] p-[1rem] cursor-pointer hover:shadow-[0px_2px_8px_0_rgba(0,0,0,0.15)] transition-shadow duration-200 dark:bg-[#1f1f22]" className="w-[100%] h-auto min-h-[8rem] sm:h-[9rem] bg-white rounded-[10px] shadow-[0px_0px_4px_0_rgba(0,0,0,0.2)] p-3 sm:p-[1rem] cursor-pointer hover:shadow-[0px_2px_8px_0_rgba(0,0,0,0.15)] transition-shadow duration-200 dark:bg-[#1f1f22]"
onClick={handleCardClick} onClick={handleCardClick}
> >
<div className="w-full h-full flex flex-col justify-between"> <div className="w-full h-full flex flex-col justify-between gap-2">
{/* 上部分:插件信息 */} {/* 上部分:插件信息 */}
<div className="flex flex-row items-start justify-start gap-[1.2rem]"> <div className="flex flex-row items-start justify-start gap-2 sm:gap-[1.2rem] min-h-0">
<img src={cardVO.iconURL} alt="plugin icon" className="w-16 h-16" /> <img
src={cardVO.iconURL}
alt="plugin icon"
className="w-12 h-12 sm:w-16 sm:h-16 flex-shrink-0"
/>
<div className="flex-1 flex flex-col items-start justify-start gap-[0.6rem]"> <div className="flex-1 flex flex-col items-start justify-start gap-[0.4rem] sm:gap-[0.6rem] min-w-0 overflow-hidden">
<div className="flex flex-col items-start justify-start"> <div className="flex flex-col items-start justify-start w-full min-w-0">
<div className="text-[0.7rem] text-[#666] dark:text-[#999]"> <div className="text-[0.65rem] sm:text-[0.7rem] text-[#666] dark:text-[#999] truncate w-full">
{cardVO.pluginId} {cardVO.pluginId}
</div> </div>
<div className="flex flex-row items-center justify-start gap-[0.4rem]"> <div className="text-base sm:text-[1.2rem] text-black dark:text-[#f0f0f0] truncate w-full">
<div className="text-[1.2rem] text-black dark:text-[#f0f0f0]"> {cardVO.label}
{cardVO.label}
</div>
</div> </div>
</div> </div>
<div className="text-[0.8rem] text-[#666] dark:text-[#999] line-clamp-2"> <div className="text-[0.7rem] sm:text-[0.8rem] text-[#666] dark:text-[#999] line-clamp-2 overflow-hidden">
{cardVO.description} {cardVO.description}
</div> </div>
</div> </div>
<div className="flex h-full flex-row items-start justify-center gap-[0.4rem]"> <div className="flex flex-row items-start justify-center gap-[0.4rem] flex-shrink-0">
{cardVO.githubURL && ( {cardVO.githubURL && (
<svg <svg
className="w-[1.4rem] h-[1.4rem] text-black cursor-pointer hover:text-gray-600 dark:text-[#f0f0f0]" className="w-5 h-5 sm:w-[1.4rem] sm:h-[1.4rem] text-black cursor-pointer hover:text-gray-600 dark:text-[#f0f0f0] flex-shrink-0"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24" viewBox="0 0 24 24"
fill="currentColor" fill="currentColor"
@@ -59,9 +61,9 @@ export default function PluginMarketCardComponent({
</div> </div>
{/* 下部分:下载量 */} {/* 下部分:下载量 */}
<div className="w-full flex flex-row items-center justify-start gap-[0.4rem] px-[0.4rem]"> <div className="w-full flex flex-row items-center justify-start gap-[0.3rem] sm:gap-[0.4rem] px-0 sm:px-[0.4rem] flex-shrink-0">
<svg <svg
className="w-[1.2rem] h-[1.2rem] text-[#2563eb]" className="w-4 h-4 sm:w-[1.2rem] sm:h-[1.2rem] text-[#2563eb] flex-shrink-0"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24" viewBox="0 0 24 24"
fill="none" fill="none"
@@ -72,7 +74,7 @@ export default function PluginMarketCardComponent({
<polyline points="7,10 12,15 17,10" /> <polyline points="7,10 12,15 17,10" />
<line x1="12" y1="15" x2="12" y2="3" /> <line x1="12" y1="15" x2="12" y2="3" />
</svg> </svg>
<div className="text-sm text-[#2563eb] font-medium"> <div className="text-xs sm:text-sm text-[#2563eb] font-medium whitespace-nowrap">
{cardVO.installCount.toLocaleString()} {cardVO.installCount.toLocaleString()}
</div> </div>
</div> </div>