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

View File

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

View File

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

View File

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