Use a consistent approach when working with components to improve code maintainability and ensure visual coherence throughout the application: 1. **Reuse existing components** rather than creating new ones for similar functionality.
Use a consistent approach when working with components to improve code maintainability and ensure visual coherence throughout the application:
// Good: Using the existing ContentLayout component
<ContentLayout title="Configure Chatbot" icon="lucide:settings">
{/* Content here */}
</ContentLayout>
// Avoid: Creating new custom layouts for similar purposes
// Good: Using standard props for styling
<CustomLink
path="/manage-groups"
ariaLabel="Manage Groups"
variant="dashed"
color="secondary"
/>
// Avoid: Adding custom classes that override the component's design system
<CustomLink
path="/manage-groups"
className="rounded-md px-4 py-2 !font-bold hover:border-solid hover:bg-default-100"
/>
// Good: Create shared helpers for reusable functionality
// In a helper file:
export const PermissionIcon = ({ enabled }: { enabled: boolean }) => (
// Icon implementation
);
// Then import in multiple components:
import { PermissionIcon } from "@/helpers/permission-helpers";
// Good: Separate components for different HTML elements
<CustomInput type="text" {...props} />
<CustomTextArea {...props} />
// Avoid: Conditionally rendering different elements within one component
<CustomInput type={type === "textarea" ? "textarea" : "text"} {...props} />
Following these principles ensures consistent UI patterns, reduces technical debt, and makes the codebase easier to maintain as it grows.
Enter the URL of a public GitHub repository