style(providers): optimize card layout and action button sizes
Improve provider card visual density and action buttons. - Reduce icon button sizes for compact layout - Adjust drag handle and icon sizes - Tighten spacing between action buttons - Update hover translate values for better alignment
This commit is contained in:
@@ -21,16 +21,17 @@ export function ProviderActions({
|
|||||||
onDelete,
|
onDelete,
|
||||||
}: ProviderActionsProps) {
|
}: ProviderActionsProps) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const iconButtonClass = "h-8 w-8 p-1";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-1.5">
|
||||||
<Button
|
<Button
|
||||||
size="sm"
|
size="sm"
|
||||||
variant={isCurrent ? "secondary" : "default"}
|
variant={isCurrent ? "secondary" : "default"}
|
||||||
onClick={onSwitch}
|
onClick={onSwitch}
|
||||||
disabled={isCurrent}
|
disabled={isCurrent}
|
||||||
className={cn(
|
className={cn(
|
||||||
"w-20",
|
"w-[4.5rem] px-2.5",
|
||||||
isCurrent &&
|
isCurrent &&
|
||||||
"bg-gray-200 text-muted-foreground hover:bg-gray-200 hover:text-muted-foreground dark:bg-gray-700 dark:hover:bg-gray-700",
|
"bg-gray-200 text-muted-foreground hover:bg-gray-200 hover:text-muted-foreground dark:bg-gray-700 dark:hover:bg-gray-700",
|
||||||
)}
|
)}
|
||||||
@@ -54,6 +55,7 @@ export function ProviderActions({
|
|||||||
variant="ghost"
|
variant="ghost"
|
||||||
onClick={onEdit}
|
onClick={onEdit}
|
||||||
title={t("common.edit")}
|
title={t("common.edit")}
|
||||||
|
className={iconButtonClass}
|
||||||
>
|
>
|
||||||
<Edit className="h-4 w-4" />
|
<Edit className="h-4 w-4" />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -63,6 +65,7 @@ export function ProviderActions({
|
|||||||
variant="ghost"
|
variant="ghost"
|
||||||
onClick={onDuplicate}
|
onClick={onDuplicate}
|
||||||
title={t("provider.duplicate")}
|
title={t("provider.duplicate")}
|
||||||
|
className={iconButtonClass}
|
||||||
>
|
>
|
||||||
<Copy className="h-4 w-4" />
|
<Copy className="h-4 w-4" />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -72,6 +75,7 @@ export function ProviderActions({
|
|||||||
variant="ghost"
|
variant="ghost"
|
||||||
onClick={onConfigureUsage}
|
onClick={onConfigureUsage}
|
||||||
title={t("provider.configureUsage")}
|
title={t("provider.configureUsage")}
|
||||||
|
className={iconButtonClass}
|
||||||
>
|
>
|
||||||
<BarChart3 className="h-4 w-4" />
|
<BarChart3 className="h-4 w-4" />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -82,6 +86,7 @@ export function ProviderActions({
|
|||||||
onClick={isCurrent ? undefined : onDelete}
|
onClick={isCurrent ? undefined : onDelete}
|
||||||
title={t("common.delete")}
|
title={t("common.delete")}
|
||||||
className={cn(
|
className={cn(
|
||||||
|
iconButtonClass,
|
||||||
!isCurrent && "hover:text-red-500 dark:hover:text-red-400",
|
!isCurrent && "hover:text-red-500 dark:hover:text-red-400",
|
||||||
isCurrent && "opacity-40 cursor-not-allowed text-muted-foreground",
|
isCurrent && "opacity-40 cursor-not-allowed text-muted-foreground",
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -125,11 +125,11 @@ export function ProviderCard({
|
|||||||
>
|
>
|
||||||
<div className="absolute inset-0 bg-gradient-to-r from-primary/10 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-500 pointer-events-none" />
|
<div className="absolute inset-0 bg-gradient-to-r from-primary/10 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-500 pointer-events-none" />
|
||||||
<div className="relative flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
|
<div className="relative flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
|
||||||
<div className="flex flex-1 items-center gap-3">
|
<div className="flex flex-1 items-center gap-2">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex-shrink-0 cursor-grab active:cursor-grabbing p-2",
|
"-ml-1.5 flex-shrink-0 cursor-grab active:cursor-grabbing p-1.5",
|
||||||
"text-muted-foreground/50 hover:text-muted-foreground transition-colors",
|
"text-muted-foreground/50 hover:text-muted-foreground transition-colors",
|
||||||
dragHandleProps?.isDragging && "cursor-grabbing",
|
dragHandleProps?.isDragging && "cursor-grabbing",
|
||||||
)}
|
)}
|
||||||
@@ -141,12 +141,12 @@ export function ProviderCard({
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
{/* 供应商图标 */}
|
{/* 供应商图标 */}
|
||||||
<div className="w-10 h-10 rounded-lg bg-white/5 flex items-center justify-center border border-gray-200 dark:border-white/10 group-hover:scale-105 transition-transform duration-300">
|
<div className="h-9 w-9 rounded-lg bg-white/5 flex items-center justify-center border border-gray-200 dark:border-white/10 group-hover:scale-105 transition-transform duration-300">
|
||||||
<ProviderIcon
|
<ProviderIcon
|
||||||
icon={provider.icon}
|
icon={provider.icon}
|
||||||
name={provider.name}
|
name={provider.name}
|
||||||
color={provider.iconColor}
|
color={provider.iconColor}
|
||||||
size={28}
|
size={26}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -196,7 +196,7 @@ export function ProviderCard({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="relative flex items-center ml-auto">
|
<div className="relative flex items-center ml-auto">
|
||||||
<div className="ml-auto transition-transform duration-200 group-hover:-translate-x-[11rem] group-focus-within:-translate-x-[11rem] sm:group-hover:-translate-x-[13rem] sm:group-focus-within:-translate-x-[13rem]">
|
<div className="ml-auto transition-transform duration-200 group-hover:-translate-x-[12.25rem] group-focus-within:-translate-x-[12.25rem] sm:group-hover:-translate-x-[14.25rem] sm:group-focus-within:-translate-x-[14.25rem]">
|
||||||
<UsageFooter
|
<UsageFooter
|
||||||
provider={provider}
|
provider={provider}
|
||||||
providerId={provider.id}
|
providerId={provider.id}
|
||||||
@@ -207,7 +207,7 @@ export function ProviderCard({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="absolute right-0 top-1/2 -translate-y-1/2 flex items-center gap-2 opacity-0 pointer-events-none group-hover:opacity-100 group-focus-within:opacity-100 group-hover:pointer-events-auto group-focus-within:pointer-events-auto transition-all duration-200 translate-x-3 group-hover:translate-x-0 group-focus-within:translate-x-0">
|
<div className="absolute right-0 top-1/2 -translate-y-1/2 flex items-center gap-1.5 opacity-0 pointer-events-none group-hover:opacity-100 group-focus-within:opacity-100 group-hover:pointer-events-auto group-focus-within:pointer-events-auto transition-all duration-200 translate-x-2 group-hover:translate-x-0 group-focus-within:translate-x-0">
|
||||||
<ProviderActions
|
<ProviderActions
|
||||||
isCurrent={isCurrent}
|
isCurrent={isCurrent}
|
||||||
onSwitch={() => onSwitch(provider)}
|
onSwitch={() => onSwitch(provider)}
|
||||||
|
|||||||
Reference in New Issue
Block a user