modify some visuals

This commit is contained in:
goo987 2025-05-29 19:26:25 +07:00
parent 7402fcacf6
commit e8e5ee6af3
4 changed files with 49 additions and 51 deletions

View File

@ -3,43 +3,47 @@ package component
import "git.proximination.com/pclatihan/wstempl/model"
templ BarangView(mdl model.Barang) {
<div class="">
<h1>{ mdl.Nama }</h1>
<div class="">{ mdl.Merk }</div>
<table>
<tr>
<td>PANJANG</td>
<td>{ mdl.Panjang }</td>
</tr>
<tr>
<td>LEBAR</td>
<td>{ mdl.Lebar }</td>
</tr>
<tr>
<td>TINGGI</td>
<td>{ mdl.Tinggi }</td>
</tr>
<tr>
<td>SATUAN</td>
<td>{ mdl.Unit }</td>
</tr>
<tr>
<td>STATUS</td>
<td>{ mdl.Status }</td>
</tr>
</table>
<a href="/">BACK</a>
</div>
<div class="max-w-xl mx-auto bg-white p-6 rounded-xl shadow-md">
<h1 class="text-2xl font-bold mb-4 text-blue-700">{ mdl.Nama }</h1>
<p class="text-gray-600 mb-2">Merk: <span class="font-semibold">{ mdl.Merk }</span></p>
<table class="w-full border border-gray-300 rounded text-sm">
<tr class="bg-gray-50">
<td class="p-2 font-semibold">Panjang</td>
<td class="p-2">{ mdl.Panjang }</td>
</tr>
<tr>
<td class="p-2 font-semibold">Lebar</td>
<td class="p-2">{ mdl.Lebar }</td>
</tr>
<tr class="bg-gray-50">
<td class="p-2 font-semibold">Tinggi</td>
<td class="p-2">{ mdl.Tinggi }</td>
</tr>
<tr>
<td class="p-2 font-semibold">Satuan</td>
<td class="p-2">{ mdl.Unit }</td>
</tr>
<tr class="bg-gray-50">
<td class="p-2 font-semibold">Status</td>
<td class="p-2">{ mdl.Status }</td>
</tr>
<tr>
<td class="p-2 font-semibold">Warna</td>
<td class="p-2">{ mdl.Warna }</td>
</tr>
</table>
<a href="/" class="inline-block mt-4 text-blue-600 hover:underline">← Kembali ke daftar</a>
</div>
}
templ DaftarBarangView(mdl model.DaftarBarang) {
@Common("DAFTAR") {
<ul>
for _, item := range mdl.Items {
<li>
<a href={ templ.SafeURL(item.Url) }>{ item.Nama }</a>
</li>
}
</ul>
<ul class="list-disc list-inside text-blue-700 space-y-2">
for _, item := range mdl.Items {
<li>
<a class="hover:underline" href={ templ.SafeURL(item.Url) }>{ item.Nama }</a>
</li>
}
</ul>
}
}

View File

@ -1,24 +1,16 @@
package component
templ Common(pagename string) {
<!DOCTYPE html>
<html lang="en">
templ Common(title string) {
<html>
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>{ pagename }</title>
<title>{ title }</title>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet" />
</head>
<body>
<nav>
<a href="/">HOME</a>
<a href="/about-us">about us</a>
<a href="/profile">profile</a>
<a href="/contact">Contact</a>
<a href="/contact1">Contact1</a>
<a href="/contact2">Contact2</a>
<a href="/contact3">Contact3</a>
</nav>
{ children... }
<body class="bg-gray-100 text-gray-800">
<main class="min-h-screen py-10">
{ children... }
</main>
</body>
</html>
}

View File

@ -22,6 +22,7 @@ func (m MockV2) GetBarang(nama string) (model.Barang, error) {
Tinggi: gofakeit.Numerify("#"),
Unit: gofakeit.AppName(),
Status: gofakeit.RandomString([]string{"Sehat", "Rusak", "Dicuri Orang"}),
Warna : gofakeit.Color(),
}
return model, nil
}

View File

@ -8,4 +8,5 @@ type Barang struct {
Tinggi string
Unit string
Status string
Warna string
}