import React, { useState } from 'react';
import { Card, CardContent } from '@/components/ui/card';
import { Button } from '@/components/ui/button';
export default function RoofCostEstimator() {
const [size, setSize] = useState('');
const [material, setMaterial] = useState('shingles');
const [features, setFeatures] = useState({ gutters: false, insulation: false });
const [estimate, setEstimate] = useState(null);
const materialCosts = {
shingles: 5,
metal: 10,
tile: 15,
};
const handleEstimate = () => {
const baseCost = parseFloat(size) * (materialCosts[material] || 0);
const extraCost =
(features.gutters ? 500 : 0) +
(features.insulation ? 1000 : 0);
setEstimate(baseCost + extraCost);
};
return (
Roof Cost Estimator
setSize(e.target.value)}
className="w-full p-2 rounded"
/>
{estimate !== null && (
Estimated Cost: ${estimate.toFixed(2)}
)}
);
}