Skip to content

Commit fe3010e

Browse files
some styles and home page
1 parent 71331dd commit fe3010e

File tree

6 files changed

+27
-24
lines changed

6 files changed

+27
-24
lines changed

frontend/public/index.css

+7-9
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
}
108108

109109
/*
110-
! tailwindcss v3.4.12 | MIT License | https://tailwindcss.com
110+
! tailwindcss v3.4.13 | MIT License | https://tailwindcss.com
111111
*/
112112

113113
/*
@@ -2935,14 +2935,8 @@ input.tab:checked + .tab-content,
29352935
margin: 0px;
29362936
}
29372937

2938-
.mx-auto {
2939-
margin-left: auto;
2940-
margin-right: auto;
2941-
}
2942-
2943-
.my-2 {
2944-
margin-top: 0.5rem;
2945-
margin-bottom: 0.5rem;
2938+
.m-2 {
2939+
margin: 0.5rem;
29462940
}
29472941

29482942
.mb-5 {
@@ -3237,6 +3231,10 @@ input.tab:checked + .tab-content,
32373231
padding: 0.25rem;
32383232
}
32393233

3234+
.p-10 {
3235+
padding: 2.5rem;
3236+
}
3237+
32403238
.p-2 {
32413239
padding: 0.5rem;
32423240
}

v2/library/web/comp/assetcard.templ

+7-9
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ css bgimg(url string) {
1212

1313
templ AssetCard(m *AssetCardModel) {
1414
<div
15-
class="asset-card justi mx-auto my-2 flex h-56 grow-0 basis-56 flex-col items-center justify-end shadow-md"
15+
class="asset-card m-2 flex h-56 grow-0 basis-56 flex-col items-center justify-end shadow-md"
1616
>
1717
<div
1818
class={ "img flex-basis-56 w-full bgimg_b670 rounded-lg bg-gray-300 bg-cover bg-center", bgimg(utils.VoZ(m.Asset.Thumbnail)) }
@@ -27,7 +27,7 @@ templ AssetCard(m *AssetCardModel) {
2727
<div class="overlay rounded-lg"></div>
2828
</div>
2929
<div class="z-10 flex max-w-56 justify-center pb-2">
30-
@NodeKindIcon(m.Asset)
30+
@AssetKindIcon(m.Asset)
3131
<div class="truncate px-2 text-white">{ *m.Asset.Label }</div>
3232
</div>
3333
<div class="controls relative z-10 p-1" onclick="event.stopPropagation();">
@@ -58,14 +58,12 @@ templ AssetCard(m *AssetCardModel) {
5858
</div>
5959
}
6060

61-
templ NodeKindIcon(asset *entities.Asset) {
62-
switch asset.NodeKind {
63-
case entities.NodeKindDir:
64-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="h-5 w-5" stroke="currentColor"><title>folder-outline</title><path stroke-width="2" d="M20,18H4V8H20M20,6H12L10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6Z"></path></svg>
65-
case entities.NodeKindBundle:
66-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="h-5 w-5" stroke="currentColor"><title>folder-zip-outline</title><path d="M20 6H12L10 4H4C2.9 4 2 4.9 2 6V18C2 19.1 2.9 20 4 20H20C21.1 20 22 19.1 22 18V8C22 6.9 21.1 6 20 6M20 18H16V16H14V18H4V8H14V10H16V8H20V18M16 12V10H18V12H16M14 12H16V14H14V12M18 16H16V14H18V16Z"></path></svg>
67-
}
61+
templ AssetKindIcon(asset *entities.Asset) {
6862
switch utils.VoZ(asset.Kind) {
63+
case "bundle":
64+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="h-5 w-5" stroke="currentColor"><title>folder-zip-outline</title><path d="M20 6H12L10 4H4C2.9 4 2 4.9 2 6V18C2 19.1 2.9 20 4 20H20C21.1 20 22 19.1 22 18V8C22 6.9 21.1 6 20 6M20 18H16V16H14V18H4V8H14V10H16V8H20V18M16 12V10H18V12H16M14 12H16V14H14V12M18 16H16V14H18V16Z"></path></svg>
65+
case "dir":
66+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="h-5 w-5" stroke="currentColor"><title>folder-outline</title><path stroke-width="2" d="M20,18H4V8H20M20,6H12L10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6Z"></path></svg>
6967
case "file":
7068
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="h-5 w-5" stroke="currentColor"><title>file-outline</title><path d="M14 2H6C4.89 2 4 2.89 4 4V20C4 21.11 4.9 22 6 22H18C19.11 22 20 21.11 20 20V8L14 2Z"></path></svg>
7169
case "image":

v2/web/comp/home.templ

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package comp
2+
3+
templ Home() {
4+
<main class="p-10">
5+
<h1>Welcome to MMP:v2</h1>
6+
<p>To navigate to your library click <a hx-target=".main" hx-boost="true" href="/lib">Here</a></p>
7+
</main>
8+
}

v2/web/comp/wrapper.templ

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ templ WrapperComponent(model WrapperModel) {
2525
<a
2626
class="tooltip tooltip-right"
2727
data-tip="Home"
28-
href="/"
28+
href="/home"
2929
:class="$store.context.current == '' ? 'active' : ''"
3030
>
3131
<svg

v2/web/index.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@ package web
33
import (
44
"net/http"
55

6-
"github.com/a-h/templ"
76
"github.com/eduardooliveira/stLib/v2/web/comp"
87
)
98

109
func (h webHandler) indexHandler(r *http.Request) ResponseModel {
1110
return ResponseModel{
1211
Status: http.StatusOK,
1312
Component: comp.WrapperComponent(comp.WrapperModel{
14-
Main: templ.NopComponent,
13+
Main: comp.Home(),
1514
}),
1615
IsFragment: true,
1716
}

v2/web/web.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ func New() (http.Handler, error) {
2020
}
2121
mux := http.NewServeMux()
2222
mux.HandleFunc("/", R(wh.indexHandler))
23+
mux.HandleFunc("/home", R(RenderFragment(comp.Home())))
2324
return mux, nil
2425
}
2526

@@ -39,9 +40,8 @@ func RenderIndex(path string) error {
3940
func RenderFragment(frag templ.Component) func(r *http.Request) ResponseModel {
4041
return func(r *http.Request) ResponseModel {
4142
return ResponseModel{
42-
Status: http.StatusOK,
43-
IsFragment: true,
44-
Component: frag,
43+
Status: http.StatusOK,
44+
Component: frag,
4545
}
4646
}
4747
}

0 commit comments

Comments
 (0)