Daniel Bohry 9 місяців тому
батько
коміт
7304792c4c
1 змінених файлів з 83 додано та 7 видалено
  1. 83 7
      src/routes/portfolio/+page.svelte

+ 83 - 7
src/routes/portfolio/+page.svelte

@@ -96,6 +96,8 @@
     }
 
     async function searchStock(code) {
+        if (!code) return;
+
         try {
             const res = await fetch(`${import.meta.env.VITE_STOCKS_HOST}/api/stocks?q=${code}`);
             return await res.json();
@@ -299,6 +301,7 @@
 {/if}
 
 <style>
+    /* General Styles for Table (Unchanged) */
     .table-container {
         margin-top: 2rem;
         overflow-x: auto;
@@ -437,7 +440,7 @@
         }
     }
 
-    /* Modal */
+    /* Modal Styling */
     .modal-container {
         position: fixed;
         top: 20%;
@@ -455,7 +458,7 @@
         background-color: #fff;
         color: #333;
         width: 450px;
-        height: 130px;
+        height: auto;
         max-width: 500px;
         border-radius: 10px;
         padding: 2rem;
@@ -468,17 +471,90 @@
         display: flex;
         gap: 10px;
         margin-bottom: 1rem;
+        align-items: center;
     }
 
     .order-select {
         width: 200px;
+        padding: 0.5rem;
+        border-radius: 8px;
+        border: 1px solid #ddd;
+        font-size: 1rem;
+        background-color: #f9f9f9;
+        transition: border-color 0.3s ease;
+    }
+
+    .order-select:focus {
+        border-color: #2980b9;
+        outline: none;
+    }
+
+    /* Input Fields (Stock code and search) */
+    input[type="text"], input[type="number"] {
+        width: 100%;
+        padding: 0.8rem;
+        font-size: 1rem;
+        border-radius: 8px;
+        border: 1px solid #ddd;
+        margin-bottom: 10px;
+        background-color: #f9f9f9;
+        color: #333;
+        transition: border-color 0.3s ease;
+    }
+
+    input[type="text"]:focus, input[type="number"]:focus {
+        border-color: #2980b9;
+        outline: none;
+    }
+
+    /* Button styles */
+    .btn {
+        padding: 0.6rem 1.2rem;
+        font-size: 1rem;
+        border-radius: 8px;
+        border: none;
+        cursor: pointer;
+        transition: background-color 0.3s ease;
+    }
+
+    .btn-primary {
+        background-color: #2980b9;
+        color: white;
     }
 
-    /* Results section styling */
+    .btn-primary:hover {
+        background-color: #3498db;
+    }
+
+    .btn-danger {
+        background-color: #e74c3c;
+        color: white;
+    }
+
+    .btn-danger:hover {
+        background-color: #c0392b;
+    }
+
+    /* Reset Button (Modal) */
+    input[type="reset"] {
+        background-color: #e74c3c;
+        color: white;
+        font-size: 1rem;
+        padding: 0.6rem 1.2rem;
+        border-radius: 8px;
+        cursor: pointer;
+        border: none;
+    }
+
+    /* Modal result items */
     .modal-result {
-        max-width: 80%;
-        max-height: 250px;
-        transition: opacity 0.3s ease;
+        max-width: 100%;
+        max-height: 300px;
+        overflow-y: auto;
+        padding: 0.8rem;
+        background-color: #fafafa;
+        border-radius: 10px;
+        margin-top: 1rem;
     }
 
     .list-group-item {
@@ -520,4 +596,4 @@
             opacity: 1;
         }
     }
-</style>
+</style>