import { useState } from 'react'; import { STICKERS, STICKER_CATEGORIES } from '../../constants/stickers'; export function StickersTab({ onAddSticker }) { const [activeCategory, setActiveCategory] = useState('all'); const categories = ['all', ...STICKER_CATEGORIES]; const filteredStickers = activeCategory === 'all' ? STICKERS : STICKERS.filter(s => s.category === activeCategory); const handleAddSticker = (emoji) => { // Create a canvas element with the emoji const canvas = document.createElement('canvas'); const size = 100; canvas.width = size; canvas.height = size; const ctx = canvas.getContext('2d'); ctx.font = `${size * 0.8}px Arial`; ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; ctx.fillText(emoji, size / 2, size / 2); const dataUrl = canvas.toDataURL('image/png'); onAddSticker({ type: 'sticker', x: 125, y: 125, width: 80, height: 80, rotation: 0, src: dataUrl, emoji, }); }; return (

Stickers

{/* Category pills */}
{categories.map((cat) => ( ))}
{/* Sticker grid */}
{filteredStickers.map((sticker, index) => ( ))}
); }