Download index.html from Sheld0ne/postly: direct link, hf CLI and curl.
- Browser
- Download file 39.2 kB
-
https://huggingface.co/spaces/Sheld0ne/postly/resolve/main/index.html
- Command line
-
hf download hf://spaces/Sheld0ne/postly/index.html
-
curl -L -o index.html https://huggingface.co/spaces/Sheld0ne/postly/resolve/main/index.html
39.2 kB
| <html lang="fr"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Tableau d'Annonces - Petites annonces locales</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <script src="https://unpkg.com/react@18/umd/react.development.js"></script> | |
| <script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script> | |
| <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script> | |
| <style> | |
| @import url('https://fonts.googleapis.com/css2?family=Comic+Neue:wght@400;700&display=swap'); | |
| body { | |
| font-family: 'Comic Neue', cursive; | |
| background-color: #f5f5f5; | |
| } | |
| .cork-board { | |
| background-image: url('data:image/svg+xml;utf8,<svg width="100" height="100" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><rect width="100" height="100" fill="%23b08968" /><circle cx="20" cy="20" r="5" fill="%239c6e54" /><circle cx="60" cy="30" r="7" fill="%239c6e54" /><circle cx="40" cy="60" r="6" fill="%239c6e54" /><circle cx="70" cy="70" r="4" fill="%239c6e54" /><circle cx="30" cy="80" r="5" fill="%239c6e54" /></svg>'); | |
| background-size: 50px 50px; | |
| min-height: 100vh; | |
| border: 15px solid #8B5A2B; | |
| border-image: url('data:image/svg+xml;utf8,<svg width="100" height="100" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><rect width="100" height="100" fill="%238B5A2B" /><path d="M0,20 Q25,10 50,20 T100,20 L100,30 Q75,40 50,30 T0,30 Z" fill="%23A67C52" /><path d="M0,50 Q25,40 50,50 T100,50 L100,60 Q75,70 50,60 T0,60 Z" fill="%23A67C52" /><path d="M0,80 Q25,70 50,80 T100,80 L100,90 Q75,100 50,90 T0,90 Z" fill="%23A67C52" />') 30 round; | |
| box-shadow: 0 0 30px rgba(0,0,0,0.5), inset 0 0 20px rgba(0,0,0,0.3); | |
| } | |
| .post-it { | |
| box-shadow: 2px 2px 5px rgba(0,0,0,0.5), 0 0 2px rgba(0,0,0,0.3); | |
| transform: rotate(-1deg); | |
| transition: all 0.3s ease; | |
| position: relative; | |
| } | |
| .post-it:hover { | |
| transform: rotate(0deg) scale(1.05); | |
| box-shadow: 8px 8px 10px rgba(0,0,0,0.4); | |
| } | |
| .post-it-animation { | |
| animation: appear 0.5s ease-out; | |
| } | |
| @keyframes appear { | |
| from { | |
| opacity: 0; | |
| transform: translateY(20px) rotate(-5deg); | |
| } | |
| to { | |
| opacity: 1; | |
| transform: translateY(0) rotate(-1deg); | |
| } | |
| } | |
| .pin { | |
| width: 20px; | |
| height: 20px; | |
| background: radial-gradient(circle at 30% 30%, #fff, #aaa 40%, #333 70%); | |
| border-radius: 50%; | |
| box-shadow: 0 0 5px rgba(0,0,0,0.5); | |
| position: absolute; | |
| top: -10px; | |
| left: 50%; | |
| transform: translateX(-50%); | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div id="root"></div> | |
| <script type="text/babel"> | |
| const { useState, useEffect } = React; | |
| // Simulate API calls | |
| const mockApi = { | |
| login: async (email, password) => { | |
| return { success: true, token: 'mock-token', user: { id: 1, name: 'Test User', email } }; | |
| }, | |
| register: async (name, email, password, city) => { | |
| return { success: true, user: { id: 2, name, email, city } }; | |
| }, | |
| getAds: async () => { | |
| return [ | |
| { | |
| id: 1, | |
| title: "Vélo à vendre", | |
| description: "Vélo de ville en bon état, taille M", | |
| phone: "0612345678", | |
| city: "Maurepas", | |
| author: "Jean Dupont", | |
| likes: 5, | |
| price: 120, | |
| comments: [ | |
| { id: 1, author: "Marie", text: "Est-il encore disponible ?" }, | |
| { id: 2, author: "Jean", text: "Oui, toujours disponible !" } | |
| ], | |
| color: "yellow" | |
| }, | |
| { | |
| id: 2, | |
| title: "Cours de piano", | |
| description: "Donne cours de piano pour débutants", | |
| phone: "0698765432", | |
| city: "Maurepas", | |
| author: "Sophie Martin", | |
| likes: 3, | |
| price: 25, | |
| comments: [], | |
| color: "pink" | |
| }, | |
| { | |
| id: 3, | |
| title: "Cherche baby-sitter", | |
| description: "Recherche baby-sitter pour nos enfants 2 soirs par semaine", | |
| phone: "0601020304", | |
| city: "Elancourt", | |
| author: "Thomas Leroy", | |
| likes: 2, | |
| comments: [], | |
| color: "blue" | |
| } | |
| ]; | |
| }, | |
| createAd: async (adData) => { | |
| return { | |
| success: true, | |
| ad: { | |
| ...adData, | |
| id: Math.floor(Math.random() * 1000), | |
| likes: 0, | |
| comments: [], | |
| photo: adData.photo || null | |
| } | |
| }; | |
| }, | |
| likeAd: async (adId) => { | |
| return { success: true }; | |
| }, | |
| addComment: async (adId, comment) => { | |
| return { success: true, comment: { id: Math.floor(Math.random() * 1000), author: "Current User", text: comment } }; | |
| } | |
| }; | |
| const App = () => { | |
| const [user, setUser] = useState(null); | |
| const [ads, setAds] = useState([]); | |
| const [selectedCity, setSelectedCity] = useState("Maurepas"); | |
| const [showLogin, setShowLogin] = useState(false); | |
| const [showRegister, setShowRegister] = useState(false); | |
| const [showAdForm, setShowAdForm] = useState(false); | |
| const [cities, setCities] = useState(["Maurepas", "Elancourt", "Trappes", "Montigny", "Guyancourt"]); | |
| useEffect(() => { | |
| // Simulate loading all ads | |
| const loadAds = async () => { | |
| const data = await mockApi.getAds(); | |
| setAds(data); | |
| }; | |
| loadAds(); | |
| }, []); | |
| const handleLogin = async (email, password) => { | |
| const result = await mockApi.login(email, password); | |
| if (result.success) { | |
| setUser(result.user); | |
| setShowLogin(false); | |
| } | |
| }; | |
| const handleRegister = async (name, email, password, city) => { | |
| const result = await mockApi.register(name, email, password, city); | |
| if (result.success) { | |
| setUser(result.user); | |
| setShowRegister(false); | |
| setSelectedCity(city); | |
| } | |
| }; | |
| const handleCreateAd = async (title, description, phone, city, color, price, photo) => { | |
| // Ajouter la nouvelle ville si elle n'existe pas déjà | |
| const newCity = city.trim(); | |
| if (newCity && !cities.includes(newCity)) { | |
| setCities([...cities, newCity]); | |
| } | |
| const result = await mockApi.createAd({ | |
| title, | |
| description, | |
| phone, | |
| city: newCity, | |
| author: user.name, | |
| color, | |
| price: price === "" ? null : Number(price), | |
| photo: photo ? URL.createObjectURL(photo) : null | |
| }); | |
| if (result.success) { | |
| setAds([result.ad, ...ads]); | |
| setShowAdForm(false); | |
| } | |
| }; | |
| const handleLike = async (adId) => { | |
| if (!user) { | |
| setShowLogin(true); | |
| return; | |
| } | |
| await mockApi.likeAd(adId); | |
| setAds(ads.map(ad => | |
| ad.id === adId ? { ...ad, likes: ad.likes + 1 } : ad | |
| )); | |
| }; | |
| const handleAddComment = async (adId, comment) => { | |
| if (!user) { | |
| setShowLogin(true); | |
| return; | |
| } | |
| const result = await mockApi.addComment(adId, comment); | |
| if (result.success) { | |
| setAds(ads.map(ad => | |
| ad.id === adId ? { ...ad, comments: [...ad.comments, result.comment] } : ad | |
| )); | |
| } | |
| }; | |
| return ( | |
| <div className="min-h-screen"> | |
| {/* Header */} | |
| <header className="bg-gray-700 text-white shadow-md" style={{ | |
| background: 'linear-gradient(135deg, #4b5563 0%, #6b7280 50%, #4b5563 100%)', | |
| borderBottom: '1px solid #9ca3af' | |
| }}> | |
| <div className="container mx-auto px-4 py-3 flex justify-between items-center"> | |
| <h1 className="text-2xl font-bold">Tableau d'Annonces</h1> | |
| <div className="flex items-center space-x-4"> | |
| <select | |
| value={selectedCity} | |
| onChange={(e) => setSelectedCity(e.target.value)} | |
| className="bg-amber-600 hover:bg-amber-500 text-white px-3 py-1 rounded-md transition-colors" | |
| > | |
| {cities.map(city => ( | |
| <option key={city} value={city}>{city}</option> | |
| ))} | |
| </select> | |
| {user ? ( | |
| <div className="flex items-center space-x-2"> | |
| <span>Bonjour, {user.name}</span> | |
| <button | |
| onClick={() => setShowAdForm(true)} | |
| className="bg-amber-600 hover:bg-amber-500 px-3 py-1 rounded-md" | |
| > | |
| Nouvelle annonce | |
| </button> | |
| </div> | |
| ) : ( | |
| <div className="flex space-x-2"> | |
| <button | |
| onClick={() => setShowLogin(true)} | |
| className="bg-gray-600 hover:bg-gray-500 px-3 py-1 rounded-md transition-colors" | |
| > | |
| Connexion | |
| </button> | |
| <button | |
| onClick={() => setShowRegister(true)} | |
| className="bg-gray-500 hover:bg-gray-400 px-3 py-1 rounded-md transition-colors" | |
| > | |
| Inscription | |
| </button> | |
| </div> | |
| )} | |
| </div> | |
| </div> | |
| </header> | |
| {/* Main content */} | |
| <main className="cork-board"> | |
| <div className="container mx-auto px-4 pt-4 pb-8"> | |
| <div className="mb-8"> | |
| <h2 className="text-xl font-semibold mb-4 text-amber-900">Annonces - {selectedCity}</h2> | |
| <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"> | |
| {ads | |
| .filter(ad => ad.city === selectedCity) | |
| .map(ad => ( | |
| <PostIt | |
| key={ad.id} | |
| ad={ad} | |
| onLike={handleLike} | |
| onAddComment={handleAddComment} | |
| isLoggedIn={!!user} | |
| /> | |
| ))} | |
| </div> | |
| </div> | |
| </div> | |
| </main> | |
| {/* Modals */} | |
| {showLogin && ( | |
| <LoginModal | |
| onClose={() => setShowLogin(false)} | |
| onLogin={handleLogin} | |
| onSwitchToRegister={() => { | |
| setShowLogin(false); | |
| setShowRegister(true); | |
| }} | |
| /> | |
| )} | |
| {showRegister && ( | |
| <RegisterModal | |
| onClose={() => setShowRegister(false)} | |
| onRegister={handleRegister} | |
| cities={cities} | |
| onSwitchToLogin={() => { | |
| setShowRegister(false); | |
| setShowLogin(true); | |
| }} | |
| /> | |
| )} | |
| {showAdForm && ( | |
| <AdFormModal | |
| onClose={() => setShowAdForm(false)} | |
| onCreateAd={handleCreateAd} | |
| cities={cities} | |
| selectedCity={selectedCity} | |
| /> | |
| )} | |
| </div> | |
| ); | |
| }; | |
| const PostIt = ({ ad, onLike, onAddComment, isLoggedIn }) => { | |
| const [showComments, setShowComments] = useState(false); | |
| const [newComment, setNewComment] = useState(""); | |
| const [showPhotoModal, setShowPhotoModal] = useState(false); | |
| const bgColors = { | |
| yellow: "bg-yellow-200", | |
| pink: "bg-pink-200", | |
| blue: "bg-blue-200", | |
| green: "bg-green-200" | |
| }; | |
| return ( | |
| <div className={`post-it post-it-animation ${bgColors[ad.color]} relative p-4 rounded-md`}> | |
| <div className="pin"></div> | |
| <h3 className="font-bold text-lg mb-2">{ad.title}</h3> | |
| {ad.photo && ( | |
| <div className="mb-3 cursor-pointer" onClick={() => setShowPhotoModal(true)}> | |
| <img | |
| src={ad.photo} | |
| alt={ad.title} | |
| className="w-full h-40 object-cover rounded hover:opacity-90 transition-opacity" | |
| /> | |
| </div> | |
| )} | |
| {showPhotoModal && ( | |
| <div className="fixed inset-0 bg-black bg-opacity-90 flex items-center justify-center z-50 p-4" onClick={() => setShowPhotoModal(false)}> | |
| <div className="relative max-w-full max-h-full"> | |
| <img | |
| src={ad.photo} | |
| alt={ad.title} | |
| className="max-w-full max-h-[90vh] object-contain" | |
| /> | |
| <button | |
| className="absolute top-4 right-4 bg-black bg-opacity-50 text-white p-2 rounded-full hover:bg-opacity-70" | |
| onClick={(e) => { | |
| e.stopPropagation(); | |
| setShowPhotoModal(false); | |
| }} | |
| > | |
| <svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | |
| <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" /> | |
| </svg> | |
| </button> | |
| </div> | |
| </div> | |
| )} | |
| <p className="mb-3">{ad.description}</p> | |
| <div className="flex justify-between items-center mb-2"> | |
| <div className="text-sm text-gray-700"> | |
| <span className="font-semibold">Tél:</span> {ad.phone} | |
| </div> | |
| {ad.price ? ( | |
| <div className="text-sm font-semibold bg-amber-100 px-2 py-1 rounded"> | |
| {ad.price} € | |
| </div> | |
| ) : ( | |
| <div className="text-sm font-semibold bg-green-100 px-2 py-1 rounded text-green-800"> | |
| Contactez-moi | |
| </div> | |
| )} | |
| </div> | |
| <div className="text-xs text-gray-600 mb-3"> | |
| Publié par {ad.author} | |
| </div> | |
| <div className="flex justify-between items-center border-t border-gray-300 pt-2 mt-3"> | |
| <button | |
| onClick={() => onLike(ad.id)} | |
| className="flex items-center space-x-1 text-gray-700 hover:text-red-500" | |
| > | |
| <svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | |
| <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z" /> | |
| </svg> | |
| <span>{ad.likes}</span> | |
| </button> | |
| <button | |
| onClick={() => setShowComments(!showComments)} | |
| className="text-sm text-gray-700 hover:underline" | |
| > | |
| {ad.comments.length} commentaire{ad.comments.length !== 1 ? 's' : ''} | |
| </button> | |
| </div> | |
| {showComments && ( | |
| <div className="mt-3"> | |
| <div className="space-y-2 max-h-40 overflow-y-auto"> | |
| {ad.comments.map(comment => ( | |
| <div key={comment.id} className="bg-white bg-opacity-50 p-2 rounded"> | |
| <div className="font-semibold text-sm">{comment.author}</div> | |
| <div className="text-sm">{comment.text}</div> | |
| </div> | |
| ))} | |
| </div> | |
| {isLoggedIn && ( | |
| <div className="mt-3 flex"> | |
| <input | |
| type="text" | |
| value={newComment} | |
| onChange={(e) => setNewComment(e.target.value)} | |
| placeholder="Ajouter un commentaire..." | |
| className="flex-1 px-2 py-1 text-sm border rounded-l" | |
| /> | |
| <button | |
| onClick={() => { | |
| onAddComment(ad.id, newComment); | |
| setNewComment(""); | |
| }} | |
| className="bg-amber-600 text-white px-2 py-1 rounded-r text-sm" | |
| > | |
| Envoyer | |
| </button> | |
| </div> | |
| )} | |
| </div> | |
| )} | |
| </div> | |
| ); | |
| }; | |
| const LoginModal = ({ onClose, onLogin, onSwitchToRegister }) => { | |
| const [email, setEmail] = useState(""); | |
| const [password, setPassword] = useState(""); | |
| return ( | |
| <div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"> | |
| <div className="bg-white rounded-lg p-6 w-full max-w-md"> | |
| <div className="flex justify-between items-center mb-4"> | |
| <h3 className="text-xl font-bold">Connexion</h3> | |
| <button onClick={onClose} className="text-gray-500 hover:text-gray-700"> | |
| <svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | |
| <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" /> | |
| </svg> | |
| </button> | |
| </div> | |
| <div className="space-y-4"> | |
| <div> | |
| <label className="block text-sm font-medium text-gray-700 mb-1">Email</label> | |
| <input | |
| type="email" | |
| value={email} | |
| onChange={(e) => setEmail(e.target.value)} | |
| className="w-full px-3 py-2 border rounded-md" | |
| /> | |
| </div> | |
| <div> | |
| <label className="block text-sm font-medium text-gray-700 mb-1">Mot de passe</label> | |
| <input | |
| type="password" | |
| value={password} | |
| onChange={(e) => setPassword(e.target.value)} | |
| className="w-full px-3 py-2 border rounded-md" | |
| /> | |
| </div> | |
| <div className="flex justify-between items-center pt-2"> | |
| <button | |
| onClick={() => onLogin(email, password)} | |
| className="bg-amber-600 text-white px-4 py-2 rounded-md hover:bg-amber-500" | |
| > | |
| Se connecter | |
| </button> | |
| <button | |
| onClick={onSwitchToRegister} | |
| className="text-amber-600 hover:underline text-sm" | |
| > | |
| Pas encore inscrit ? | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| ); | |
| }; | |
| const RegisterModal = ({ onClose, onRegister, cities, onSwitchToLogin }) => { | |
| const [name, setName] = useState(""); | |
| const [email, setEmail] = useState(""); | |
| const [password, setPassword] = useState(""); | |
| const [city, setCity] = useState(cities[0]); | |
| return ( | |
| <div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"> | |
| <div className="bg-white rounded-lg p-6 w-full max-w-md"> | |
| <div className="flex justify-between items-center mb-4"> | |
| <h3 className="text-xl font-bold">Inscription</h3> | |
| <button onClick={onClose} className="text-gray-500 hover:text-gray-700"> | |
| <svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | |
| <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" /> | |
| </svg> | |
| </button> | |
| </div> | |
| <div className="space-y-4"> | |
| <div> | |
| <label className="block text-sm font-medium text-gray-700 mb-1">Nom complet</label> | |
| <input | |
| type="text" | |
| value={name} | |
| onChange={(e) => setName(e.target.value)} | |
| className="w-full px-3 py-2 border rounded-md" | |
| /> | |
| </div> | |
| <div> | |
| <label className="block text-sm font-medium text-gray-700 mb-1">Email</label> | |
| <input | |
| type="email" | |
| value={email} | |
| onChange={(e) => setEmail(e.target.value)} | |
| className="w-full px-3 py-2 border rounded-md" | |
| /> | |
| </div> | |
| <div> | |
| <label className="block text-sm font-medium text-gray-700 mb-1">Mot de passe</label> | |
| <input | |
| type="password" | |
| value={password} | |
| onChange={(e) => setPassword(e.target.value)} | |
| className="w-full px-3 py-2 border rounded-md" | |
| /> | |
| </div> | |
| <div> | |
| <label className="block text-sm font-medium text-gray-700 mb-1">Ville</label> | |
| <select | |
| value={city} | |
| onChange={(e) => setCity(e.target.value)} | |
| className="w-full px-3 py-2 border rounded-md" | |
| > | |
| {cities.map(c => ( | |
| <option key={c} value={c}>{c}</option> | |
| ))} | |
| </select> | |
| </div> | |
| <div className="flex justify-between items-center pt-2"> | |
| <button | |
| onClick={() => onRegister(name, email, password, city)} | |
| className="bg-amber-600 text-white px-4 py-2 rounded-md hover:bg-amber-500" | |
| > | |
| S'inscrire | |
| </button> | |
| <button | |
| onClick={onSwitchToLogin} | |
| className="text-amber-600 hover:underline text-sm" | |
| > | |
| Déjà un compte ? | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| ); | |
| }; | |
| const AdFormModal = ({ onClose, onCreateAd, cities, selectedCity }) => { | |
| const [title, setTitle] = useState(""); | |
| const [description, setDescription] = useState(""); | |
| const [phone, setPhone] = useState(""); | |
| const [city, setCity] = useState(""); | |
| const [color, setColor] = useState("yellow"); | |
| const [price, setPrice] = useState(null); | |
| const [photo, setPhoto] = useState(null); | |
| const [photoPreview, setPhotoPreview] = useState(null); | |
| return ( | |
| <div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"> | |
| <div className="bg-white rounded-lg p-6 w-full max-w-md"> | |
| <div className="flex justify-between items-center mb-4"> | |
| <h3 className="text-xl font-bold">Nouvelle annonce</h3> | |
| <button onClick={onClose} className="text-gray-500 hover:text-gray-700"> | |
| <svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | |
| <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" /> | |
| </svg> | |
| </button> | |
| </div> | |
| <div className="space-y-4"> | |
| <div> | |
| <label className="block text-sm font-medium text-gray-700 mb-1">Titre</label> | |
| <input | |
| type="text" | |
| value={title} | |
| onChange={(e) => setTitle(e.target.value)} | |
| className="w-full px-3 py-2 border rounded-md" | |
| /> | |
| </div> | |
| <div> | |
| <label className="block text-sm font-medium text-gray-700 mb-1">Description</label> | |
| <textarea | |
| value={description} | |
| onChange={(e) => setDescription(e.target.value)} | |
| className="w-full px-3 py-2 border rounded-md" | |
| rows="4" | |
| /> | |
| </div> | |
| <div> | |
| <label className="block text-sm font-medium text-gray-700 mb-1">Téléphone</label> | |
| <input | |
| type="tel" | |
| value={phone} | |
| onChange={(e) => setPhone(e.target.value)} | |
| className="w-full px-3 py-2 border rounded-md" | |
| /> | |
| </div> | |
| <div> | |
| <label className="block text-sm font-medium text-gray-700 mb-1">Ville</label> | |
| <input | |
| type="text" | |
| value={city} | |
| onChange={(e) => setCity(e.target.value)} | |
| className="w-full px-3 py-2 border rounded-md" | |
| /> | |
| </div> | |
| <div> | |
| <label className="block text-sm font-medium text-gray-700 mb-1">Photo</label> | |
| <input | |
| type="file" | |
| accept="image/*" | |
| onChange={(e) => { | |
| const file = e.target.files[0]; | |
| if (file) { | |
| setPhoto(file); | |
| setPhotoPreview(URL.createObjectURL(file)); | |
| } | |
| }} | |
| className="w-full px-3 py-2 border rounded-md" | |
| /> | |
| {photoPreview && ( | |
| <div className="mt-2"> | |
| <img | |
| src={photoPreview} | |
| alt="Preview" | |
| className="max-h-40 object-contain rounded" | |
| /> | |
| </div> | |
| )} | |
| </div> | |
| <div> | |
| <label className="block text-sm font-medium text-gray-700 mb-1">Couleur du Post-it</label> | |
| <div className="flex space-x-2"> | |
| {["yellow", "pink", "blue", "green"].map(c => ( | |
| <button | |
| key={c} | |
| onClick={() => setColor(c)} | |
| className={`w-8 h-8 rounded-full ${color === c ? 'ring-2 ring-offset-2 ring-amber-500' : ''}`} | |
| style={{ backgroundColor: | |
| c === "yellow" ? "#fef08a" : | |
| c === "pink" ? "#fbcfe8" : | |
| c === "blue" ? "#bfdbfe" : | |
| "#bbf7d0" | |
| }} | |
| ></button> | |
| ))} | |
| </div> | |
| </div> | |
| <div> | |
| <label className="block text-sm font-medium text-gray-700 mb-1">Type d'annonce</label> | |
| <div className="flex space-x-4"> | |
| <div className="flex items-center"> | |
| <input | |
| type="radio" | |
| id="priceOption" | |
| name="announceType" | |
| checked={price !== null} | |
| onChange={() => setPrice("")} | |
| className="mr-2" | |
| /> | |
| <label htmlFor="priceOption" className="text-sm"> | |
| Avec prix | |
| </label> | |
| {price !== null && ( | |
| <input | |
| type="number" | |
| value={price} | |
| onChange={(e) => setPrice(e.target.value)} | |
| className="ml-2 px-2 py-1 border rounded-md w-20" | |
| placeholder="€" | |
| /> | |
| )} | |
| </div> | |
| <div className="flex items-center"> | |
| <input | |
| type="radio" | |
| id="contactOption" | |
| name="announceType" | |
| checked={price === null} | |
| onChange={() => setPrice(null)} | |
| className="mr-2" | |
| /> | |
| <label htmlFor="contactOption" className="text-sm"> | |
| Contactez-moi | |
| </label> | |
| </div> | |
| </div> | |
| </div> | |
| <div className="flex justify-end pt-4"> | |
| <button | |
| onClick={() => onCreateAd(title, description, phone, city, color, price, photo)} | |
| className="bg-amber-600 text-white px-4 py-2 rounded-md hover:bg-amber-500" | |
| > | |
| Publier | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| ); | |
| }; | |
| ReactDOM.render(<App />, document.getElementById('root')); | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Sheld0ne/postly" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |