UNPKG

react-modals-kit

Version:

A lightweight and customizable modal library for React, providing various types of modals with simple API

209 lines (182 loc) 3.8 kB
.toastContainer { position: fixed; z-index: 9999999999; display: flex; flex-direction: column; max-width: 380px; min-width: 280px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; overflow: hidden; border-radius: 12px; box-shadow: 0 5px 20px rgba(0, 0, 0, 0.16); } /* مواضع مختلفة */ .positionTopRight { top: 24px; right: 24px; } .positionTopLeft { top: 24px; left: 24px; } .positionBottomRight { bottom: 24px; right: 24px; } .positionBottomLeft { bottom: 24px; left: 24px; } .positionTopCenter { top: 24px; left: 50%; transform: translateX(-50%); } .positionBottomCenter { bottom: 24px; left: 50%; transform: translateX(-50%); } .toastBody { padding: 16px; display: flex; justify-content: flex-start; align-items: center; gap: 12px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); } .messageContainer { flex: 1; word-break: break-word; font-size: 0.95rem; line-height: 1.4; letter-spacing: 0.2px; } .iconContainer { display: flex; justify-content: center; align-items: center; width: 24px; height: 24px; flex-shrink: 0; border-radius: 50%; background-color: rgba(255, 255, 255, 0.2); } .icon { font-weight: bold; font-size: 0.85rem; } .closeBtn { cursor: pointer; font-weight: normal; font-size: 1.2rem; display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; opacity: 0.7; transition: all 0.2s ease; border-radius: 50%; flex-shrink: 0; } .closeBtn:hover { opacity: 1; } .progressBarContainer { height: 3px; background-color: transparent; overflow: hidden; position: relative; width: 100%; } .progressBar { height: 100%; transition: width 0.1s linear; } /* تأثيرات الظهور والاختفاء */ .enter { animation: fadeScale 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards; } .exit { animation: fadeOut 0.25s ease-in forwards; } @keyframes fadeScale { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } } @keyframes fadeOut { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-10px); opacity: 0; } } /* تخصيص التأثيرات حسب الموضع */ .positionBottomRight .enter, .positionBottomLeft .enter { animation: fadeScaleBottom 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards; } .positionBottomRight .exit, .positionBottomLeft .exit { animation: fadeOutBottom 0.25s ease-in forwards; } @keyframes fadeScaleBottom { from { transform: translateY(-10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } } @keyframes fadeOutBottom { from { transform: translateY(0); opacity: 1; } to { transform: translateY(10px); opacity: 0; } } .positionTopCenter .enter, .positionBottomCenter .enter { animation: fadeScaleCenter 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards; } @keyframes fadeScaleCenter { from { transform: translateY(10px) translateX(-50%) scale(0.95); opacity: 0; } to { transform: translateY(0) translateX(-50%) scale(1); opacity: 1; } } .positionTopCenter .exit, .positionBottomCenter .exit { animation: fadeOutCenter 0.25s ease-in forwards; } @keyframes fadeOutCenter { from { transform: translateY(0) translateX(-50%); opacity: 1; } to { transform: translateY(-10px) translateX(-50%); opacity: 0; } }