import React, { ReactNode, useState } from 'react'; import { ChevronDown, Globe, Zap, DollarSign, User, Link, Mail, Coins, RotateCcw, Send, RefreshCw } from 'lucide-react'; export const baseUIBoxClasses = "w-full rounded-lg font-medium transition-colors flex items-center justify-center gap-2"; export interface ButtonProps extends React.ButtonHTMLAttributes { children: ReactNode; variant?: 'primary' | 'secondary' | 'tertiary'; isLoading?: boolean; className?: string; action?: React.ReactNode; } export const Button = ({ children, action, variant = 'primary', className = '', isLoading = false, ...props }: ButtonProps) => { const baseClasses = `${baseUIBoxClasses} cursor-pointer py-4 px-5`; const variants = { primary: "bg-yellow-400 text-black hover:bg-yellow-500", secondary: "bg-blue-700 text-white hover:bg-blue-600", tertiary: "bg-gray-700 text-white hover:bg-gray-600", }; return ( ); }; export interface DropdownOption { id: string; name: string; icon: ReactNode; color: string; textColor: string; } export interface DropdownProps { options: DropdownOption[]; selectedId: string; onSelect: (option: DropdownOption) => void; placeholder?: string; } type IconName = 'Zap' | 'DollarSign' | 'User' | 'Link' | 'Globe' | 'Mail' | 'Coins' | 'ChevronDown' | 'RotateCcw' | 'Send'; const iconMap: Record = { Zap, DollarSign, User, Link, Globe, Mail, Coins, ChevronDown, RotateCcw, Send }; export const getIcon = (IconName: ReactNode): ReactNode => { if (typeof IconName == 'string') { if (IconName.startsWith(' : ; } } return IconName } export const renderIcon = (option?: DropdownOption): ReactNode => { const icon = option ? getIcon(option.icon) : ; const className = "w-8 h-8 rounded-full flex items-center justify-center"; const style = { backgroundColor: option?.color || '#374151' }; if (typeof icon == 'string') { return
; } return
{icon}
} export const Dropdown = ({ options, selectedId, onSelect, placeholder = "Select an option" }: DropdownProps) => { const [isOpen, setIsOpen] = useState(false); const selectedOption = options.find(option => option.id === selectedId); const toggleDropdown = () => setIsOpen(!isOpen); const handleSelect = (option: DropdownOption) => { onSelect(option); setIsOpen(false); }; return (
{renderIcon(selectedOption)} {selectedOption?.name || placeholder}
{ isOpen && (
{options.map((option) => { return (
handleSelect(option)} > {renderIcon(option)} {option.name}
); })}
) }
); }; export interface FieldProps { label: string; children: React.ReactNode; subtitle?: string; } export const Field = ({ label, children, subtitle }: FieldProps) => (

{label}

{children} {subtitle &&

{subtitle}

}
); export interface InputFieldProps extends React.InputHTMLAttributes { icon: { bg?: string; content: React.ReactNode; }; action?: React.ReactNode; } export const InputField = ({ icon, action, ...inputProps }: InputFieldProps) => (
{icon.content}
{action && ( )}
); export function LoadingSpinner() { // get an icons with spin animation return }