wgm-swap-components
Version:
A React component library for token swap interfaces
393 lines (357 loc) • 11.8 kB
CSS
/* WGM Swap Token Form Styles */
/* Reset and base styles */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/* Utility classes similar to Tailwind */
.min-h-screen { min-height: 100vh; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-start { justify-content: start; }
.justify-end { justify-content: end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; }
.mx-auto { margin: 0 auto; }
.max-w-lg { max-width: 32rem; }
.max-w-md { max-width: 28rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.px-8 { padding-left: 2rem; padding-right: 2rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-8 { margin-top: 2rem; }
.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.mr-2 { margin-right: 0.5rem; }
.-my-2 { margin-top: -0.5rem; margin-bottom: -0.5rem; }
.w-full { width: 100%; }
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-6 { width: 1.5rem; }
.h-4 { height: 1rem; }
.h-5 { height: 1.25rem; }
.h-6 { height: 1.5rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-4xl { font-size: 2.25rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.rounded-md { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-full { border-radius: 9999px; }
.border { border-width: 1px; }
.border-2 { border-width: 2px; }
.border-4 { border-width: 4px; }
.block { display: block; }
.inline-flex { display: inline-flex; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1.0rem; }
.gap-4 { gap: 1.5rem; }
.gap-10 { gap: 2.5rem; }
.relative { position: relative; }
.z-10 { z-index: 10; }
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }
.outline-none { outline: none; }
.transition-all { transition: all 0.2s; }
.transition-colors { transition: color 0.2s, background-color 0.2s, border-color 0.2s; }
.duration-200 { transition-duration: 200ms; }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); }
.shadow-xl { box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); }
.animate-spin { animation: spin 1s linear infinite; }
.opacity-50 { opacity: 0.5; }
/* Color classes */
.bg-white { background-color: #ffffff; }
.bg-gray-50 { background-color: #f9fafb; }
.bg-gray-100 { background-color: #f3f4f6; }
.bg-gray-200 { background-color: #e5e7eb; }
.bg-gray-300 { background-color: #d1d5db; }
.bg-gray-800 { background-color: #1f2937; }
.bg-blue-50 { background-color: #eff6ff; }
.bg-blue-100 { background-color: #dbeafe; }
.bg-blue-600 { background-color: #2563eb; }
.bg-green-600 { background-color: #16a34a; }
.bg-red-600 { background-color: #dc2626; }
.bg-yellow-600 { background-color: #ca8a04; }
.bg-black { background-color: #000000; }
.text-white { color: #ffffff; }
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-900 { color: #111827; }
.text-blue-100 { color: #dbeafe; }
.text-blue-600 { color: #2563eb; }
.text-red-500 { color: #ef4444; }
.text-red-600 { color: #dc2626; }
.border-white { border-color: #ffffff; }
.border-gray-100 { border-color: #f3f4f6; }
.border-gray-200 { border-color: #e5e7eb; }
.border-gray-300 { border-color: #d1d5db; }
.border-red-500 { border-color: #ef4444; }
.border-blue-500 { border-color: #3b82f6; }
/* Gradient backgrounds */
.bg-gradient-to-br {
background-image: linear-gradient(to bottom right, var(--tw-gradient-stops));
}
.from-blue-600 { --tw-gradient-from: #2563eb; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(37, 99, 235, 0)); }
.via-purple-600 { --tw-gradient-stops: var(--tw-gradient-from), #9333ea, var(--tw-gradient-to, rgba(147, 51, 234, 0)); }
.to-blue-800 { --tw-gradient-to: #1e40af; }
/* Hover states */
.hover\:bg-gray-100:hover { background-color: #f3f4f6; }
.hover\:bg-gray-200:hover { background-color: #e5e7eb; }
.hover\:bg-gray-300:hover { background-color: #d1d5db; }
.hover\:bg-gray-800:hover { background-color: #1f2937; }
.hover\:bg-blue-100:hover { background-color: #dbeafe; }
.hover\:bg-blue-700:hover { background-color: #1d4ed8; }
.hover\:bg-green-700:hover { background-color: #15803d; }
.hover\:bg-red-700:hover { background-color: #b91c1c; }
.hover\:bg-yellow-700:hover { background-color: #a16207; }
.hover\:border-gray-300:hover { border-color: #d1d5db; }
.hover\:border-blue-500:hover { border-color: #3b82f6; }
.hover\:scale-110:hover { transform: scale(1.1); }
.hover\:shadow-md:hover { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); }
.hover\:shadow-xl:hover { box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); }
/* Focus states */
.focus\:outline-none:focus { outline: none; }
.focus\:ring-2:focus { box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5); }
.focus\:ring-blue-500:focus { box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5); }
.focus\:ring-black:focus { box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.5); }
.focus\:ring-offset-2:focus { box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(59, 130, 246, 0.5); }
.focus\:border-blue-500:focus { border-color: #3b82f6; }
.focus\:border-red-500:focus { border-color: #ef4444; }
.focus\:ring-red-500:focus { box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.5); }
/* Disabled states */
.disabled\:cursor-not-allowed:disabled { cursor: not-allowed; }
.disabled\:opacity-50:disabled { opacity: 0.5; }
/* Base variables for theming */
:root {
--swap-color-primary: #3b82f6;
--swap-color-primary-hover: #2563eb;
--swap-color-secondary: #6b7280;
--swap-color-secondary-hover: #4b5563;
--swap-color-success: #10b981;
--swap-color-danger: #ef4444;
--swap-color-warning: #f59e0b;
--swap-border-radius: 0.75rem;
--swap-border-radius-lg: 1rem;
--swap-transition: all 0.2s ease-in-out;
--swap-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
/* Custom animations */
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
/* Responsive Design */
@media (max-width: 768px) {
.container {
padding: 0 1rem;
}
.text-4xl {
font-size: 2rem;
}
.p-6 {
padding: 1rem;
}
}
/* Modal specific styles */
.z-50 { z-index: 50; }
.fixed { position: fixed; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.bg-black { background-color: #000000; }
.bg-opacity-50 { background-color: rgba(0, 0, 0, 0.5); }
.max-h-96 { max-height: 24rem; }
.max-h-64 { max-height: 16rem; }
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.pointer-events-none { pointer-events: none; }
.pl-3 { padding-left: 0.75rem; }
.pl-10 { padding-left: 2.5rem; }
.pr-4 { padding-right: 1rem; }
.absolute { position: absolute; }
.inset-y-0 { top: 0; bottom: 0; }
.left-0 { left: 0; }
.focus\:border-transparent:focus { border-color: transparent; }
.border-t { border-top-width: 1px; }
.border-b { border-bottom-width: 1px; }
.w-8 { width: 2rem; }
.h-8 { height: 2rem; }
.w-6 { width: 1.5rem; }
.h-6 { height: 1.5rem; }
.flex-col { flex-direction: column; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.items-center { align-items: center; }
.text-left { text-align: left; }
.shadow-2xl {
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}
/* Modal animation */
.modal-enter {
opacity: 0;
transform: scale(0.95);
}
.modal-enter-active {
opacity: 1;
transform: scale(1);
transition: opacity 0.2s ease, transform 0.2s ease;
}
.modal-exit {
opacity: 1;
transform: scale(1);
}
.modal-exit-active {
opacity: 0;
transform: scale(0.95);
transition: opacity 0.2s ease, transform 0.2s ease;
}
/* TokenSelectModal specific styles */
.wgm-modal-backdrop {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
padding: 1rem;
}
.wgm-modal-content {
background-color: white;
border-radius: 1rem;
max-width: 28rem;
width: 100%;
max-height: 40rem;
overflow: hidden;
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}
.wgm-modal-header {
padding: 1rem 1.5rem;
border-bottom: 1px solid #e5e7eb;
display: flex;
align-items: center;
justify-content: space-between;
}
.wgm-modal-search-container {
padding: 1rem 1.5rem;
border-bottom: 1px solid #e5e7eb;
}
.wgm-modal-search-input {
width: 100%;
padding-left: 2.5rem;
padding-right: 1rem;
padding-top: 0.5rem;
padding-bottom: 0.5rem;
border: 1px solid #d1d5db;
border-radius: 0.5rem;
outline: none;
font-size: 0.875rem;
}
.wgm-modal-search-input:focus {
border-color: #3b82f6;
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}
.wgm-modal-token-list {
overflow-y: auto;
max-height: 16rem;
}
.wgm-modal-token-button {
width: 100%;
padding: 1rem 1.5rem;
display: flex;
align-items: center;
justify-content: space-between;
border: none;
background-color: transparent;
cursor: pointer;
transition: background-color 0.2s;
}
.wgm-modal-token-button:hover {
background-color: #f9fafb;
}
.wgm-modal-token-button[disabled] {
opacity: 0.5;
cursor: not-allowed;
}
.wgm-modal-history-container {
padding: 1rem 1.5rem;
border-bottom: 1px solid #e5e7eb;
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
.wgm-modal-history-token {
padding: 0.375rem 0.5rem;
display: flex;
align-items: center;
gap: 0.375rem;
border: 1px solid #a3a3a3;
border-radius: 0.75rem;
cursor: pointer;
position: relative;
font-size: 0.75rem;
background-color: transparent;
transition: background-color 0.2s;
}
.wgm-modal-history-token:hover {
background-color: #f9fafb;
}
.wgm-modal-history-token .close-btn {
opacity: 0;
}
.wgm-modal-history-token:hover .close-btn {
opacity: 1;
}
.wgm-modal-loading-spinner {
width: 1rem;
height: 1rem;
border: 2px solid #e5e7eb;
border-top: 2px solid #3b82f6;
border-radius: 50%;
animation: spin 1s linear infinite;
}
.wgm-token-avatar-placeholder {
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
background-color: #e5e7eb; /* gray-200 */
color: #4b5563; /* gray-600 */
font-weight: 600;
}