feat: place tool comparison and upload side-by-side intelligently across desktop, tablet, and mobile

This commit is contained in:
2026-11-04 12:06:23 +05:30
parent 6a0bb61c05
commit 5999b05c16
3 changed files with 152 additions and 30 deletions
+17
View File
@@ -13,6 +13,7 @@ import {
Image as ImageIcon,
Zap,
ChevronRight,
SlidersHorizontal,
} from 'lucide-react';
import { ToolItem, AppItem, VariantSpec, resolveLocalised } from '@/types';
import { BeforeAfterSlider } from '../ui/BeforeAfterSlider';
@@ -24,6 +25,7 @@ interface TryItWidgetProps {
variants?: VariantSpec[];
locale?: string;
className?: string;
onSwitchToCompare?: () => void;
}
export function TryItWidget({
@@ -32,6 +34,7 @@ export function TryItWidget({
variants = [],
locale = 'en',
className = '',
onSwitchToCompare,
}: TryItWidgetProps) {
const [selectedFile, setSelectedFile] = useState<File | null>(null);
const [previewUrl, setPreviewUrl] = useState<string | null>(null);
@@ -259,6 +262,20 @@ export function TryItWidget({
))}
</div>
</div>
{/* Mobile Link to Preview Comparison */}
{onSwitchToCompare && (
<div className="pt-2 md:hidden">
<button
type="button"
onClick={onSwitchToCompare}
className="w-full py-2.5 px-3 rounded-xl text-xs font-semibold text-slate-600 bg-slate-50 hover:bg-slate-100 border border-slate-200 flex items-center justify-center gap-2 transition-colors"
>
<SlidersHorizontal className="w-3.5 h-3.5 text-blue-600" />
<span>View Model Transformation Preview</span>
</button>
</div>
)}
</div>
)}