From 8de9623a0dec56eeac852c7500b033cf70a6c1d5 Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 6 Jan 2025 16:06:06 +0300 Subject: [PATCH] style(editable_cell): add styling to have a grid layout. --- assets/style.css | 36 +++++++++++++++++++++++++++++++++ src/components/editable_cell.rs | 19 +++++++++-------- 2 files changed, 47 insertions(+), 8 deletions(-) diff --git a/assets/style.css b/assets/style.css index 49b83d8..a010428 100644 --- a/assets/style.css +++ b/assets/style.css @@ -68,4 +68,40 @@ th, td { th { background-color: #f2f2f2; +} + +/* Style for the grid container */ +.grid-container { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); /* Adjust the minimum width for cells */ + gap: 1px; /* Gap between cells */ + background-color: #ccc;/* Grid line color */ + border: 1px solid #aaa; /* Outer border */ +} + +/* Style for individual cells */ +.editable-cell { + display: block; /* Allow it to fill the parent container */ + width: 100%; /* Full width of the allocated space */ + height: 100%; /* Full height of the allocated space */ + position: relative; +} + +/* Style for the input field inside the editable cell */ +.editable-cell-input { + width: 100%; /* Ensure input takes up full width */ + height: 100%; /* Ensure input takes up full height */ + border: none; /* Remove input box borders */ + padding: 8px; /* Add padding for spacing */ + box-sizing: border-box; /* Ensure padding doesn't cause overflow */ + font-size: 14px; /* Adjust font size */ + text-align: left; /* Align text to the left */ + outline: none; /* Remove outline for better UI */ + background-color: transparent; /* Make background transparent */ +} + +/* Optional: Style for the focused input field */ +.editable-cell-input:focus { + background-color: #e0f7fa; /* Light blue background when focused */ + border: 1px solid #00796b; /* Green border when focused */ } \ No newline at end of file diff --git a/src/components/editable_cell.rs b/src/components/editable_cell.rs index 616b1e2..04592cc 100644 --- a/src/components/editable_cell.rs +++ b/src/components/editable_cell.rs @@ -53,13 +53,16 @@ pub fn EditableCell( }); view! { - +
+ +
} }