feat: two-column desktop layout for nutrition page
At 1024px+, nutrition page switches from single-column (600px max) to a two-column grid: sticky sidebar (summary, goals, water) + scrollable meals column. Mobile layout unchanged via display:contents fallback.
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "homepage",
|
"name": "homepage",
|
||||||
"version": "1.14.2",
|
"version": "1.15.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -840,6 +840,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="sidebar-col">
|
||||||
<!-- Daily Summary -->
|
<!-- Daily Summary -->
|
||||||
{#if goalCalories}
|
{#if goalCalories}
|
||||||
<div class="daily-summary">
|
<div class="daily-summary">
|
||||||
@@ -1273,7 +1274,10 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Meal Sections -->
|
<!-- Meal Sections -->
|
||||||
|
<div class="meals-col">
|
||||||
{#each mealTypes as meal, mi}
|
{#each mealTypes as meal, mi}
|
||||||
{@const mealEntries = grouped[meal]}
|
{@const mealEntries = grouped[meal]}
|
||||||
{@const mealCal = mealEntries.reduce((s, e) => s + entryCalories(e), 0)}
|
{@const mealCal = mealEntries.reduce((s, e) => s + entryCalories(e), 0)}
|
||||||
@@ -1381,6 +1385,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -1461,6 +1466,35 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 0.75rem;
|
gap: 0.75rem;
|
||||||
}
|
}
|
||||||
|
.sidebar-col, .meals-col {
|
||||||
|
display: contents;
|
||||||
|
}
|
||||||
|
@media (min-width: 1024px) {
|
||||||
|
.nutrition-page {
|
||||||
|
max-width: 1100px;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(320px, 380px) 1fr;
|
||||||
|
grid-template-rows: auto 1fr;
|
||||||
|
column-gap: 1.5rem;
|
||||||
|
align-items: start;
|
||||||
|
}
|
||||||
|
.date-nav {
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
}
|
||||||
|
.sidebar-col {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.75rem;
|
||||||
|
position: sticky;
|
||||||
|
top: 1rem;
|
||||||
|
}
|
||||||
|
.meals-col {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.75rem;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ── Date Navigator ── */
|
/* ── Date Navigator ── */
|
||||||
|
|||||||
Reference in New Issue
Block a user