mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-24 09:16:29 +00:00
Unifies card styling and improves grid layout consistency
Refactors card components to use consistent "soft-card" and "elevate" styles, harmonizes sizing and padding, and standardizes grid gaps for a uniform look across managers and views. Updates hover effects and background transitions for better visual feedback. Reduces box-shadow intensity and simplifies elevation transitions for a cleaner UI.
This commit is contained in:
1 parent
c48b133da4
commit
89b8cdcbec
8 files changed
+53
-56
No files matched your search
@@ -172,14 +172,13 @@ const KeyManager: React.FC<KeyManagerProps> = ({ keys, onSave, onDelete }) => {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className={viewMode === 'grid' ? "grid gap-2.5 grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4" : "space-y-2"}>
|
||||
<div className={viewMode === 'grid' ? "grid gap-3 grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4" : "flex flex-col gap-0"}>
|
||||
{filteredKeys.map((key) => (
|
||||
<Card
|
||||
key={key.id}
|
||||
className={cn(
|
||||
"group relative overflow-hidden bg-secondary/60 border transition-shadow cursor-pointer",
|
||||
viewMode === 'grid' ? "h-[72px] px-3 py-2" : "h-[72px] px-3 py-2 w-full",
|
||||
"border-border/60 shadow-sm hover:shadow-[0_0_0_2px_var(--ring)]"
|
||||
"group cursor-pointer soft-card elevate rounded-xl",
|
||||
viewMode === 'grid' ? "h-[68px] px-3 py-2" : "h-14 px-3 py-2 hover:bg-secondary/60 rounded-lg transition-colors"
|
||||
)}
|
||||
onClick={() => openPanelForKey(key)}
|
||||
>
|
||||
|
||||
@@ -1034,7 +1034,7 @@ echo $3 >> "$FILE"`);
|
||||
</div>
|
||||
) : (
|
||||
<div className={viewMode === 'grid'
|
||||
? "grid gap-2.5 grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"
|
||||
? "grid gap-3 grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"
|
||||
: "flex flex-col gap-0"
|
||||
}>
|
||||
{filteredKeys.map((key) => (
|
||||
@@ -1044,7 +1044,7 @@ echo $3 >> "$FILE"`);
|
||||
className={cn(
|
||||
"group cursor-pointer",
|
||||
viewMode === 'grid'
|
||||
? "bg-secondary/60 border border-border/60 shadow-sm hover:shadow-[0_0_0_2px_var(--ring)] rounded-lg h-[72px] px-3 py-2"
|
||||
? "soft-card elevate rounded-xl h-[68px] px-3 py-2"
|
||||
: "h-14 px-3 py-2 hover:bg-secondary/60 rounded-lg transition-colors",
|
||||
(panel.type === 'view' && panel.key.id === key.id) && "ring-2 ring-primary",
|
||||
(panel.type === 'export' && panel.key.id === key.id) && "ring-2 ring-primary"
|
||||
@@ -1125,7 +1125,7 @@ echo $3 >> "$FILE"`);
|
||||
<span className="text-xs text-muted-foreground">{filteredIdentities.length} items</span>
|
||||
</div>
|
||||
<div className={viewMode === 'grid'
|
||||
? "grid gap-2.5 grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"
|
||||
? "grid gap-3 grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"
|
||||
: "flex flex-col gap-0"
|
||||
}>
|
||||
{filteredIdentities.map((identity) => (
|
||||
@@ -1134,7 +1134,7 @@ echo $3 >> "$FILE"`);
|
||||
className={cn(
|
||||
"group cursor-pointer",
|
||||
viewMode === 'grid'
|
||||
? "bg-secondary/60 border border-border/60 shadow-sm hover:shadow-[0_0_0_2px_var(--ring)] rounded-lg h-[72px] px-3 py-2"
|
||||
? "soft-card elevate rounded-xl h-[68px] px-3 py-2"
|
||||
: "h-14 px-3 py-2 hover:bg-secondary/60 rounded-lg transition-colors",
|
||||
panel.type === 'identity' && panel.identity?.id === identity.id && "ring-2 ring-primary"
|
||||
)}
|
||||
|
||||
@@ -125,7 +125,7 @@ const HostItem = React.memo<HostItemProps>(({ knownHost, converted, viewMode, on
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
"group relative flex items-center gap-3 p-2.5 rounded-lg border border-border/50 bg-background hover:bg-secondary/50 transition-colors cursor-pointer",
|
||||
"group cursor-pointer soft-card elevate rounded-xl h-[68px] px-3 py-2",
|
||||
converted && "opacity-60"
|
||||
)}
|
||||
>
|
||||
@@ -148,29 +148,26 @@ const HostItem = React.memo<HostItemProps>(({ knownHost, converted, viewMode, on
|
||||
<Trash2 size={12} />
|
||||
</button>
|
||||
</div>
|
||||
<div className="h-11 w-11 rounded-xl bg-primary/10 text-primary flex items-center justify-center flex-shrink-0">
|
||||
<Server size={18} />
|
||||
</div>
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="text-sm font-semibold truncate">
|
||||
{knownHost.hostname}
|
||||
</span>
|
||||
{knownHost.port !== 22 && (
|
||||
<span className="text-xs text-muted-foreground">
|
||||
:{knownHost.port}
|
||||
</span>
|
||||
)}
|
||||
<div className="flex items-center gap-3 h-full">
|
||||
<div className="h-11 w-11 rounded-xl bg-primary/10 text-primary flex items-center justify-center flex-shrink-0">
|
||||
<Server size={18} />
|
||||
</div>
|
||||
<div className="flex flex-col gap-0 text-xs text-muted-foreground">
|
||||
<span className={cn("flex items-center gap-1", getKeyTypeColorFn(knownHost.keyType))}>
|
||||
<Key size={10} />
|
||||
{knownHost.keyType}
|
||||
</span>
|
||||
<span className="flex items-center gap-1">
|
||||
<Clock size={10} />
|
||||
{formatDateFn(knownHost.discoveredAt)}
|
||||
</span>
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="text-sm font-semibold truncate">
|
||||
{knownHost.hostname}
|
||||
</span>
|
||||
{knownHost.port !== 22 && (
|
||||
<span className="text-xs text-muted-foreground">
|
||||
:{knownHost.port}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<div className="text-[11px] text-muted-foreground truncate">
|
||||
<span className={cn(getKeyTypeColorFn(knownHost.keyType))}>
|
||||
{knownHost.keyType}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -502,18 +502,20 @@ const PortForwarding: React.FC<PortForwardingProps> = ({ hosts, keys, customGrou
|
||||
return (
|
||||
<ContextMenu key={rule.id}>
|
||||
<ContextMenuTrigger>
|
||||
<Card
|
||||
<div
|
||||
className={cn(
|
||||
"cursor-pointer soft-card rounded-xl border transition-all group",
|
||||
isSelected ? "border-primary/70 ring-2 ring-primary/20" : "border-border/60 hover:border-primary/40",
|
||||
viewMode === 'list' ? "w-full" : ""
|
||||
"group cursor-pointer",
|
||||
viewMode === 'grid'
|
||||
? "soft-card elevate rounded-xl h-[68px] px-3 py-2"
|
||||
: "h-14 px-3 py-2 hover:bg-secondary/60 rounded-lg transition-colors",
|
||||
isSelected && "ring-2 ring-primary"
|
||||
)}
|
||||
onClick={() => {
|
||||
setSelectedRuleId(rule.id);
|
||||
startEditRule(rule);
|
||||
}}
|
||||
>
|
||||
<CardContent className={cn("p-4 flex items-center gap-3", viewMode === 'list' ? "py-3" : "")}>
|
||||
<div className="flex items-center gap-3 h-full">
|
||||
<div className={cn(
|
||||
"h-11 w-11 rounded-xl flex items-center justify-center text-sm font-bold transition-colors",
|
||||
rule.status === 'active' ? (
|
||||
@@ -587,8 +589,8 @@ const PortForwarding: React.FC<PortForwardingProps> = ({ hosts, keys, customGrou
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
</ContextMenuTrigger>
|
||||
<ContextMenuContent>
|
||||
<ContextMenuItem onClick={() => startEditRule(rule)}>
|
||||
|
||||
@@ -477,9 +477,9 @@ const SnippetsManager: React.FC<SnippetsManagerProps> = ({
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="px-2.5 py-2.5 lg:px-3 lg:py-3 h-full overflow-hidden flex gap-3 relative">
|
||||
<div className="flex-1 flex flex-col min-h-0 space-y-3">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="h-full flex gap-3 relative">
|
||||
<div className="flex-1 flex flex-col min-h-0">
|
||||
<div className="flex items-center gap-2 px-3 pt-3 pb-2">
|
||||
{/* Search box */}
|
||||
<div className="relative w-64">
|
||||
<Search size={14} className="absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground" />
|
||||
@@ -545,7 +545,7 @@ const SnippetsManager: React.FC<SnippetsManagerProps> = ({
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 text-sm text-muted-foreground">
|
||||
<div className="flex items-center gap-2 text-sm text-muted-foreground px-3">
|
||||
<button className="text-primary hover:underline" onClick={() => setSelectedPackage(null)}>All packages</button>
|
||||
{breadcrumb.map((b) => (
|
||||
<span key={b.path} className="flex items-center gap-1">
|
||||
@@ -556,7 +556,7 @@ const SnippetsManager: React.FC<SnippetsManagerProps> = ({
|
||||
</div>
|
||||
|
||||
{!snippets.length && displayedPackages.length === 0 && (
|
||||
<div className="flex-1 flex items-center justify-center">
|
||||
<div className="flex-1 flex items-center justify-center px-3">
|
||||
<div className="max-w-md w-full text-center space-y-3 py-12 rounded-2xl bg-secondary/60 border border-border/60 shadow-lg">
|
||||
<div className="mx-auto h-12 w-12 rounded-xl bg-muted text-muted-foreground flex items-center justify-center">
|
||||
<FileCode size={22} />
|
||||
@@ -567,7 +567,7 @@ const SnippetsManager: React.FC<SnippetsManagerProps> = ({
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="space-y-3 overflow-y-auto pr-1">
|
||||
<div className="flex-1 space-y-3 overflow-y-auto px-3 pb-3">
|
||||
{displayedPackages.length > 0 && (
|
||||
<>
|
||||
<div className="flex items-center justify-between">
|
||||
@@ -575,7 +575,7 @@ const SnippetsManager: React.FC<SnippetsManagerProps> = ({
|
||||
</div>
|
||||
<div className={cn(
|
||||
viewMode === 'grid'
|
||||
? "grid gap-2 grid-cols-1 md:grid-cols-2 xl:grid-cols-3"
|
||||
? "grid gap-3 grid-cols-1 md:grid-cols-2 xl:grid-cols-3"
|
||||
: "flex flex-col gap-0"
|
||||
)}>
|
||||
{displayedPackages.map((pkg) => (
|
||||
@@ -583,10 +583,10 @@ const SnippetsManager: React.FC<SnippetsManagerProps> = ({
|
||||
<ContextMenuTrigger>
|
||||
<div
|
||||
className={cn(
|
||||
"cursor-pointer",
|
||||
"group cursor-pointer",
|
||||
viewMode === 'grid'
|
||||
? "bg-secondary/70 border border-border/70 hover:border-primary/60 transition-colors h-[72px] px-3 py-2 rounded-lg"
|
||||
: "group h-14 px-3 py-2 hover:bg-secondary/60 rounded-lg transition-colors"
|
||||
? "soft-card elevate rounded-xl h-[68px] px-3 py-2"
|
||||
: "h-14 px-3 py-2 hover:bg-secondary/60 rounded-lg transition-colors"
|
||||
)}
|
||||
draggable
|
||||
onDragStart={(e) => {
|
||||
@@ -639,7 +639,7 @@ const SnippetsManager: React.FC<SnippetsManagerProps> = ({
|
||||
className={cn(
|
||||
"group cursor-pointer",
|
||||
viewMode === 'grid'
|
||||
? "bg-secondary/70 border border-border/70 hover:border-primary/60 transition-colors h-[72px] px-3 py-2 rounded-lg"
|
||||
? "soft-card elevate rounded-xl h-[68px] px-3 py-2"
|
||||
: "h-14 px-3 py-2 hover:bg-secondary/60 rounded-lg transition-colors"
|
||||
)}
|
||||
draggable
|
||||
|
||||
@@ -609,9 +609,9 @@ const VaultViewInner: React.FC<VaultViewProps> = ({
|
||||
<ContextMenuTrigger asChild>
|
||||
<div
|
||||
className={cn(
|
||||
"cursor-pointer",
|
||||
"group cursor-pointer",
|
||||
viewMode === 'grid'
|
||||
? "soft-card elevate rounded-lg p-4"
|
||||
? "soft-card elevate rounded-xl h-[68px] px-3 py-2"
|
||||
: "h-14 px-3 py-2 hover:bg-secondary/60 rounded-lg transition-colors"
|
||||
)}
|
||||
draggable
|
||||
@@ -675,7 +675,7 @@ const VaultViewInner: React.FC<VaultViewProps> = ({
|
||||
className={cn(
|
||||
"group cursor-pointer",
|
||||
viewMode === 'grid'
|
||||
? "soft-card elevate rounded-xl h-[72px] px-3 py-2"
|
||||
? "soft-card elevate rounded-xl h-[68px] px-3 py-2"
|
||||
: "h-14 px-3 py-2 hover:bg-secondary/60 rounded-lg transition-colors"
|
||||
)}
|
||||
draggable
|
||||
|
||||
@@ -199,7 +199,7 @@ export const TagFilterDropdown: React.FC<TagFilterDropdownProps> = ({
|
||||
key={tag}
|
||||
className={cn(
|
||||
"flex items-center gap-2 h-8 px-2 rounded-md cursor-pointer group",
|
||||
isSelected ? "bg-secondary" : "hover:bg-accent"
|
||||
isSelected ? "bg-secondary" : "hover:bg-muted/60"
|
||||
)}
|
||||
onClick={() => toggleTag(tag)}
|
||||
>
|
||||
|
||||
@@ -58,7 +58,7 @@ body {
|
||||
.soft-card {
|
||||
background: hsl(var(--card));
|
||||
border: 1px solid hsl(var(--border) / 0.8);
|
||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02), 0 12px 36px rgba(0, 0, 0, 0.22);
|
||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02), 0 4px 12px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.card-highlight {
|
||||
@@ -80,12 +80,11 @@ body {
|
||||
}
|
||||
|
||||
.elevate {
|
||||
transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
|
||||
transition: transform 140ms ease, border-color 140ms ease;
|
||||
}
|
||||
|
||||
.elevate:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
|
||||
}
|
||||
|
||||
::selection {
|
||||
|
||||
Reference in new issue
Block a user