feat(frontend): create reusable components for Phase 1 refactoring

- Add Alert component with 4 variants (success/error/warning/info)
- Add LoadingSpinner and LoadingButton components
- Add FormInput and FormSelect components with icon support
- Add Modal and ConfirmationModal components
- Add ChatMessage, ChatMessageList, and ChatInput components
- Add EventCard component

These components will eliminate ~450 lines of duplicated code across pages.
Part of Phase 1 (Quick Wins) frontend refactoring.
This commit is contained in:
Radosław Gierwiało
2025-11-20 23:22:05 +01:00
parent c1b5ae2ad3
commit 1772fc522e
11 changed files with 704 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
import { Loader2 } from 'lucide-react';
/**
* Reusable Button component with built-in loading state
*
* @param {boolean} loading - Shows loading spinner when true
* @param {React.ReactNode} children - Button content when not loading
* @param {string} loadingText - Text to show when loading (default: "Loading...")
* @param {string} className - Additional CSS classes
* @param {object} ...props - All other button props (onClick, disabled, etc.)
*/
const LoadingButton = ({
loading = false,
children,
loadingText = 'Loading...',
className = '',
...props
}) => {
return (
<button
{...props}
disabled={loading || props.disabled}
className={className}
>
{loading ? (
<>
<Loader2 className="w-5 h-5 animate-spin inline mr-2" />
{loadingText}
</>
) : (
children
)}
</button>
);
};
export default LoadingButton;