Componente de botones para compartir en redes sociales
Un componente de botones para compartir en redes sociales elegante y receptivo diseñado para sitios web de noticias y periodismo, con una lujosa paleta de colores bosque/verde y soporte para modo oscuro. Incluye múltiples elementos interactivos para compartir artículos en varias plataformas.
Código HTML
<div class="p-4 sm:p-6 lg:p-8 bg-gradient-to-br from-green-50 to-green-100 dark:from-gray-900 dark:to-gray-950 font-sans antialiased text-gray-800 dark:text-gray-100 min-h-screen flex items-center justify-center">
<div class="w-full max-w-xl bg-white dark:bg-gray-800 rounded-xl shadow-2xl overflow-hidden transform transition-all duration-300 hover:scale-[1.01] border border-green-200 dark:border-green-800">
<div class="p-6 sm:p-8 lg:p-10 border-b border-green-100 dark:border-green-700">
<h2 class="text-2xl sm:text-3xl font-extrabold text-green-800 dark:text-green-200 mb-2 leading-tight tracking-tight">
Like What You Read?
</h2>
<p class="text-md sm:text-lg text-green-700 dark:text-green-300 font-medium">
Share this insightful article with your network!
</p>
</div>
<div class="p-6 sm:p-8 lg:p-10 grid grid-cols-2 lg:grid-cols-3 gap-4 sm:gap-6">
<!-- Share Button: Facebook -->
<button class="flex items-center justify-center p-3 sm:p-4 rounded-lg bg-blue-600 hover:bg-blue-700 focus:ring-4 focus:ring-blue-300 dark:bg-blue-700 dark:hover:bg-blue-800 dark:focus:ring-blue-900 transition-all duration-200 ease-in-out transform hover:-translate-y-0.5 hover:shadow-lg group">
<svg class="w-6 h-6 sm:w-7 sm:h-7 text-white mr-2.5" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path fill-rule="evenodd" d="M22 12c0-5.523-4.477-10-10-10S2 6.477 2 12c0 4.991 3.657 9.128 8.438 9.878v-6.987h-2.54V12h2.54V9.797c0-2.506 1.492-3.89 3.777-3.89 1.094 0 2.238.195 2.238.195v2.46h-1.26c-1.243 0-1.63.771-1.63 1.562V12h2.773l-.443 2.89h-2.33V22c4.781-.75 8.438-4.886 8.438-9.879Z" clip-rule="evenodd" />
</svg>
<span class="text-white font-semibold text-sm sm:text-base">Facebook</span>
</button>
<!-- Share Button: Twitter/X -->
<button class="flex items-center justify-center p-3 sm:p-4 rounded-lg bg-gray-900 hover:bg-gray-800 focus:ring-4 focus:ring-gray-300 dark:bg-gray-100 dark:hover:bg-gray-200 dark:focus:ring-gray-600 transition-all duration-200 ease-in-out transform hover:-translate-y-0.5 hover:shadow-lg group">
<svg class="w-6 h-6 sm:w-7 sm:h-7 text-white dark:text-gray-900 mr-2.5" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path d="M18.901 1.153 13.916 8.92c-.171.267-.442.428-.737.478L4.697 10.63H4.69c-.495.006-.991-.046-1.479-.153.208-.01.416.035.617.13 1.144.49 1.947 1.636 1.947 2.923v.15c0 .354-.084.706-.245 1.026-.067.135-.118.257-.156.368.175.056.35.09.525.093 1.06 0 1.916-.856 1.916-1.917 0-.306-.073-.604-.213-.865L12 10.457l3.651 4.545a1.914 1.914 0 0 1-.225 3.013c.277.262.614.475.975.642 1.341.61 2.996.903 4.673.811.107.822.429 1.57.854 2.235.438.694.945 1.31 1.503 1.849 0 0 .001.001.002.001L22 22 2 2v20c0 0 20-20 20-20z" fill-rule="evenodd" clip-rule="evenodd"/>
</svg>
<span class="text-white dark:text-gray-900 font-semibold text-sm sm:text-base">Twitter</span>
</button>
<!-- Share Button: LinkedIn -->
<button class="flex items-center justify-center p-3 sm:p-4 rounded-lg bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-400 dark:bg-blue-800 dark:hover:bg-blue-900 transition-all duration-200 ease-in-out transform hover:-translate-y-0.5 hover:shadow-lg group">
<svg class="w-6 h-6 sm:w-7 sm:h-7 text-white mr-2.5" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path d="M20.5 2h-17A1.5 1.5 0 0 0 2 3.5v17A1.5 1.5 0 0 0 3.5 22h17a1.5 1.5 0 0 0 1.5-1.5v-17A1.5 1.5 0 0 0 20.5 2zM8 19H5v-9h3v9zM6.5 8.25A1.75 1.75 0 1 1 8.25 6.5 1.75 1.75 0 0 1 6.5 8.25zM19 19h-3v-4.74c0-1.78-1.52-2.46-2.58-1.42s-1.42 1.38-1.42 1.38V19h-3v-9h3v1.76c.45-.63 1.15-1.12 2.39-1.12 2.65 0 4.11 1.76 4.11 4.74V19z"/>
</svg>
<span class="text-white font-semibold text-sm sm:text-base">LinkedIn</span>
</button>
<!-- Share Button: Email -->
<button class="flex items-center justify-center p-3 sm:p-4 rounded-lg bg-red-600 hover:bg-red-700 focus:ring-4 focus:ring-red-300 dark:bg-red-700 dark:hover:bg-red-800 dark:focus:ring-red-900 transition-all duration-200 ease-in-out transform hover:-translate-y-0.5 hover:shadow-lg group">
<svg class="w-6 h-6 sm:w-7 sm:h-7 text-white mr-2.5" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path d="M2.25 6.75A2.25 2.25 0 0 1 4.5 4.5h15C20.74 4.5 22 5.76 22 7.25v9.5c0 1.49-1.26 2.75-2.5 2.75H4.5A2.25 2.25 0 0 1 2.25 17.5v-9.5zm2.25 0V7a.75.75 0 0 0-.75-.75H4.5v0zm2.25 0l4.75 3.57a1.5 1.5 0 0 0 1.76 0L17.25 6.75h-10.5zM2.25 8.75v8.75A1.25 1.25 0 0 0 3.5 18.75h17A1.25 1.25 0 0 0 21.25 17.5v-8.75L12 15z"/>
</svg>
<span class="text-white font-semibold text-sm sm:text-base">Email</span>
</button>
<!-- Share Button: WhatsApp -->
<button class="flex items-center justify-center p-3 sm:p-4 rounded-lg bg-green-500 hover:bg-green-600 focus:ring-4 focus:ring-green-300 dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-green-900 transition-all duration-200 ease-in-out transform hover:-translate-y-0.5 hover:shadow-lg group">
<svg class="w-6 h-6 sm:w-7 sm:h-7 text-white mr-2.5" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path d="M12.04 2C7.38 2 3.61 5.77 3.61 10.43c0 1.55.4 3.06 1.16 4.4l-1.2 4.35 4.49-1.18c1.3.71 2.76 1.09 4.28 1.09C16.7 20.44 20.47 16.67 20.47 12.01S16.7 3.62 12.04 3.62zM17 14.8c-.14.24-.2.27-.47.37-.29.11-.67.16-1.07.16-.48 0-.91-.12-1.37-.29-.39-.15-1.17-.37-2.03-.76-.87-.39-1.74-.95-2.48-1.58-.77-.66-1.42-1.44-1.92-2.31-.5-.87-.78-1.72-.78-2.52 0-.9.27-1.45.39-1.66.12-.2.27-.27.42-.31.15-.04.38-.04.56-.02.18 0 .38.01.55.04.17.03.3-.06.45.3.15.35.53 1.28.53 1.28.02.04.03.07.03.11-.02.1-.06.2-.12.3-.39.46-.77.92-1.11 1.34-.36.43-.58.62-.64.69-.06.07-.13.14-.07.24.06.12.2.29.35.43.16.15.3.26.44.39.81.71 1.48 1.28 2.05 1.63.57.36 1.05.57 1.55.77 0 .01.01.01.01.01.04.02.07.03.11.05.12.03.22.05.33.05.07 0 .15-.01.2-.02.43-.17 1.27-.48 1.5-.66v-.01c.23-.19.33-.29.47-.36.14-.07.26-.06.39-.03.1.02.25.09.43.26.17.18.28.3.38.4.1.1.2.22.3.33.1.1.16.2.23.27.06.07.06.14.07.26v.01z"/>
</svg>
<span class="text-white font-semibold text-sm sm:text-base">WhatsApp</span>
</button>
<!-- Share Button: Copy Link -->
<button class="flex items-center justify-center p-3 sm:p-4 rounded-lg bg-green-700 hover:bg-green-800 disabled:bg-green-400 focus:ring-4 focus:ring-green-400 dark:bg-green-800 dark:hover:bg-green-900 dark:focus:ring-green-950 transition-all duration-200 ease-in-out transform hover:-translate-y-0.5 hover:shadow-lg group" onclick="navigator.clipboard.writeText('https://www.example.com/article-link').then(function(){ alert('Link copied to clipboard!'); }, function(){ alert('Failed to copy link!'); });">
<svg class="w-6 h-6 sm:w-7 sm:h-7 text-white mr-2.5" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 13.5h6m-3-3v6m-9 5.25a2.25 2.25 0 01-2.25-2.25V9C2.25 7.7 3.39 6.75 4.87 6.75h.92L6 4.78a2.25 2.25 0 011.85-.78h8.3a2.25 2.25 0 011.85.78l.21 1.97h.92c1.48 0 2.62 1.05 2.62 2.3V17.5a2.25 2.25 0 01-2.25 2.25h-15zM4 17.5L5.75 9H18.25L20 17.5"/>
</svg>
<span class="text-white font-semibold text-sm sm:text-base">Copy Link</span>
</button>
</div>
<div class="p-6 sm:p-8 lg:p-10 border-t border-green-100 dark:border-green-700 text-center">
<p class="text-sm sm:text-base text-gray-500 dark:text-gray-400">
Thank you for reading and supporting quality journalism.
</p>
</div>
</div>
</div>
<!-- Add a script tag to toggle dark mode for demonstration purposes -->
<script>
// This script is purely for demonstration and should ideally be part of a larger JS setup.
// It toggles dark mode when the 'D' key is pressed.
document.addEventListener('keydown', (e) => {
if (e.key === 'd' || e.key === 'D') {
document.documentElement.classList.toggle('dark');
}
});
</script>
Componentes relacionados
Componente de botones para compartir en redes sociales: música/audio
Un conjunto de botones para compartir en redes sociales diseñados para plataformas de música y audio, con una estética de Material Design con colores apagados y compatibles con el modo oscuro. Incluye botones para plataformas comunes de uso compartido como Facebook, Twitter y correo electrónico.
Botones para compartir en redes sociales
Componente de botones para compartir en redes sociales con diseño de Glassmorphism, efectos responsivos y compatibilidad con temas oscuros. No se utiliza JavaScript.
Componente de botones para compartir en redes sociales
Un componente minimalista de botones para compartir en redes sociales diseñado para paneles, con una combinación de colores vibrantes y un diseño receptivo, con soporte para modo oscuro.