All files / features/staff/components DonorInfoForm.tsx

100% Statements 5/5
100% Branches 0/0
100% Functions 3/3
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84                          1x             4x 4x                                   1x                                                         1x                              
import { Input } from '@core/components/ui/input'
import { Label } from '@core/components/ui/label'
import { User, Mail } from 'lucide-react'
import { useTranslation } from 'react-i18next'
 
interface DonorInfoFormProps {
    name: string
    email: string
    onNameChange: (val: string) => void
    onEmailChange: (val: string) => void
    disabled?: boolean
}
 
export const DonorInfoForm = ({
    name,
    email,
    onNameChange,
    onEmailChange,
    disabled,
}: DonorInfoFormProps) => {
    const { t } = useTranslation('common')
    return (
        <div className="px-4 py-2 space-y-3 w-full max-w-sm mx-auto mb-2">
            <div className="space-y-1">
                <Label
                    htmlFor="donor-name"
                    className="text-xs ml-1"
                    style={{ color: 'var(--staff-label-color)' }}
                >
                    {t('staff.donor.name_label')}
                </Label>
                <div className="relative">
                    <User
                        className="absolute left-3 top-2.5 h-4 w-4"
                        style={{ color: 'var(--staff-input-text)' }}
                    />
                    <Input
                        id="donor-name"
                        value={name}
                        onChange={(e) => onNameChange(e.target.value)}
                        placeholder={t('staff.donor.name_placeholder')}
                        className="pl-9 h-9 placeholder-[var(--staff-input-placeholder)] placeholder-opacity-60"
                        style={{
                            backgroundColor: 'var(--staff-input-bg)',
                            color: 'var(--staff-input-text)',
                            borderColor: 'var(--staff-input-border)',
                        }}
                        disabled={disabled}
                    />
                </div>
            </div>
            <div className="space-y-1">
                <Label
                    htmlFor="donor-email"
                    className="text-xs ml-1"
                    style={{ color: 'var(--staff-label-color)' }}
                >
                    {t('staff.donor.email_label')}
                </Label>
                <div className="relative">
                    <Mail
                        className="absolute left-3 top-2.5 h-4 w-4"
                        style={{ color: 'var(--staff-input-text)' }}
                    />
                    <Input
                        id="donor-email"
                        type="email"
                        value={email}
                        onChange={(e) => onEmailChange(e.target.value)}
                        placeholder={t('staff.donor.email_placeholder')}
                        className="pl-9 h-9 placeholder-[var(--staff-input-placeholder)] placeholder-opacity-60"
                        style={{
                            backgroundColor: 'var(--staff-input-bg)',
                            color: 'var(--staff-input-text)',
                            borderColor: 'var(--staff-input-border)',
                        }}
                        disabled={disabled}
                    />
                </div>
            </div>
        </div>
    )
}