import React, { useState } from 'react'; const App = () => { const [pages, setPages] = useState(20); const [size, setSize] = useState('15x20'); const [cover, setCover] = useState('soft'); const [paper, setPaper] = useState('matte'); const [binding, setBinding] = useState('saddle'); const [quantity, setQuantity] = useState(1); const pricePerPage = { '15x20': { matte: 150, glossy: 180 }, '20x20': { matte: 200, glossy: 230 }, '20x30': { matte: 250, glossy: 280 }, '30x30': { matte: 300, glossy: 330 } }; const coverPrices = { soft: 800, hard: 1500 }; const bindingPrices = { saddle: 500, perfect: 800 }; const calculatePrice = () => { const basePrice = (pricePerPage[size][paper] * pages) / 2; const coverPrice = coverPrices[cover]; const bindingPrice = bindingPrices[binding]; const totalPrice = basePrice + coverPrice + bindingPrice; return Math.round(totalPrice * quantity); }; const formatPrice = (price) => { return price.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ") + " ₽"; }; const ShareIcon = () => ( ); const PrintIcon = () => ( ); const DownloadIcon = () => ( ); return (
{/* Header */}

Калькулятор фотокниг

Рассчитайте стоимость вашей фотокниги онлайн

{/* Calculator Form */}

Настройки фотокниги

{/* Pages */}
setPages(parseInt(e.target.value))} className="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer slider" />
20 страниц 100 страниц
{/* Size */}
{['15x20', '20x20', '20x30', '30x30'].map((sizeOption) => ( ))}
{/* Cover */}
{[ { value: 'soft', label: 'Мягкая', price: '800 ₽' }, { value: 'hard', label: 'Жесткая', price: '1500 ₽' } ].map((option) => ( ))}
{/* Paper */}
{[ { value: 'matte', label: 'Матовая', description: 'Без бликов, классический вид' }, { value: 'glossy', label: 'Глянцевая', description: 'Яркие цвета, блестящая поверхность' } ].map((option) => ( ))}
{/* Binding */}
{[ { value: 'saddle', label: 'Клеевый', price: '500 ₽', description: 'Надежно, доступно' }, { value: 'perfect', label: 'Скоба', price: '800 ₽', description: 'Профессионально, долговечно' } ].map((option) => ( ))}
{/* Quantity */}
{quantity}
{/* Price Summary */}
{/* Preview */}

Визуализация

{size}
{cover === 'soft' ? 'Мягкая обложка' : 'Жесткая обложка'}
{pages} страниц
{paper === 'matte' ? 'Матовая бумага' : 'Глянцевая бумага'}
{/* Price Breakdown */}

Стоимость

Печать страниц {formatPrice(Math.round((pricePerPage[size][paper] * pages) / 2))}
Обложка {formatPrice(coverPrices[cover])}
Переплет {formatPrice(bindingPrices[binding])}
Количество ({quantity} шт) ×{quantity}
Итоговая стоимость
{formatPrice(calculatePrice())}
за 1 штуку
{formatPrice(calculatePrice() / quantity)}
{/* Features */}

Наши преимущества

{[ { title: "Качественные материалы", description: "Используем только проверенные материалы от ведущих производителей для долговечности и яркости цветов", icon: "????️" }, { title: "Быстрое производство", description: "Готовая фотокнига уже через 3-5 рабочих дней после подтверждения макета", icon: "⚡" }, { title: "Гарантия качества", description: "Каждая фотокнига проходит тщательную проверку перед отправкой клиенту", icon: "✅" } ].map((feature, index) => (
{feature.icon}

{feature.title}

{feature.description}

))}
); }; export default App;