允许用户对内容进行评分
一个响应式评分系统组件,采用野兽派风格使用Tailwind CSS设计。它支持深色主题,并具有高对比度,设计粗犷大胆。
<div class="max-w-sm mx-auto p-6 bg-white dark:bg-gray-800 rounded-lg shadow-md"> <h2 class="text-2xl font-bold text-gray-800 dark:text-white">Rate Us!</h2> <p class="text-gray-600 dark:text-gray-400 mb-4">Your feedback is valuable to us!</p> <div class="flex items-center justify-center mb-4"> <img src="https://picsum.photos/100/100" alt="Random User" class="rounded-full border-2 border-gray-800 dark:border-white"> <span class="ml-3 text-lg text-gray-800 dark:text-white">User Name</span> </div> <div class="flex justify-center"> <span class="text-5xl text-yellow-400 cursor-pointer hover:text-yellow-500 transition duration-200">★</span> <span class="text-5xl text-yellow-400 cursor-pointer hover:text-yellow-500 transition duration-200">★</span> <span class="text-5xl text-yellow-400 cursor-pointer hover:text-yellow-500 transition duration-200">★</span> <span class="text-5xl text-yellow-400 cursor-pointer hover:text-yellow-500 transition duration-200">★</span> <span class="text-5xl text-yellow-400 cursor-pointer hover:text-yellow-500 transition duration-200">★</span> </div> <div class="mt-4"> <button class="w-full bg-gray-800 dark:bg-yellow-400 text-white py-2 rounded-md font-bold hover:bg-yellow-500 transition duration-200">Submit Rating</button> </div> </div> <style> @media (prefers-color-scheme: dark) { .dark:hover\:bg-yellow-500:hover { background-color: #bb8d29; } } </style>
一个设计为三维的评分系统组件,支持深色主题和响应效果。该组件具有用于评分的星星、用户头像和评论部分。
<div class="max-w-md mx-auto bg-white dark:bg-gray-800 rounded-lg shadow-lg overflow-hidden"> <div class="p-6"> <div class="flex items-center"> <img class="w-10 h-10 rounded-full shadow-md border-2 border-white" src="https://randomuser.me/api/portraits/men/1.jpg" alt="User Avatar" /> <div class="ml-4"> <h2 class="text-lg font-semibold text-gray-800 dark:text-white">John Doe</h2> <p class="text-sm text-gray-600 dark:text-gray-400">5 minutes ago</p> </div> </div> <div class="flex mt-4 space-x-1"> <svg class="w-6 h-6 text-yellow-400" fill="currentColor" viewBox="0 0 24 24"><path d="M12 17.27L18.18 21 16.54 14.97 22 10.91 15.82 10.36 12 4 8.18 10.36 2 10.91 7.46 14.97 5.82 21z" /></svg> <svg class="w-6 h-6 text-yellow-400" fill="currentColor" viewBox="0 0 24 24"><path d="M12 17.27L18.18 21 16.54 14.97 22 10.91 15.82 10.36 12 4 8.18 10.36 2 10.91 7.46 14.97 5.82 21z" /></svg> <svg class="w-6 h-6 text-yellow-400" fill="currentColor" viewBox="0 0 24 24"><path d="M12 17.27L18.18 21 16.54 14.97 22 10.91 15.82 10.36 12 4 8.18 10.36 2 10.91 7.46 14.97 5.82 21z" /></svg> <svg class="w-6 h-6 text-yellow-400" fill="currentColor" viewBox="0 0 24 24"><path d="M12 17.27L18.18 21 16.54 14.97 22 10.91 15.82 10.36 12 4 8.18 10.36 2 10.91 7.46 14.97 5.82 21z" /></svg> <svg class="w-6 h-6 text-gray-300" fill="currentColor" viewBox="0 0 24 24"><path d="M12 17.27L18.18 21 16.54 14.97 22 10.91 15.82 10.36 12 4 8.18 10.36 2 10.91 7.46 14.97 5.82 21z" /></svg> </div> <div class="mt-4"> <p class="text-gray-700 dark:text-gray-300">This is a quick comment about the rating. Engaging and insightful feedback to enhance the user experience.</p> </div> </div> <div class="bg-gray-100 dark:bg-gray-700 p-4"> <h3 class="text-md font-semibold text-gray-800 dark:text-white">Related Image</h3> <img class="mt-2 rounded-lg shadow-md" src="https://picsum.photos/400/200" alt="Placeholder Image" /> </div> </div>