Skip to content

Commit 3991a35

Browse files
committed
style: improve mobile layout of Gearberg
1 parent 492db14 commit 3991a35

10 files changed

Lines changed: 192 additions & 139 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ confirm:
1414
## run/web: run the web application with live reload
1515
.PHONY: run/web
1616
run/web:
17-
reflex -s -r '\.(go|tmpl|js)$$' -- go run -tags sqlite ./cmd/web serve --max-orgs=2 -log-level=debug
17+
reflex -s -r '\.(go|tmpl|js)$$' -- go run -tags sqlite ./cmd/web serve -log-level=debug
1818

1919
## run/www: run the web application with live reload
2020
.PHONY: run/www

internal/assets/dist/index.css

Lines changed: 63 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6562,18 +6562,9 @@
65626562
.h-10 {
65636563
height: calc(var(--spacing) * 10);
65646564
}
6565-
.h-12 {
6566-
height: calc(var(--spacing) * 12);
6567-
}
6568-
.h-14 {
6569-
height: calc(var(--spacing) * 14);
6570-
}
65716565
.h-16 {
65726566
height: calc(var(--spacing) * 16);
65736567
}
6574-
.h-24 {
6575-
height: calc(var(--spacing) * 24);
6576-
}
65776568
.h-auto {
65786569
height: auto;
65796570
}
@@ -6747,9 +6738,6 @@
67476738
.w-6 {
67486739
width: calc(var(--spacing) * 6);
67496740
}
6750-
.w-12 {
6751-
width: calc(var(--spacing) * 12);
6752-
}
67536741
.w-16 {
67546742
width: calc(var(--spacing) * 16);
67556743
}
@@ -7037,9 +7025,6 @@
70377025
.flex-row {
70387026
flex-direction: row;
70397027
}
7040-
.flex-nowrap {
7041-
flex-wrap: nowrap;
7042-
}
70437028
.flex-wrap {
70447029
flex-wrap: wrap;
70457030
}
@@ -8223,6 +8208,9 @@
82238208
.py-1\.5 {
82248209
padding-block: calc(var(--spacing) * 1.5);
82258210
}
8211+
.py-2 {
8212+
padding-block: calc(var(--spacing) * 2);
8213+
}
82268214
.py-3 {
82278215
padding-block: calc(var(--spacing) * 3);
82288216
}
@@ -9991,6 +9979,21 @@
99919979
}
99929980
}
99939981
}
9982+
.sm\:flex-row {
9983+
@media (width >= 40rem) {
9984+
flex-direction: row;
9985+
}
9986+
}
9987+
.sm\:items-center {
9988+
@media (width >= 40rem) {
9989+
align-items: center;
9990+
}
9991+
}
9992+
.sm\:justify-between {
9993+
@media (width >= 40rem) {
9994+
justify-content: space-between;
9995+
}
9996+
}
99949997
.md\:col-span-2 {
99959998
@media (width >= 48rem) {
99969999
grid-column: span 2 / span 2;
@@ -10001,11 +10004,51 @@
1000110004
grid-column: span 4 / span 4;
1000210005
}
1000310006
}
10007+
.md\:mx-auto {
10008+
@media (width >= 48rem) {
10009+
margin-inline: auto;
10010+
}
10011+
}
1000410012
.md\:flex {
1000510013
@media (width >= 48rem) {
1000610014
display: flex;
1000710015
}
1000810016
}
10017+
.md\:hidden {
10018+
@media (width >= 48rem) {
10019+
display: none;
10020+
}
10021+
}
10022+
.md\:inline {
10023+
@media (width >= 48rem) {
10024+
display: inline;
10025+
}
10026+
}
10027+
.md\:h-14 {
10028+
@media (width >= 48rem) {
10029+
height: calc(var(--spacing) * 14);
10030+
}
10031+
}
10032+
.md\:h-24 {
10033+
@media (width >= 48rem) {
10034+
height: calc(var(--spacing) * 24);
10035+
}
10036+
}
10037+
.md\:w-auto {
10038+
@media (width >= 48rem) {
10039+
width: auto;
10040+
}
10041+
}
10042+
.md\:w-xs {
10043+
@media (width >= 48rem) {
10044+
width: var(--container-xs);
10045+
}
10046+
}
10047+
.md\:flex-none {
10048+
@media (width >= 48rem) {
10049+
flex: none;
10050+
}
10051+
}
1000910052
.md\:grid-cols-2 {
1001010053
@media (width >= 48rem) {
1001110054
grid-template-columns: repeat(2, minmax(0, 1fr));
@@ -10016,6 +10059,11 @@
1001610059
grid-template-columns: repeat(4, minmax(0, 1fr));
1001710060
}
1001810061
}
10062+
.md\:flex-nowrap {
10063+
@media (width >= 48rem) {
10064+
flex-wrap: nowrap;
10065+
}
10066+
}
1001910067
.lg\:drawer-open {
1002010068
@media (width >= 64rem) {
1002110069
@layer daisyui.l1.l2.l3 {

internal/templates/components/equipment-header.tmpl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
</div>
1717
</div>
1818
<div class="dropdown dropdown-end">
19-
<div tabindex="0" role="button" class="btn btn-ghost">More ▾</div>
19+
<div tabindex="0" role="button" class="btn btn-ghost">
20+
<span class="md:hidden w-4 h-4">{{ template "dot-menu-icon" . }}</span>
21+
<span class="hidden md:inline">More ▾</span>
22+
</div>
2023
<ul tabindex="0" class="dropdown-content menu bg-base-100 rounded-box shadow-sm border border-base-200 w-40 p-1 z-10">
2124
<li>
2225
<button

internal/templates/layouts/settings.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
<div class="drawer lg:drawer-open min-h-[calc(100vh-4rem)]">
44
<input id="settings-drawer" type="checkbox" class="drawer-toggle" />
55
<div class="drawer-content flex flex-col max-w-5xl mx-auto w-full">
6-
<div class="flex items-center gap-2 px-4 py-3 border-b border-base-300 lg:hidden">
6+
<div class="flex items-center gap-2 py-3 border-b border-base-300 lg:hidden">
77
<label for="settings-drawer" class="btn btn-ghost drawer-button">
88
{{ template "menu-icon" . }}
99
Settings
1010
</label>
1111
</div>
12-
<main class="flex-1 p-8">{{ template "page" . }}</main>
12+
<main class="flex-1 p-4">{{ template "page" . }}</main>
1313
</div>
1414
<div class="drawer-side z-10">
1515
<label for="settings-drawer" aria-label="close sidebar" class="drawer-overlay"></label>

internal/templates/pages/equipment/index.tmpl

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
{{ define "page" }}
44
<div class="w-full bg-base-200 border-b border-base-300">
5-
<div class="max-w-5xl mx-auto px-4 h-24 flex items-center justify-between">
5+
<div class="max-w-5xl md:mx-auto px-4 py-3 md:h-24 flex flex-row items-center justify-between gap-2">
66
<div>
77
<h3>All Items</h3>
88
<div class="text-sm text-base-content/50 font-mono">
@@ -11,9 +11,12 @@
1111
<span>{{ len .Data.Categories }} categories</span>
1212
</div>
1313
</div>
14-
<div class="flex gap-2">
14+
<div class="flex gap-2 shrink-0">
1515
<div class="dropdown dropdown-end">
16-
<div tabindex="0" role="button" class="btn btn-ghost">More ▾</div>
16+
<div tabindex="0" role="button" class="btn btn-ghost">
17+
<span class="md:hidden w-4 h-4">{{ template "dot-menu-icon" . }}</span>
18+
<span class="hidden md:inline">More ▾</span>
19+
</div>
1720
<ul tabindex="0" class="dropdown-content menu bg-base-100 rounded-box z-1 w-48 p-2 shadow border border-base-300">
1821
<li>
1922
<a href="{{ .Data.PrintURL }}" target="_blank">
@@ -35,18 +38,21 @@
3538
</li>
3639
</ul>
3740
</div>
38-
<a class="btn btn-primary" href="/orgs/{{ .Data.OrgID }}/equipment/new">+ Add Item</a>
41+
<a class="btn btn-primary" href="/orgs/{{ .Data.OrgID }}/equipment/new">
42+
<span class="md:hidden">+</span>
43+
<span class="hidden md:inline">+ Add Item</span>
44+
</a>
3945
</div>
4046
</div>
4147
</div>
4248
<div class="w-full bg-base-100 border-b border-base-200">
43-
<div class="max-w-5xl mx-auto px-4 h-14 flex gap-1 items-center overflow-x-auto scrollbar-none">
44-
<form method="get" action="/orgs/{{ .Data.OrgID }}/equipment" id="filter-form" data-auto-submit class="flex items-center gap-1 flex-nowrap">
45-
<label class="input input-sm w-xs shrink-0">
49+
<div class="max-w-5xl mx-auto px-4 py-2 md:h-14 flex items-center">
50+
<form method="get" action="/orgs/{{ .Data.OrgID }}/equipment" id="filter-form" data-auto-submit class="flex items-center gap-1 flex-wrap md:flex-nowrap w-full">
51+
<label class="input w-full md:w-xs md:flex-none">
4652
<span class="flex text-secondary opacity-50 [&>svg]:w-4 [&>svg]:h-4">{{ template "search-icon" . }}</span>
4753
<input type="search" name="q" placeholder="Search" {{ if $.Data.Query }}value="{{ $.Data.Query }}"{{ end }} />
4854
</label>
49-
<select name="category" class="select select-sm">
55+
<select name="category" class="select w-full md:w-auto">
5056
<option value="">All categories</option>
5157
{{ range .Data.Categories }}
5258
<option value="{{ .Name }}" {{ if eq $.Data.Category .Name }}selected{{ end }}>{{ .Name }}</option>
@@ -63,15 +69,14 @@
6369
<tr>
6470
<th></th>
6571
<th>NAME</th>
66-
<th class="text-right">CATEGORY</th>
6772
<th class="text-right">STOCK</th>
6873
</tr>
6974
</thead>
7075
<tbody>
7176
{{ range .Data.Inventories }}
7277
<tr>
7378
<td class="w-16 items-center">
74-
<div class="w-12 h-12 rounded-md border-2 border-base-200 overflow-hidden flex items-center justify-center">
79+
<div class="w-16 h-16 bg-base-200 rounded-lg border-dashed border-2 border-base-300 overflow-hidden flex items-center justify-center">
7580
{{ if .ImageURL }}
7681
<button type="button" class="cursor-pointer w-full h-full" data-modal-target="photo-viewer-dialog" data-photo-src="{{ .ImageURL }}">
7782
<img src="{{ .ImageURL }}" alt="{{ .Name }}" class="w-full h-full object-contain" />
@@ -88,13 +93,9 @@
8893
<div class="flex items-center gap-1.5">
8994
<span class="text-xs text-secondary">{{ .Type.Label }}</span>
9095
{{ if eq .Kind 2 }}<span class="text-xs text-secondary">• Combination</span>{{ end }}
96+
<span class="text-xs text-secondary">• <a href="/orgs/{{ $.Data.OrgID }}/settings/equipment-categories/{{ .CategoryID }}" class="link link-hover">{{ .CategoryName }}</a></span>
9197
</div>
9298
</td>
93-
<td>
94-
<span class="inline-flex items-center gap-1.5">
95-
<a href="/orgs/{{ $.Data.OrgID }}/settings/equipment-categories/{{ .CategoryID }}" class="link link-hover">{{ .CategoryName }}</a>
96-
</span>
97-
</td>
9899
<td class="w-4 text-right">
99100
{{ if eq .Type.Label "Serialized" }}
100101
<a href="/orgs/{{ $.Data.OrgID }}/equipment/{{ .ID }}/units" class="link link-hover">{{ .TotalStock }}</a>

0 commit comments

Comments
 (0)