All files / src/components/profile BusinessTypeSection.tsx

100% Statements 5/5
100% Branches 0/0
100% Functions 5/5
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                                                    12x                                       1x         33x                               33x 28x                    
import {
	Card,
	CardContent,
	CardHeader,
	CardTitle,
	CardDescription,
} from "../ui/card";
import { MultiSelect } from "../ui/multi-select";
import { Briefcase } from "lucide-react";
import type { BusinessType } from "../../lib/api";
 
interface BusinessTypeSectionProps {
	businessTypeId: string;
	setBusinessTypeId: (value: string) => void;
	businessTypesSecondary: string[];
	setBusinessTypesSecondary: (value: string[]) => void;
	businessTypes: BusinessType[];
}
 
export function BusinessTypeSection({
	businessTypeId,
	setBusinessTypeId,
	businessTypesSecondary,
	setBusinessTypesSecondary,
	businessTypes,
}: BusinessTypeSectionProps) {
	return (
		<Card>
			<CardHeader>
				<CardTitle className="flex items-center gap-2">
					<Briefcase className="h-5 w-5" />
					What You Do
				</CardTitle>
				<CardDescription>Your primary and additional professions</CardDescription>
			</CardHeader>
			<CardContent className="space-y-4">
				<div className="space-y-2">
					<label
						htmlFor="business-type"
						className="text-sm font-medium text-foreground-default"
					>
						Primary Profession
					</label>
					<select
						id="business-type"
						value={businessTypeId}
						onChange={(e) => setBusinessTypeId(e.target.value)}
						className="flex h-10 w-full rounded-md border border-border-default bg-background-elevated px-3 py-2 text-sm text-foreground-default focus:outline-none focus:ring-2 focus:ring-primary-500/40 focus:border-primary-500"
					>
						<option value="">Select business type</option>
						{businessTypes.map((type) => (
							<option key={type.id} value={type.id}>
								{type.name}
							</option>
						))}
					</select>
				</div>
				<div className="space-y-2">
					<label
						htmlFor="secondary-business-types"
						className="text-sm font-medium text-foreground-default"
					>
						Also Do
					</label>
					<MultiSelect
						id="secondary-business-types"
						options={businessTypes
							.filter((t) => t.id !== businessTypeId)
							.map((t) => ({ value: t.id, label: t.name }))}
						selected={businessTypesSecondary}
						onChange={setBusinessTypesSecondary}
						placeholder="Select additional types"
					/>
				</div>
			</CardContent>
		</Card>
	);
}