PlayfulForestAlert
一个俙汁活泼的警报消息组件,采用森林/绿色调色板、圆润的元素和友好的美学设计,适用于商业/公司网站。它是响应式的,包括暗模式支持。
HTML 代码
<div class="p-4 sm:p-6 md:p-8 bg-gradient-to-br from-green-50 to-emerald-100 dark:from-gray-800 dark:to-gray-950 min-h-screen flex items-center justify-center font-sans">
<div class="w-full max-w-4xl space-y-6">
<!-- Success Alert -->
<div class="flex items-center p-4 pr-6 rounded-3xl shadow-xl bg-green-100 dark:bg-green-800 text-green-800 dark:text-green-50 animate-fade-in-down transition-all duration-300 ease-in-out transform hover:scale-[1.01] overflow-hidden">
<div class="flex-shrink-0 w-12 h-12 rounded-full bg-green-500 dark:bg-green-600 flex items-center justify-center mr-4 shadow-md">
<svg class="w-7 h-7 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</div>
<div class="flex-grow">
<h3 class="text-lg sm:text-xl font-bold mb-1">Success! Your changes have been saved.</h3>
<p class="text-sm text-green-700 dark:text-green-200">All systems are go. Enjoy a seamless experience.</p>
</div>
<button class="ml-4 p-2 rounded-full text-green-600 dark:text-green-200 hover:bg-green-200 dark:hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2 focus:ring-offset-green-100 dark:focus:ring-offset-green-800 transition-colors duration-200">
<svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
<!-- Info Alert -->
<div class="flex items-center p-4 pr-6 rounded-3xl shadow-xl bg-blue-100 dark:bg-blue-800 text-blue-800 dark:text-blue-50 animate-fade-in-down transition-all duration-300 ease-in-out transform hover:scale-[1.01] overflow-hidden" style="animation-delay: 0.1s;">
<div class="flex-shrink-0 w-12 h-12 rounded-full bg-blue-500 dark:bg-blue-600 flex items-center justify-center mr-4 shadow-md">
<svg class="w-7 h-7 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</div>
<div class="flex-grow">
<h3 class="text-lg sm:text-xl font-bold mb-1">Heads Up! New updates available.</h3>
<p class="text-sm text-blue-700 dark:text-blue-200">Check out our latest features and improvements.</p>
</div>
<button class="ml-4 p-2 rounded-full text-blue-600 dark:text-blue-200 hover:bg-blue-200 dark:hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-blue-100 dark:focus:ring-offset-blue-800 transition-colors duration-200">
<svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
<!-- Warning Alert -->
<div class="flex items-center p-4 pr-6 rounded-3xl shadow-xl bg-yellow-100 dark:bg-yellow-800 text-yellow-800 dark:text-yellow-50 animate-fade-in-down transition-all duration-300 ease-in-out transform hover:scale-[1.01] overflow-hidden" style="animation-delay: 0.2s;">
<div class="flex-shrink-0 w-12 h-12 rounded-full bg-yellow-500 dark:bg-yellow-600 flex items-center justify-center mr-4 shadow-md">
<svg class="w-7 h-7 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
</svg>
</div>
<div class="flex-grow">
<h3 class="text-lg sm:text-xl font-bold mb-1">Hey! Action needed soon.</h3>
<p class="text-sm text-yellow-700 dark:text-yellow-200">Your subscription is about to expire. Renew now!</p>
</div>
<button class="ml-4 p-2 rounded-full text-yellow-600 dark:text-yellow-200 hover:bg-yellow-200 dark:hover:bg-yellow-700 focus:outline-none focus:ring-2 focus:ring-yellow-500 focus:ring-offset-2 focus:ring-offset-yellow-100 dark:focus:ring-offset-yellow-800 transition-colors duration-200">
<svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
<!-- Error Alert -->
<div class="flex items-center p-4 pr-6 rounded-3xl shadow-xl bg-red-100 dark:bg-red-800 text-red-800 dark:text-red-50 animate-fade-in-down transition-all duration-300 ease-in-out transform hover:scale-[1.01] overflow-hidden" style="animation-delay: 0.3s;">
<div class="flex-shrink-0 w-12 h-12 rounded-full bg-red-500 dark:bg-red-600 flex items-center justify-center mr-4 shadow-md">
<svg class="w-7 h-7 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</div>
<div class="flex-grow">
<h3 class="text-lg sm:text-xl font-bold mb-1">Oops! Something went wrong.</h3>
<p class="text-sm text-red-700 dark:text-red-200">Please try again later or contact support.</p>
</div>
<button class="ml-4 p-2 rounded-full text-red-600 dark:text-red-200 hover:bg-red-200 dark:hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 focus:ring-offset-red-100 dark:focus:ring-offset-red-800 transition-colors duration-200">
<svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
</div>
</div>
<style>
@keyframes fade-in-down {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.animate-fade-in-down {
animation: fade-in-down 0.5s ease-out forwards;
}
</style>