diff --git a/src/app/calculator/page.tsx b/src/app/calculator/page.tsx new file mode 100644 index 0000000..37faabf --- /dev/null +++ b/src/app/calculator/page.tsx @@ -0,0 +1,145 @@ +"use client"; + +import { useState, useCallback } from 'react'; +import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider"; +import NavbarLayoutFloatingInline from "@/components/navbar/NavbarLayoutFloatingInline"; +import FooterBaseReveal from "@/components/sections/footer/FooterBaseReveal"; +import { Sparkles, Droplets, Zap } from 'lucide-react'; + +export default function CalculatorPage() { + const [squareMeters, setSquareMeters] = useState(''); + const [cleaningType, setCleaningType] = useState<'standard' | 'premium' | 'express'>('standard'); + const [result, setResult] = useState(null); + + const pricesPerSqMeter = { + standard: 2500, + premium: 4500, + express: 3500, + }; + + const calculateCost = useCallback(() => { + const area = parseFloat(squareMeters); + if (isNaN(area) || area <= 0) { + setResult(null); + alert('Пожалуйста, введите корректную площадь в квадратных метрах.'); + return; + } + + const cost = area * pricesPerSqMeter[cleaningType]; + setResult(cost); + }, [squareMeters, cleaningType]); + + return ( + + + +
+
+

Калькулятор стоимости чистки ковров

+

Рассчитайте примерную стоимость вашей чистки

+ +
+
+ + setSquareMeters(e.target.value)} + placeholder="Введите площадь" + className="w-full p-3 border border-gray-300 rounded-lg text-lg" + /> +
+ +
+ + +
+
+ + + + {result !== null && ( +
+

Примерная стоимость:

+

{result.toLocaleString()}₸

+

*Окончательная стоимость будет уточнена после осмотра ковра.

+
+ )} +
+
+ + +
+ ); +} \ No newline at end of file