Skip to content

Commit 27334c1

Browse files
committed
Refactor homepage layout and styles
- Updated the main content rendering in `index.py` to use a `Div` for the homepage grid layout instead of `Grid`. - Added CSS styles for the new `.homepage-grid` class to implement a responsive grid layout for batch cards.
1 parent 23d6cab commit 27334c1

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

dashboard/routes/index.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
from fasthtml.common import *
32
from monsterui.all import *
43
from fasthtml.svg import *
@@ -97,13 +96,12 @@ def _create_main_content(batch_stats: dict, sorted_batch_names: list) -> Div:
9796
cls="mb-6",
9897
)
9998
if not app.state.metric_batches
100-
else Grid(
99+
else Div(
101100
*[
102101
create_batch_card(name, batch_stats[name])
103102
for name in sorted_batch_names
104103
],
105-
cols=4,
106-
gap=2,
104+
cls="homepage-grid",
107105
)
108106
),
109107
cls="p-2",

dashboard/static/styles.css

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/* Mobile-first approach */
32
* {
43
box-sizing: border-box;
@@ -260,3 +259,18 @@ body.dark-mode .uk-toggle-switch:checked {
260259
body.dark-mode .uk-toggle-switch::before {
261260
background-color: #e5e7eb;
262261
}
262+
263+
/* Homepage grid layout */
264+
.homepage-grid {
265+
display: grid;
266+
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
267+
gap: 1rem;
268+
padding: 1rem;
269+
}
270+
271+
/* Ensure cards have consistent width on homepage */
272+
.homepage-grid .uk-card {
273+
width: 100%;
274+
height: 100%;
275+
margin-bottom: 0;
276+
}

0 commit comments

Comments
 (0)