feat: add StickerWallThumbnail component for clickable sticker wall previews
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
39
frontend/src/components/StickerWallThumbnail.jsx
Normal file
39
frontend/src/components/StickerWallThumbnail.jsx
Normal file
@@ -0,0 +1,39 @@
|
||||
import React from 'react';
|
||||
|
||||
function StickerWallThumbnail({ imageUrl, loading, error, onClick }) {
|
||||
const baseClasses = 'rounded-lg border border-gray-300 dark:border-gray-600 overflow-hidden flex items-center justify-center bg-gray-100 dark:bg-gray-700/50 flex-shrink-0';
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<div className={`${baseClasses} w-[142px] h-[80px]`}>
|
||||
<svg className="animate-spin h-5 w-5 text-gray-400" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
||||
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4" />
|
||||
<path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" />
|
||||
</svg>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (error || !imageUrl) {
|
||||
return (
|
||||
<div className={`${baseClasses} w-[142px] h-[80px]`}>
|
||||
<span className="text-xs text-gray-400 dark:text-gray-500 text-center px-2">No stickers</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<button
|
||||
onClick={onClick}
|
||||
className={`${baseClasses} w-[142px] h-[80px] cursor-pointer hover:border-indigo-400 dark:hover:border-indigo-500 transition group`}
|
||||
>
|
||||
<img
|
||||
src={imageUrl}
|
||||
alt="Sticker Wall Preview"
|
||||
className="w-full h-full object-cover group-hover:opacity-90 transition"
|
||||
/>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
export default StickerWallThumbnail;
|
||||
Reference in New Issue
Block a user