feat(ui): simplify remaining components — remove hand-drawn styling

Replace wobbly→radius, colors→palette, animate-sketch-in→animate-fade-in,
animate-pulse-gentle→animate-pulse across Skeleton, Toast, ConfirmDialog,
EmptyState, ErrorBoundary, StreamProgressBar, FilterTagInput, BlockStamp,
RiskMeter, FileViewerModal, SkillPickerModal, HubManagerModal, InstallForm.
Remove fontFamily overrides (now inherited from body), decoration="tape"
props from Card, dashed borders, rotation transforms, and hard-coded shadows.
BlockStamp simplified to clean inline-flex badge, no rotation.
This commit is contained in:
Willie
2026-03-12 16:45:02 +08:00
parent cf92a221b2
commit ef4e51abcf
13 changed files with 69 additions and 133 deletions
+6 -12
View File
@@ -1,7 +1,7 @@
import { useEffect, type ReactNode } from 'react';
import Card from './Card';
import HandButton from './HandButton';
import { wobbly } from '../design';
import { radius } from '../design';
import { useFocusTrap } from '../hooks/useFocusTrap';
interface ConfirmDialogProps {
@@ -58,20 +58,14 @@ export default function ConfirmDialog({
{/* Dialog */}
<div
ref={trapRef}
className={`relative w-full ${wide ? 'max-w-lg' : 'max-w-sm'} animate-sketch-in`}
style={{ borderRadius: wobbly.md }}
className={`relative w-full ${wide ? 'max-w-lg' : 'max-w-sm'} animate-fade-in`}
style={{ borderRadius: radius.md }}
>
<Card decoration="tape" className="text-center">
<h3
className="text-xl font-bold text-pencil mb-2"
style={{ fontFamily: 'var(--font-heading)' }}
>
<Card className="text-center">
<h3 className="text-xl font-bold text-pencil mb-2">
{title}
</h3>
<div
className="text-pencil-light mb-6"
style={{ fontFamily: 'var(--font-hand)' }}
>
<div className="text-pencil-light mb-6">
{message}
</div>
<div className="flex gap-3 justify-center">
+1 -2
View File
@@ -12,13 +12,12 @@ export default function EmptyState({ icon: Icon, title, description, action }: E
return (
<div className="flex flex-col items-center justify-center py-16 text-center">
<div
className="w-16 h-16 border-2 border-dashed border-muted-dark rounded-full flex items-center justify-center mb-4"
className="w-16 h-16 border-2 border-muted-dark rounded-full flex items-center justify-center mb-4"
>
<Icon size={28} strokeWidth={2} className="text-muted-dark" />
</div>
<h3
className="text-xl text-pencil mb-1"
style={{ fontFamily: 'var(--font-heading)' }}
>
{title}
</h3>
-2
View File
@@ -28,13 +28,11 @@ export class ErrorBoundary extends Component<Props, State> {
<div>
<h2
className="text-xl font-bold text-pencil mb-2"
style={{ fontFamily: 'var(--font-heading)' }}
>
Something went wrong
</h2>
<p
className="text-pencil-light mb-4"
style={{ fontFamily: 'var(--font-hand)' }}
>
{this.state.error?.message || 'An unexpected error occurred.'}
</p>
+8 -11
View File
@@ -13,7 +13,7 @@ import CopyButton from './CopyButton';
import HandButton from './HandButton';
import { api, type SkillFileContent } from '../api/client';
import { handTheme } from '../lib/codemirror-theme';
import { wobbly } from '../design';
import { radius } from '../design';
interface FileViewerModalProps {
skillName: string;
@@ -74,15 +74,15 @@ export default function FileViewerModal({ skillName, filepath, sourcePath, onClo
{/* Modal */}
<div
className="relative w-full max-w-3xl max-h-[85vh] flex flex-col"
style={{ borderRadius: wobbly.md }}
className="relative w-full max-w-3xl max-h-[85vh] flex flex-col animate-fade-in"
style={{ borderRadius: radius.md }}
>
<Card decoration="tape" className="flex flex-col h-full overflow-hidden">
<Card className="flex flex-col h-full overflow-hidden">
{/* Header */}
<div className="flex items-center justify-between mb-3 pt-2">
<h3
className="font-bold text-pencil truncate flex items-center gap-1.5"
style={{ fontFamily: "'Courier New', monospace", fontSize: '0.95rem' }}
className="font-bold text-pencil truncate font-mono flex items-center gap-1.5"
style={{ fontSize: '0.95rem' }}
>
{filepath}
<CopyButton
@@ -100,10 +100,7 @@ export default function FileViewerModal({ skillName, filepath, sourcePath, onClo
<div className="overflow-auto flex-1 min-h-0 -mx-4 -mb-4 px-4 pb-4">
{loading && (
<div className="py-12 text-center">
<p
className="text-pencil-light animate-pulse"
style={{ fontFamily: 'var(--font-hand)' }}
>
<p className="text-pencil-light animate-pulse">
Loading...
</p>
</div>
@@ -111,7 +108,7 @@ export default function FileViewerModal({ skillName, filepath, sourcePath, onClo
{error && (
<div className="py-8 text-center">
<p className="text-danger" style={{ fontFamily: 'var(--font-hand)' }}>
<p className="text-danger">
{error}
</p>
</div>
+4 -6
View File
@@ -1,6 +1,6 @@
import { useState, useRef } from 'react';
import { X } from 'lucide-react';
import { wobbly } from '../design';
import { radius } from '../design';
interface FilterTagInputProps {
label: string;
@@ -38,20 +38,19 @@ export default function FilterTagInput({ label, patterns, onChange, color }: Fil
<div>
<label
className="block text-sm font-bold text-pencil-light mb-1"
style={{ fontFamily: 'var(--font-hand)' }}
>
{label}
</label>
<div
className="flex flex-wrap items-center gap-1.5 p-2 bg-surface border-2 border-pencil min-h-[2.5rem] cursor-text"
style={{ borderRadius: wobbly.sm }}
style={{ borderRadius: radius.sm }}
onClick={() => inputRef.current?.focus()}
>
{patterns.map((p, i) => (
<span
key={p + i}
className={`inline-flex items-center gap-1 text-xs font-bold px-2 py-0.5 border ${colorClasses.chip}`}
style={{ borderRadius: wobbly.sm }}
style={{ borderRadius: radius.sm }}
>
{p}
<button
@@ -72,8 +71,7 @@ export default function FilterTagInput({ label, patterns, onChange, color }: Fil
onChange={(e) => setInput(e.target.value)}
onKeyDown={handleKeyDown}
placeholder={patterns.length === 0 ? 'Type pattern + Enter' : ''}
className={`flex-1 min-w-[8rem] text-sm text-pencil bg-transparent border-none outline-none placeholder:text-muted-dark ${colorClasses.ring}`}
style={{ fontFamily: "'Courier New', monospace" }}
className={`flex-1 min-w-[8rem] text-sm text-pencil bg-transparent border-none outline-none placeholder:text-muted-dark font-mono ${colorClasses.ring}`}
/>
</div>
</div>
+10 -22
View File
@@ -3,7 +3,7 @@ import { Plus, Trash2, Server } from 'lucide-react';
import Card from './Card';
import HandButton from './HandButton';
import { HandInput } from './HandInput';
import { wobbly } from '../design';
import { radius } from '../design';
export interface SavedHub {
label: string;
@@ -105,17 +105,14 @@ export default function HubManagerModal({
{/* Dialog */}
<div
className="relative w-full max-w-md animate-sketch-in"
style={{ borderRadius: wobbly.md }}
className="relative w-full max-w-md animate-fade-in"
style={{ borderRadius: radius.md }}
>
<Card decoration="tape">
<Card>
{/* Header */}
<div className="flex items-center gap-2 mb-4">
<Server size={18} strokeWidth={2.5} className="text-pencil-light" />
<h3
className="text-xl font-bold text-pencil"
style={{ fontFamily: 'var(--font-heading)' }}
>
<h3 className="text-xl font-bold text-pencil">
Manage Hubs
</h3>
</div>
@@ -127,19 +124,13 @@ export default function HubManagerModal({
<div
key={hub.url}
className="flex items-center gap-2 py-2 px-3 border-2 border-muted bg-paper-warm"
style={{ borderRadius: wobbly.sm }}
style={{ borderRadius: radius.sm }}
>
<div className="flex-1 min-w-0">
<span
className="font-bold text-pencil text-base block"
style={{ fontFamily: 'var(--font-heading)' }}
>
<span className="font-bold text-pencil text-base block">
{hub.label}
</span>
<span
className="text-xs text-muted-dark block truncate"
style={{ fontFamily: "'Courier New', monospace" }}
>
<span className="text-xs text-muted-dark block truncate font-mono">
{hub.url}
</span>
</div>
@@ -181,11 +172,8 @@ export default function HubManagerModal({
)}
{/* Add hub form */}
<div className="border-t-2 border-dashed border-muted pt-3">
<p
className="text-base font-bold text-pencil mb-2"
style={{ fontFamily: 'var(--font-heading)' }}
>
<div className="border-t-2 border-muted pt-3">
<p className="text-base font-bold text-pencil mb-2">
Add Hub
</p>
<div className="space-y-2 mb-2">
+1 -2
View File
@@ -304,7 +304,7 @@ export default function InstallForm({
};
const formContent = (
<Card variant="postit" className="animate-sketch-in">
<Card variant="postit" className="animate-fade-in">
<div className="space-y-4">
<HandInput
label="Source (GitHub URL, owner/repo, or local path)"
@@ -470,7 +470,6 @@ export default function InstallForm({
onClick={() => setOpen(!open)}
className="flex items-center gap-2 text-pencil-light hover:text-pencil transition-colors cursor-pointer mb-3"
style={{
fontFamily: 'var(--font-hand)',
background: 'none',
border: 'none',
padding: 0,
+5 -5
View File
@@ -1,4 +1,4 @@
import { wobbly } from '../design';
import { radius } from '../design';
interface SkeletonProps {
className?: string;
@@ -6,7 +6,7 @@ interface SkeletonProps {
}
export default function Skeleton({ className = '', variant = 'text' }: SkeletonProps) {
const base = 'animate-pulse-gentle bg-muted';
const base = 'animate-pulse bg-muted';
if (variant === 'circle') {
return (
@@ -21,7 +21,7 @@ export default function Skeleton({ className = '', variant = 'text' }: SkeletonP
return (
<div
className={`${base} border-2 border-muted-dark p-4 h-32 ${className}`}
style={{ borderRadius: wobbly.md }}
style={{ borderRadius: radius.md }}
/>
);
}
@@ -29,7 +29,7 @@ export default function Skeleton({ className = '', variant = 'text' }: SkeletonP
return (
<div
className={`${base} h-4 ${className}`}
style={{ borderRadius: wobbly.sm }}
style={{ borderRadius: radius.sm }}
/>
);
}
@@ -37,7 +37,7 @@ export default function Skeleton({ className = '', variant = 'text' }: SkeletonP
/** A full loading skeleton for a page */
export function PageSkeleton() {
return (
<div className="space-y-6 animate-sketch-in">
<div className="space-y-6 animate-fade-in">
<Skeleton className="w-48 h-8" />
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
<Skeleton variant="card" />
+10 -23
View File
@@ -3,7 +3,7 @@ import { Download, Search } from 'lucide-react';
import Card from './Card';
import HandButton from './HandButton';
import { HandCheckbox } from './HandInput';
import { wobbly } from '../design';
import { radius } from '../design';
import { useFocusTrap } from '../hooks/useFocusTrap';
import type { DiscoveredSkill } from '../api/client';
@@ -103,20 +103,14 @@ export default function SkillPickerModal({
{/* Dialog */}
<div
ref={trapRef}
className="relative w-full max-w-md animate-sketch-in"
style={{ borderRadius: wobbly.md }}
className="relative w-full max-w-md animate-fade-in"
style={{ borderRadius: radius.md }}
>
<Card decoration="tape" className="!overflow-clip">
<h3
className="text-xl font-bold text-pencil mb-1"
style={{ fontFamily: 'var(--font-heading)' }}
>
<Card className="!overflow-clip">
<h3 className="text-xl font-bold text-pencil mb-1">
Select Skills to Install
</h3>
<p
className="text-sm text-pencil-light mb-4 truncate"
style={{ fontFamily: "'Courier New', monospace" }}
>
<p className="text-sm text-pencil-light mb-4 truncate font-mono">
{source}
</p>
@@ -133,10 +127,9 @@ export default function SkillPickerModal({
placeholder="Filter skills..."
value={filter}
onChange={(e) => setFilter(e.target.value)}
className="w-full pl-8 pr-3 py-1.5 text-sm border-2 border-muted bg-paper text-pencil placeholder:text-muted-dark outline-none focus:border-pencil-light"
className="w-full pl-8 pr-3 py-1.5 text-sm border-2 border-muted bg-paper text-pencil placeholder:text-muted-dark outline-none focus:border-pencil-light font-mono"
style={{
borderRadius: wobbly.sm,
fontFamily: "'Courier New', monospace",
borderRadius: radius.sm,
}}
/>
</div>
@@ -166,17 +159,11 @@ export default function SkillPickerModal({
onChange={() => toggle(skill.path)}
/>
<div className="min-w-0 flex-1">
<span
className="font-bold text-pencil text-base"
style={{ fontFamily: 'var(--font-heading)' }}
>
<span className="font-bold text-pencil text-base">
{skill.name}
</span>
{skill.path !== '.' && skill.path !== skill.name && (
<span
className="block text-xs text-muted-dark truncate"
style={{ fontFamily: "'Courier New', monospace" }}
>
<span className="block text-xs text-muted-dark truncate font-mono">
{skill.path}
</span>
)}
+7 -7
View File
@@ -1,6 +1,6 @@
import type { LucideIcon } from 'lucide-react';
import Card from './Card';
import { wobbly, colors } from '../design';
import { radius, palette } from '../design';
interface StreamProgressBarProps {
count: number;
@@ -30,7 +30,7 @@ export default function StreamProgressBar({
<div className="flex items-center justify-between">
<div className="flex items-center gap-2">
<Icon size={18} strokeWidth={2.5} className={`text-pencil-light ${iconClassName}`} />
<span className="font-medium text-pencil" style={{ fontFamily: 'var(--font-hand)' }}>
<span className="font-medium text-pencil">
{total > 0 ? labelRunning : labelDiscovering}
</span>
</div>
@@ -43,19 +43,19 @@ export default function StreamProgressBar({
{total > 0 && (
<>
<div
className="h-4 border-2 border-dashed border-pencil-light/50 bg-paper-warm overflow-hidden"
style={{ borderRadius: wobbly.sm }}
className="h-4 border-2 border-pencil-light/50 bg-paper-warm overflow-hidden"
style={{ borderRadius: radius.sm }}
>
<div
className="h-full transition-all duration-200 ease-out"
style={{
width: `${pct}%`,
backgroundColor: colors.blue,
borderRadius: wobbly.sm,
backgroundColor: palette.info,
borderRadius: radius.sm,
}}
/>
</div>
<div className="flex items-center justify-between text-sm text-pencil-light" style={{ fontFamily: 'var(--font-hand)' }}>
<div className="flex items-center justify-between text-sm text-pencil-light">
<span>{count} / {total} {units}</span>
{eta !== null && <span>~{eta}s remaining</span>}
</div>
+4 -5
View File
@@ -1,6 +1,6 @@
import { createContext, useContext, useState, useCallback, type ReactNode } from 'react';
import { X, CheckCircle, AlertTriangle, XCircle, Info } from 'lucide-react';
import { wobbly } from '../design';
import { radius, shadows } from '../design';
interface Toast {
id: number;
@@ -61,11 +61,10 @@ export function ToastProvider({ children }: { children: ReactNode }) {
return (
<div
key={t.id}
className={`flex items-start gap-3 px-4 py-3 border-2 font-[var(--font-hand)] text-base animate-sketch-in ${typeStyles[t.type]}`}
className={`flex items-start gap-3 px-4 py-3 border-2 text-base animate-fade-in ${typeStyles[t.type]}`}
style={{
borderRadius: wobbly.sm,
boxShadow: '3px 3px 0px 0px rgba(45, 45, 45, 0.15)',
fontFamily: 'var(--font-hand)',
borderRadius: radius.sm,
boxShadow: shadows.md,
}}
>
<Icon size={18} strokeWidth={2.5} className="shrink-0 mt-0.5" />
+8 -31
View File
@@ -1,42 +1,19 @@
import { ShieldOff, CircleCheck } from 'lucide-react';
import { wobbly } from '../../design';
export default function BlockStamp({ isBlocked }: { isBlocked: boolean }) {
if (isBlocked) {
return (
<div
className="flex items-center gap-1.5 px-3 py-1.5 border-[3px] border-danger bg-danger-light"
style={{
borderRadius: wobbly.sm,
boxShadow: '3px 3px 0px 0px rgba(192, 57, 43, 0.3)',
transform: 'rotate(-2deg)',
}}
>
<ShieldOff size={16} strokeWidth={3} className="text-danger" />
<span
className="text-danger font-bold text-sm uppercase tracking-wider"
style={{ fontFamily: 'var(--font-heading)' }}
>
Blocked
</span>
</div>
<span className="inline-flex items-center gap-1.5 px-3 py-1 rounded bg-danger-light text-danger border border-danger font-bold text-sm uppercase tracking-wider">
<ShieldOff size={14} strokeWidth={2.5} />
Blocked
</span>
);
}
return (
<div
className="flex items-center gap-1.5 px-3 py-1.5 border-2 border-success bg-success-light"
style={{
borderRadius: wobbly.sm,
}}
>
<CircleCheck size={14} strokeWidth={2.5} className="text-success" />
<span
className="text-success font-medium text-sm"
style={{ fontFamily: 'var(--font-hand)' }}
>
Pass
</span>
</div>
<span className="inline-flex items-center gap-1.5 px-3 py-1 rounded bg-success-light text-success border border-success font-medium text-sm">
<CircleCheck size={14} strokeWidth={2.5} />
Pass
</span>
);
}
+5 -5
View File
@@ -1,4 +1,4 @@
import { wobbly } from '../../design';
import { radius } from '../../design';
import { riskColor, riskBgColor } from './helpers';
export default function RiskMeter({ riskLabel, riskScore }: { riskLabel: string; riskScore: number }) {
@@ -6,20 +6,20 @@ export default function RiskMeter({ riskLabel, riskScore }: { riskLabel: string;
return (
<div
className="flex items-center gap-2 px-3 py-1.5 border-2 border-dashed"
className="flex items-center gap-2 px-3 py-1.5 border"
style={{
borderRadius: wobbly.sm,
borderRadius: radius.sm,
borderColor: color,
backgroundColor: riskBgColor(riskLabel),
}}
>
<div className="flex flex-col items-start gap-0.5">
<span className="text-[10px] text-pencil-light uppercase tracking-wide leading-none" style={{ fontFamily: 'var(--font-hand)' }}>
<span className="text-[10px] text-pencil-light uppercase tracking-wide leading-none">
Risk
</span>
<span
className="text-sm font-bold leading-none"
style={{ fontFamily: 'var(--font-heading)', color }}
style={{ color }}
>
{riskLabel.toUpperCase()}
</span>