feat(ui): refine homepage and improve core interactions

This commit is contained in:
2026-11-03 18:30:13 +05:30
parent 561718870b
commit f9c98a87b4
3 changed files with 71 additions and 102 deletions
+16
View File
@@ -61,6 +61,12 @@ export function TryItWidget({
const handleFileChange = (file: File) => {
const maxMB = tool.tryIt?.limits?.maxMB || 12;
const acceptedTypes = ['image/jpeg', 'image/png', 'image/webp'];
if (!acceptedTypes.includes(file.type)) {
setStatus('error');
setErrorMessage('Choose a JPG, PNG, or WebP image.');
return;
}
if (file.size > maxMB * 1024 * 1024) {
setStatus('error');
setErrorMessage(`File exceeds ${maxMB}MB limit.`);
@@ -210,6 +216,15 @@ export function TryItWidget({
}}
onDragLeave={() => setIsDragOver(false)}
onClick={() => fileInputRef.current?.click()}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
fileInputRef.current?.click();
}
}}
role="button"
tabIndex={0}
aria-label="Choose a JPG, PNG, or WebP photo to edit"
className={`border-2 border-dashed rounded-3xl p-8 sm:p-14 text-center cursor-pointer transition-all duration-300 group ${
isDragOver
? 'border-blue-500 bg-blue-50/50 scale-[1.01]'
@@ -220,6 +235,7 @@ export function TryItWidget({
ref={fileInputRef}
type="file"
accept="image/jpeg,image/png,image/webp"
accept="image/jpeg,image/png,image/webp"
className="hidden"
onChange={(e) => e.target.files?.[0] && handleFileChange(e.target.files[0])}
/>