--- description: Creates a new reusable component following ReloPortal component creation guidelines --- ## Create Reusable Component This workflow creates a new reusable component in `src/components/` following the ReloPortal component creation standards. ### Steps 1. **Verify component doesn't already exist** - Query Graphify: `uvx --from graphifyy graphify query "where is ComponentName used or similar components"` - Search `src/components/` for similar components - Check AntD components first - use AntD if it meets the need - Only create if no existing reusable component or AntD alternative 2. **Determine component location** - Create folder: `src/components/ComponentName/` - Main file: `ComponentName.tsx` - Index file: `index.ts` (barrel export) - Optional: `ComponentName.scss` if custom styles needed - Optional: `ComponentName.types.ts` if complex types needed 3. **Create component file structure** **ComponentName.tsx:** ```tsx /** * Brief description of what this component renders and where it's used */ import React from "react"; interface ComponentNameProps { /** Prop description if not obvious */ someProp: string; } export const ComponentName: React.FC = ({ someProp, }: ComponentNameProps) => { return
{/* Component JSX */}
; }; ``` **index.ts:** ```tsx export { ComponentName } from "./ComponentName"; ``` 4. **Add JSDoc comments** - Add JSDoc to the exported component describing what it renders - Add JSDoc to non-obvious props in the interface 5. **Style the component** - Check `src/styles/common.scss` for utility classes first - If utilities insufficient, create `ComponentName.scss` with BEM naming - Use colors from `src/styles/colors.scss` - never hex codes - No inline `style={{}}` with static values 6. **Export through barrel** - Add to appropriate barrel export in `src/components/` if needed - Import via `import { ComponentName } from "src/components/ComponentName"` ### Checklist - [ ] Searched existing components and AntD first - [ ] Used interface for props (named `{ComponentName}Props`) - [ ] Added JSDoc to component and non-obvious props - [ ] Destructured props in function signature - [ ] Used utility classes from `common.scss` before custom SCSS - [ ] All colors from `colors.scss` variables - [ ] No inline styles with static values - [ ] Created `index.ts` barrel export - [ ] Functional component (no class components)