- Backend: FastAPI app with all models, services, schemas, routes - Admin Panel: Next.js dashboard with all modules (CRM, POS, repairs, warranties, billing, notifications, etc.) - Ecommerce: storefront (submodule) + product catalog - AI Agents: .agents/ skill library for Antigravity IDE - Docs: architecture, billing, notification gateway markdown - Submodules: Backend/OpenWA, Ecommerce/File 2/storefront
52 lines
2 KiB
Markdown
52 lines
2 KiB
Markdown
---
|
|
name: "Create Component"
|
|
description: "Creates a new reusable component following ReloPortal component creation guidelines"
|
|
---
|
|
|
|
# Skill: Create Component
|
|
|
|
## 1. Purpose
|
|
Standardizes frontend components layout, ensuring clean prop validation, BEM class styling, modular separation, and documentation.
|
|
|
|
## 2. When to Use
|
|
When implementing custom sliders, banners, modals, cards, or custom grids in the Storefront or Admin frontend apps.
|
|
|
|
## 3. Preconditions
|
|
* Components folder `src/components/` must be accessible.
|
|
* Ensure no primitive Shadcn UI or design layout satisfies the need before creating custom files.
|
|
|
|
## 4. Step-by-Step Checklist
|
|
1. Check existing UI libraries to prevent duplication.
|
|
2. Create directory `src/components/ComponentName/`.
|
|
3. Create primary component file `ComponentName.tsx` and barrel exporter `index.ts`.
|
|
4. Define props interface using naming `{ComponentName}Props` and document non-obvious fields with JSDoc.
|
|
5. Destructure properties in the function signature.
|
|
6. Style components using design token variables; avoid inline styling or raw hex codes.
|
|
7. Export via barrel indexes.
|
|
|
|
## 5. Validation Checklist
|
|
* Component passes TypeScript compiler checks.
|
|
* Component is responsive and tested on desktop/mobile viewports.
|
|
* No hardcoded static pixel heights or color hex codes inside CSS/style attributes.
|
|
|
|
## 6. Examples
|
|
```tsx
|
|
/**
|
|
* ProductBadge — Renders small promotional tags (e.g. HOT, SALE)
|
|
* Used in: ProductCard, ProductGrid
|
|
*/
|
|
import React from 'react';
|
|
|
|
interface ProductBadgeProps {
|
|
/** Label text displayed on the badge */
|
|
label: string;
|
|
}
|
|
|
|
export const ProductBadge: React.FC<ProductBadgeProps> = ({ label }: ProductBadgeProps) => {
|
|
return <span className="bg-primary text-white px-2 py-1 rounded text-xs font-bold">{label}</span>;
|
|
};
|
|
```
|
|
|
|
## 7. Failure Cases
|
|
* Creating large, non-modular files that mix state logic, network fetching, and visual display elements.
|
|
* Using inline `style={{ color: '#ff0000' }}` which bypasses the standard CSS theme engines.
|