<% if RailsToastify.configuration.framework == :bootstrap %> .toast-container { position: fixed; z-index: 9999; pointer-events: none; top: 20px; right: 20px; } .toast { display: flex; align-items: center; background-color: #fff; border-radius: 4px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.06); padding: 16px; margin: 8px; color: #333; position: relative; transition: transform 0.5s ease-in-out, opacity 0.5s ease-in-out; transform: translateX(100%); max-width: 300px; } .toast.show { transform: translateX(0); } .toast.hide { transform: translateX(100%); } .toast--success .toast__progress-bar { background-color: #4caf50; } .toast--error .toast__progress-bar { background-color: #f44336; } .toast--info .toast__progress-bar { background-color: #2196f3; } .toast--warning .toast__progress-bar { background-color: #ff9800; } .toast__close-button { color: #333; background-color: transparent; border: none; padding: 0; cursor: pointer; opacity: 0.7; transition: opacity 0.3s; align-self: flex-start; margin-left: auto; } .toast__close-button:hover { opacity: 1; } .toast__progress-bar { position: absolute; bottom: 0; left: 0; width: 100%; height: 4px; animation: progress-bar 5s linear forwards; } @keyframes progress-bar { from { width: 100%; } to { width: 0; } } <% elsif RailsToastify.configuration.framework == :tailwind %> .toast-container { @apply fixed z-50 pointer-events-none top-4 right-4; } .toast { @apply flex items-center bg-white rounded-lg shadow-lg p-4 my-2 text-gray-800 relative max-w-sm; transition: transform 0.5s ease-in-out, opacity 0.5s ease-in-out; transform: translateX(100%); } .toast.show { transform: translateX(0); } .toast.hide { transform: translateX(100%); } .toast--success .toast__progress-bar { @apply bg-green-500; } .toast--error .toast__progress-bar { @apply bg-red-500; } .toast--info .toast__progress-bar { @apply bg-blue-500; } .toast--warning .toast__progress-bar { @apply bg-yellow-500; } .toast__close-button { @apply text-gray-800 bg-transparent border-none p-0 cursor-pointer opacity-70 transition-opacity duration-300 self-start ml-auto; &:hover { @apply opacity-100; } } .toast__progress-bar { @apply absolute bottom-0 left-0 w-full h-1; animation: progress-bar 5s linear forwards; } @keyframes progress-bar { from { width: 100%; } to { width: 0; } } <% end %>