Prompt file imported from Spudymun/time-tracker (
.github/prompts/new-component.prompt.md). Fill in{{componentName}},{{folderPath}}before use. Copyright stays with the author.
New React Component
Создай компонент {{componentName}} в папке {{folderPath}}.
Что создать
{{folderPath}}/{{componentName}}.tsx— компонент{{folderPath}}/{{componentName}}.test.tsx— тесты (если нужен DOM) или*.test.ts{{folderPath}}/index.ts— barrel export
Требования к компоненту
- TypeScript strict: явный
interface {{componentName}}Props - Именованный export:
export function {{componentName}}(...) - TailwindCSS для стилизации — без inline styles, без CSS modules
"use client"— только если нужны: useState, useEffect, event handlers- JSDoc комментарий к компоненту и нетривиальным props
Требования к тестам
- Describe:
"{{componentName}}" - Покрыть: рендеринг по умолчанию + ключевые interactive сценарии
- Использовать
@testing-library/reactесли DOM-тесты
Barrel export
// index.ts
export { {{componentName}} } from "./{{componentName}}";
export type { {{componentName}}Props } from "./{{componentName}}";
Перед созданием — проверь #codebase нет ли уже похожего компонента.