@patricio0312rev/skillset 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/LICENSE +21 -0
- package/README.md +176 -0
- package/bin/cli.js +37 -0
- package/package.json +55 -0
- package/src/commands/init.js +301 -0
- package/src/index.js +168 -0
- package/src/lib/config.js +200 -0
- package/src/lib/generator.js +166 -0
- package/src/utils/display.js +95 -0
- package/src/utils/readme.js +196 -0
- package/src/utils/tool-specific.js +233 -0
- package/templates/ai-engineering/agent-orchestration-planner/ SKILL.md +266 -0
- package/templates/ai-engineering/cost-latency-optimizer/ SKILL.md +270 -0
- package/templates/ai-engineering/doc-to-vector-dataset-generator/ SKILL.md +239 -0
- package/templates/ai-engineering/evaluation-harness/ SKILL.md +219 -0
- package/templates/ai-engineering/guardrails-safety-filter-builder/ SKILL.md +226 -0
- package/templates/ai-engineering/llm-debugger/ SKILL.md +283 -0
- package/templates/ai-engineering/prompt-regression-tester/ SKILL.md +216 -0
- package/templates/ai-engineering/prompt-template-builder/ SKILL.md +393 -0
- package/templates/ai-engineering/rag-pipeline-builder/ SKILL.md +244 -0
- package/templates/ai-engineering/tool-function-schema-designer/ SKILL.md +219 -0
- package/templates/architecture/adr-writer/ SKILL.md +250 -0
- package/templates/architecture/api-versioning-deprecation-planner/ SKILL.md +331 -0
- package/templates/architecture/domain-model-boundaries-mapper/ SKILL.md +300 -0
- package/templates/architecture/migration-planner/ SKILL.md +376 -0
- package/templates/architecture/performance-budget-setter/ SKILL.md +318 -0
- package/templates/architecture/reliability-strategy-builder/ SKILL.md +286 -0
- package/templates/architecture/rfc-generator/ SKILL.md +362 -0
- package/templates/architecture/scalability-playbook/ SKILL.md +279 -0
- package/templates/architecture/system-design-generator/ SKILL.md +339 -0
- package/templates/architecture/tech-debt-prioritizer/ SKILL.md +329 -0
- package/templates/backend/api-contract-normalizer/ SKILL.md +487 -0
- package/templates/backend/api-endpoint-generator/ SKILL.md +415 -0
- package/templates/backend/auth-module-builder/ SKILL.md +99 -0
- package/templates/backend/background-jobs-designer/ SKILL.md +166 -0
- package/templates/backend/caching-strategist/ SKILL.md +190 -0
- package/templates/backend/error-handling-standardizer/ SKILL.md +174 -0
- package/templates/backend/rate-limiting-abuse-protection/ SKILL.md +147 -0
- package/templates/backend/rbac-permissions-builder/ SKILL.md +158 -0
- package/templates/backend/service-layer-extractor/ SKILL.md +269 -0
- package/templates/backend/webhook-receiver-hardener/ SKILL.md +211 -0
- package/templates/ci-cd/artifact-sbom-publisher/ SKILL.md +236 -0
- package/templates/ci-cd/caching-strategy-optimizer/ SKILL.md +195 -0
- package/templates/ci-cd/deployment-checklist-generator/ SKILL.md +381 -0
- package/templates/ci-cd/github-actions-pipeline-creator/ SKILL.md +348 -0
- package/templates/ci-cd/monorepo-ci-optimizer/ SKILL.md +298 -0
- package/templates/ci-cd/preview-environments-builder/ SKILL.md +187 -0
- package/templates/ci-cd/quality-gates-enforcer/ SKILL.md +342 -0
- package/templates/ci-cd/release-automation-builder/ SKILL.md +281 -0
- package/templates/ci-cd/rollback-workflow-builder/ SKILL.md +372 -0
- package/templates/ci-cd/secrets-env-manager/ SKILL.md +242 -0
- package/templates/db-management/backup-restore-runbook-generator/ SKILL.md +505 -0
- package/templates/db-management/data-integrity-auditor/ SKILL.md +505 -0
- package/templates/db-management/data-retention-archiving-planner/ SKILL.md +430 -0
- package/templates/db-management/data-seeding-fixtures-builder/ SKILL.md +375 -0
- package/templates/db-management/db-performance-watchlist/ SKILL.md +425 -0
- package/templates/db-management/etl-sync-job-builder/ SKILL.md +457 -0
- package/templates/db-management/multi-tenant-safety-checker/ SKILL.md +398 -0
- package/templates/db-management/prisma-migration-assistant/ SKILL.md +379 -0
- package/templates/db-management/schema-consistency-checker/ SKILL.md +440 -0
- package/templates/db-management/sql-query-optimizer/ SKILL.md +324 -0
- package/templates/foundation/changelog-writer/ SKILL.md +431 -0
- package/templates/foundation/code-formatter-installer/ SKILL.md +320 -0
- package/templates/foundation/codebase-summarizer/ SKILL.md +360 -0
- package/templates/foundation/dependency-doctor/ SKILL.md +163 -0
- package/templates/foundation/dev-environment-bootstrapper/ SKILL.md +259 -0
- package/templates/foundation/dev-onboarding-builder/ SKILL.md +556 -0
- package/templates/foundation/docs-starter-kit/ SKILL.md +574 -0
- package/templates/foundation/explaining-code/SKILL.md +13 -0
- package/templates/foundation/git-hygiene-enforcer/ SKILL.md +455 -0
- package/templates/foundation/project-scaffolder/ SKILL.md +65 -0
- package/templates/foundation/project-scaffolder/references/templates.md +126 -0
- package/templates/foundation/repo-structure-linter/ SKILL.md +0 -0
- package/templates/foundation/repo-structure-linter/references/conventions.md +98 -0
- package/templates/frontend/animation-micro-interaction-pack/ SKILL.md +41 -0
- package/templates/frontend/component-scaffold-generator/ SKILL.md +562 -0
- package/templates/frontend/design-to-component-translator/ SKILL.md +547 -0
- package/templates/frontend/form-wizard-builder/ SKILL.md +553 -0
- package/templates/frontend/frontend-refactor-planner/ SKILL.md +37 -0
- package/templates/frontend/i18n-frontend-implementer/ SKILL.md +44 -0
- package/templates/frontend/modal-drawer-system/ SKILL.md +377 -0
- package/templates/frontend/page-layout-builder/ SKILL.md +630 -0
- package/templates/frontend/state-ux-flow-builder/ SKILL.md +23 -0
- package/templates/frontend/table-builder/ SKILL.md +350 -0
- package/templates/performance/alerting-dashboard-builder/ SKILL.md +162 -0
- package/templates/performance/backend-latency-profiler-helper/ SKILL.md +108 -0
- package/templates/performance/caching-cdn-strategy-planner/ SKILL.md +150 -0
- package/templates/performance/capacity-planning-helper/ SKILL.md +242 -0
- package/templates/performance/core-web-vitals-tuner/ SKILL.md +126 -0
- package/templates/performance/incident-runbook-generator/ SKILL.md +162 -0
- package/templates/performance/load-test-scenario-builder/ SKILL.md +256 -0
- package/templates/performance/observability-setup/ SKILL.md +232 -0
- package/templates/performance/postmortem-writer/ SKILL.md +203 -0
- package/templates/performance/structured-logging-standardizer/ SKILL.md +122 -0
- package/templates/security/auth-security-reviewer/ SKILL.md +428 -0
- package/templates/security/dependency-vulnerability-triage/ SKILL.md +495 -0
- package/templates/security/input-validation-sanitization-auditor/ SKILL.md +76 -0
- package/templates/security/pii-redaction-logging-policy-builder/ SKILL.md +65 -0
- package/templates/security/rbac-policy-tester/ SKILL.md +80 -0
- package/templates/security/secrets-scanner/ SKILL.md +462 -0
- package/templates/security/secure-headers-csp-builder/ SKILL.md +404 -0
- package/templates/security/security-incident-playbook-generator/ SKILL.md +76 -0
- package/templates/security/security-pr-checklist-skill/ SKILL.md +62 -0
- package/templates/security/threat-model-generator/ SKILL.md +394 -0
- package/templates/testing/contract-testing-builder/ SKILL.md +492 -0
- package/templates/testing/coverage-strategist/ SKILL.md +436 -0
- package/templates/testing/e2e-test-builder/ SKILL.md +382 -0
- package/templates/testing/flaky-test-detective/ SKILL.md +416 -0
- package/templates/testing/integration-test-builder/ SKILL.md +525 -0
- package/templates/testing/mocking-assistant/ SKILL.md +383 -0
- package/templates/testing/snapshot-test-refactorer/ SKILL.md +375 -0
- package/templates/testing/test-data-factory-builder/ SKILL.md +449 -0
- package/templates/testing/test-reporting-triage-skill/ SKILL.md +469 -0
- package/templates/testing/unit-test-generator/ SKILL.md +548 -0
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: modal-drawer-system
|
|
3
|
+
description: Implements accessible modals and drawers with focus trap, ESC to close, scroll lock, portal rendering, and ARIA attributes. Includes sample implementations for common use cases like edit forms, confirmations, and detail views. Use when building "modals", "dialogs", "drawers", "sidebars", or "overlays".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Modal & Drawer System Generator
|
|
7
|
+
|
|
8
|
+
Create accessible, polished modal dialogs and drawer components.
|
|
9
|
+
|
|
10
|
+
## Core Workflow
|
|
11
|
+
|
|
12
|
+
1. **Choose type**: Modal (center), Drawer (side), Bottom Sheet
|
|
13
|
+
2. **Setup portal**: Render outside DOM hierarchy
|
|
14
|
+
3. **Focus management**: Focus trap and restoration
|
|
15
|
+
4. **Accessibility**: ARIA attributes, keyboard shortcuts
|
|
16
|
+
5. **Animations**: Smooth enter/exit transitions
|
|
17
|
+
6. **Scroll lock**: Prevent body scroll when open
|
|
18
|
+
7. **Backdrop**: Click outside to close
|
|
19
|
+
|
|
20
|
+
## Base Modal Component
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
"use client";
|
|
24
|
+
|
|
25
|
+
import { useEffect, useRef } from "react";
|
|
26
|
+
import { createPortal } from "react-dom";
|
|
27
|
+
import { X } from "lucide-react";
|
|
28
|
+
|
|
29
|
+
interface ModalProps {
|
|
30
|
+
isOpen: boolean;
|
|
31
|
+
onClose: () => void;
|
|
32
|
+
title?: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
children: React.ReactNode;
|
|
35
|
+
size?: "sm" | "md" | "lg" | "xl" | "full";
|
|
36
|
+
closeOnEscape?: boolean;
|
|
37
|
+
closeOnBackdrop?: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function Modal({
|
|
41
|
+
isOpen,
|
|
42
|
+
onClose,
|
|
43
|
+
title,
|
|
44
|
+
description,
|
|
45
|
+
children,
|
|
46
|
+
size = "md",
|
|
47
|
+
closeOnEscape = true,
|
|
48
|
+
closeOnBackdrop = true,
|
|
49
|
+
}: ModalProps) {
|
|
50
|
+
const modalRef = useRef<HTMLDivElement>(null);
|
|
51
|
+
|
|
52
|
+
// ESC key handler
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (!isOpen || !closeOnEscape) return;
|
|
55
|
+
|
|
56
|
+
const handleEscape = (e: KeyboardEvent) => {
|
|
57
|
+
if (e.key === "Escape") onClose();
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
document.addEventListener("keydown", handleEscape);
|
|
61
|
+
return () => document.removeEventListener("keydown", handleEscape);
|
|
62
|
+
}, [isOpen, closeOnEscape, onClose]);
|
|
63
|
+
|
|
64
|
+
// Focus trap
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (!isOpen) return;
|
|
67
|
+
|
|
68
|
+
const focusableElements = modalRef.current?.querySelectorAll(
|
|
69
|
+
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
70
|
+
);
|
|
71
|
+
const firstElement = focusableElements?.[0] as HTMLElement;
|
|
72
|
+
const lastElement = focusableElements?.[
|
|
73
|
+
focusableElements.length - 1
|
|
74
|
+
] as HTMLElement;
|
|
75
|
+
|
|
76
|
+
const handleTab = (e: KeyboardEvent) => {
|
|
77
|
+
if (e.key !== "Tab") return;
|
|
78
|
+
|
|
79
|
+
if (e.shiftKey && document.activeElement === firstElement) {
|
|
80
|
+
e.preventDefault();
|
|
81
|
+
lastElement?.focus();
|
|
82
|
+
} else if (!e.shiftKey && document.activeElement === lastElement) {
|
|
83
|
+
e.preventDefault();
|
|
84
|
+
firstElement?.focus();
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
firstElement?.focus();
|
|
89
|
+
document.addEventListener("keydown", handleTab);
|
|
90
|
+
return () => document.removeEventListener("keydown", handleTab);
|
|
91
|
+
}, [isOpen]);
|
|
92
|
+
|
|
93
|
+
// Body scroll lock
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
if (isOpen) {
|
|
96
|
+
document.body.style.overflow = "hidden";
|
|
97
|
+
} else {
|
|
98
|
+
document.body.style.overflow = "";
|
|
99
|
+
}
|
|
100
|
+
return () => {
|
|
101
|
+
document.body.style.overflow = "";
|
|
102
|
+
};
|
|
103
|
+
}, [isOpen]);
|
|
104
|
+
|
|
105
|
+
if (!isOpen) return null;
|
|
106
|
+
|
|
107
|
+
const sizeClasses = {
|
|
108
|
+
sm: "max-w-sm",
|
|
109
|
+
md: "max-w-md",
|
|
110
|
+
lg: "max-w-lg",
|
|
111
|
+
xl: "max-w-xl",
|
|
112
|
+
full: "max-w-full mx-4",
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
return createPortal(
|
|
116
|
+
<div
|
|
117
|
+
className="fixed inset-0 z-50 flex items-center justify-center"
|
|
118
|
+
role="dialog"
|
|
119
|
+
aria-modal="true"
|
|
120
|
+
aria-labelledby={title ? "modal-title" : undefined}
|
|
121
|
+
aria-describedby={description ? "modal-description" : undefined}
|
|
122
|
+
>
|
|
123
|
+
{/* Backdrop */}
|
|
124
|
+
<div
|
|
125
|
+
className="absolute inset-0 bg-black/50 backdrop-blur-sm animate-in fade-in"
|
|
126
|
+
onClick={closeOnBackdrop ? onClose : undefined}
|
|
127
|
+
/>
|
|
128
|
+
|
|
129
|
+
{/* Modal */}
|
|
130
|
+
<div
|
|
131
|
+
ref={modalRef}
|
|
132
|
+
className={`relative z-10 w-full ${sizeClasses[size]} animate-in zoom-in-95 slide-in-from-bottom-4 duration-200`}
|
|
133
|
+
>
|
|
134
|
+
<div className="rounded-lg bg-white shadow-xl">
|
|
135
|
+
{/* Header */}
|
|
136
|
+
{(title || description) && (
|
|
137
|
+
<div className="border-b px-6 py-4">
|
|
138
|
+
{title && (
|
|
139
|
+
<h2 id="modal-title" className="text-xl font-semibold">
|
|
140
|
+
{title}
|
|
141
|
+
</h2>
|
|
142
|
+
)}
|
|
143
|
+
{description && (
|
|
144
|
+
<p
|
|
145
|
+
id="modal-description"
|
|
146
|
+
className="mt-1 text-sm text-gray-600"
|
|
147
|
+
>
|
|
148
|
+
{description}
|
|
149
|
+
</p>
|
|
150
|
+
)}
|
|
151
|
+
</div>
|
|
152
|
+
)}
|
|
153
|
+
|
|
154
|
+
{/* Close button */}
|
|
155
|
+
<button
|
|
156
|
+
onClick={onClose}
|
|
157
|
+
className="absolute right-4 top-4 rounded-lg p-1 hover:bg-gray-100"
|
|
158
|
+
aria-label="Close modal"
|
|
159
|
+
>
|
|
160
|
+
<X className="h-5 w-5" />
|
|
161
|
+
</button>
|
|
162
|
+
|
|
163
|
+
{/* Content */}
|
|
164
|
+
<div className="p-6">{children}</div>
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
167
|
+
</div>,
|
|
168
|
+
document.body
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Drawer Component
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
interface DrawerProps {
|
|
177
|
+
isOpen: boolean;
|
|
178
|
+
onClose: () => void;
|
|
179
|
+
position?: "left" | "right" | "bottom";
|
|
180
|
+
title?: string;
|
|
181
|
+
children: React.ReactNode;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export function Drawer({
|
|
185
|
+
isOpen,
|
|
186
|
+
onClose,
|
|
187
|
+
position = "right",
|
|
188
|
+
title,
|
|
189
|
+
children,
|
|
190
|
+
}: DrawerProps) {
|
|
191
|
+
// Similar hooks as Modal (ESC, focus trap, scroll lock)
|
|
192
|
+
|
|
193
|
+
const positionClasses = {
|
|
194
|
+
left: "left-0 top-0 h-full w-80 animate-in slide-in-from-left",
|
|
195
|
+
right: "right-0 top-0 h-full w-80 animate-in slide-in-from-right",
|
|
196
|
+
bottom: "bottom-0 left-0 right-0 h-96 animate-in slide-in-from-bottom",
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
if (!isOpen) return null;
|
|
200
|
+
|
|
201
|
+
return createPortal(
|
|
202
|
+
<div className="fixed inset-0 z-50" role="dialog" aria-modal="true">
|
|
203
|
+
<div
|
|
204
|
+
className="absolute inset-0 bg-black/50 backdrop-blur-sm"
|
|
205
|
+
onClick={onClose}
|
|
206
|
+
/>
|
|
207
|
+
<div
|
|
208
|
+
className={`absolute ${positionClasses[position]} bg-white shadow-xl`}
|
|
209
|
+
>
|
|
210
|
+
<div className="flex h-full flex-col">
|
|
211
|
+
<div className="flex items-center justify-between border-b px-6 py-4">
|
|
212
|
+
<h2 className="text-xl font-semibold">{title}</h2>
|
|
213
|
+
<button onClick={onClose} aria-label="Close drawer">
|
|
214
|
+
<X className="h-5 w-5" />
|
|
215
|
+
</button>
|
|
216
|
+
</div>
|
|
217
|
+
<div className="flex-1 overflow-y-auto p-6">{children}</div>
|
|
218
|
+
</div>
|
|
219
|
+
</div>
|
|
220
|
+
</div>,
|
|
221
|
+
document.body
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Common Use Cases
|
|
227
|
+
|
|
228
|
+
### Confirmation Dialog
|
|
229
|
+
|
|
230
|
+
```typescript
|
|
231
|
+
interface ConfirmDialogProps {
|
|
232
|
+
isOpen: boolean;
|
|
233
|
+
onClose: () => void;
|
|
234
|
+
onConfirm: () => void;
|
|
235
|
+
title: string;
|
|
236
|
+
description: string;
|
|
237
|
+
confirmText?: string;
|
|
238
|
+
cancelText?: string;
|
|
239
|
+
variant?: "danger" | "default";
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export function ConfirmDialog({
|
|
243
|
+
isOpen,
|
|
244
|
+
onClose,
|
|
245
|
+
onConfirm,
|
|
246
|
+
title,
|
|
247
|
+
description,
|
|
248
|
+
confirmText = "Confirm",
|
|
249
|
+
cancelText = "Cancel",
|
|
250
|
+
variant = "default",
|
|
251
|
+
}: ConfirmDialogProps) {
|
|
252
|
+
return (
|
|
253
|
+
<Modal isOpen={isOpen} onClose={onClose} size="sm">
|
|
254
|
+
<div className="space-y-4">
|
|
255
|
+
<div>
|
|
256
|
+
<h3 className="text-lg font-semibold">{title}</h3>
|
|
257
|
+
<p className="mt-2 text-sm text-gray-600">{description}</p>
|
|
258
|
+
</div>
|
|
259
|
+
<div className="flex justify-end gap-3">
|
|
260
|
+
<Button variant="outline" onClick={onClose}>
|
|
261
|
+
{cancelText}
|
|
262
|
+
</Button>
|
|
263
|
+
<Button
|
|
264
|
+
variant={variant === "danger" ? "destructive" : "default"}
|
|
265
|
+
onClick={() => {
|
|
266
|
+
onConfirm();
|
|
267
|
+
onClose();
|
|
268
|
+
}}
|
|
269
|
+
>
|
|
270
|
+
{confirmText}
|
|
271
|
+
</Button>
|
|
272
|
+
</div>
|
|
273
|
+
</div>
|
|
274
|
+
</Modal>
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Edit Form Modal
|
|
280
|
+
|
|
281
|
+
```typescript
|
|
282
|
+
export function EditUserModal({ user, isOpen, onClose }: EditUserModalProps) {
|
|
283
|
+
const [isSaving, setIsSaving] = useState(false);
|
|
284
|
+
|
|
285
|
+
const handleSubmit = async (e: React.FormEvent) => {
|
|
286
|
+
e.preventDefault();
|
|
287
|
+
setIsSaving(true);
|
|
288
|
+
// Save logic
|
|
289
|
+
onClose();
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
return (
|
|
293
|
+
<Modal isOpen={isOpen} onClose={onClose} title="Edit User" size="md">
|
|
294
|
+
<form onSubmit={handleSubmit} className="space-y-4">
|
|
295
|
+
<div>
|
|
296
|
+
<Label htmlFor="name">Name</Label>
|
|
297
|
+
<Input id="name" defaultValue={user.name} />
|
|
298
|
+
</div>
|
|
299
|
+
<div>
|
|
300
|
+
<Label htmlFor="email">Email</Label>
|
|
301
|
+
<Input id="email" type="email" defaultValue={user.email} />
|
|
302
|
+
</div>
|
|
303
|
+
<div className="flex justify-end gap-3">
|
|
304
|
+
<Button type="button" variant="outline" onClick={onClose}>
|
|
305
|
+
Cancel
|
|
306
|
+
</Button>
|
|
307
|
+
<Button type="submit" isLoading={isSaving}>
|
|
308
|
+
Save Changes
|
|
309
|
+
</Button>
|
|
310
|
+
</div>
|
|
311
|
+
</form>
|
|
312
|
+
</Modal>
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### Detail View Drawer
|
|
318
|
+
|
|
319
|
+
```typescript
|
|
320
|
+
export function UserDetailDrawer({
|
|
321
|
+
user,
|
|
322
|
+
isOpen,
|
|
323
|
+
onClose,
|
|
324
|
+
}: UserDetailDrawerProps) {
|
|
325
|
+
return (
|
|
326
|
+
<Drawer isOpen={isOpen} onClose={onClose} title={user.name}>
|
|
327
|
+
<div className="space-y-6">
|
|
328
|
+
<div className="flex items-center gap-4">
|
|
329
|
+
<Avatar src={user.avatar} size="lg" />
|
|
330
|
+
<div>
|
|
331
|
+
<h3 className="font-semibold">{user.name}</h3>
|
|
332
|
+
<p className="text-sm text-gray-600">{user.email}</p>
|
|
333
|
+
</div>
|
|
334
|
+
</div>
|
|
335
|
+
<div className="space-y-4">
|
|
336
|
+
<div>
|
|
337
|
+
<h4 className="text-sm font-medium text-gray-700">Role</h4>
|
|
338
|
+
<p className="mt-1">{user.role}</p>
|
|
339
|
+
</div>
|
|
340
|
+
<div>
|
|
341
|
+
<h4 className="text-sm font-medium text-gray-700">Department</h4>
|
|
342
|
+
<p className="mt-1">{user.department}</p>
|
|
343
|
+
</div>
|
|
344
|
+
<div>
|
|
345
|
+
<h4 className="text-sm font-medium text-gray-700">Joined</h4>
|
|
346
|
+
<p className="mt-1">{formatDate(user.joinedAt)}</p>
|
|
347
|
+
</div>
|
|
348
|
+
</div>
|
|
349
|
+
</div>
|
|
350
|
+
</Drawer>
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
## Best Practices
|
|
356
|
+
|
|
357
|
+
1. **Portal rendering**: Render outside parent DOM
|
|
358
|
+
2. **Focus management**: Trap focus, restore on close
|
|
359
|
+
3. **Keyboard support**: ESC to close, Tab navigation
|
|
360
|
+
4. **ARIA attributes**: role, aria-modal, aria-labelledby
|
|
361
|
+
5. **Scroll lock**: Prevent body scroll when open
|
|
362
|
+
6. **Backdrop**: Click outside to close (optional)
|
|
363
|
+
7. **Animations**: Smooth enter/exit transitions
|
|
364
|
+
8. **Mobile responsive**: Full screen on small devices
|
|
365
|
+
|
|
366
|
+
## Output Checklist
|
|
367
|
+
|
|
368
|
+
- [ ] Modal component with portal
|
|
369
|
+
- [ ] Drawer component (left/right/bottom)
|
|
370
|
+
- [ ] Focus trap implementation
|
|
371
|
+
- [ ] ESC key handler
|
|
372
|
+
- [ ] Scroll lock on body
|
|
373
|
+
- [ ] Backdrop with click-to-close
|
|
374
|
+
- [ ] ARIA attributes
|
|
375
|
+
- [ ] Smooth animations
|
|
376
|
+
- [ ] Close button
|
|
377
|
+
- [ ] Sample use cases (confirm, edit, detail)
|