Skip to content

Commit

Permalink
some styles and home page
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardoOliveira committed Sep 26, 2024
1 parent 71331dd commit fe3010e
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 24 deletions.
16 changes: 7 additions & 9 deletions frontend/public/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
}

/*
! tailwindcss v3.4.12 | MIT License | https://tailwindcss.com
! tailwindcss v3.4.13 | MIT License | https://tailwindcss.com
*/

/*
Expand Down Expand Up @@ -2935,14 +2935,8 @@ input.tab:checked + .tab-content,
margin: 0px;
}

.mx-auto {
margin-left: auto;
margin-right: auto;
}

.my-2 {
margin-top: 0.5rem;
margin-bottom: 0.5rem;
.m-2 {
margin: 0.5rem;
}

.mb-5 {
Expand Down Expand Up @@ -3237,6 +3231,10 @@ input.tab:checked + .tab-content,
padding: 0.25rem;
}

.p-10 {
padding: 2.5rem;
}

.p-2 {
padding: 0.5rem;
}
Expand Down
16 changes: 7 additions & 9 deletions v2/library/web/comp/assetcard.templ
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ css bgimg(url string) {

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

templ NodeKindIcon(asset *entities.Asset) {
switch asset.NodeKind {
case entities.NodeKindDir:
<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>
case entities.NodeKindBundle:
<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>
}
templ AssetKindIcon(asset *entities.Asset) {
switch utils.VoZ(asset.Kind) {
case "bundle":
<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>
case "dir":
<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>
case "file":
<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>
case "image":
Expand Down
8 changes: 8 additions & 0 deletions v2/web/comp/home.templ
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package comp

templ Home() {
<main class="p-10">
<h1>Welcome to MMP:v2</h1>
<p>To navigate to your library click <a hx-target=".main" hx-boost="true" href="/lib">Here</a></p>
</main>
}
2 changes: 1 addition & 1 deletion v2/web/comp/wrapper.templ
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ templ WrapperComponent(model WrapperModel) {
<a
class="tooltip tooltip-right"
data-tip="Home"
href="/"
href="/home"
:class="$store.context.current == '' ? 'active' : ''"
>
<svg
Expand Down
3 changes: 1 addition & 2 deletions v2/web/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ package web
import (
"net/http"

"github.com/a-h/templ"
"github.com/eduardooliveira/stLib/v2/web/comp"
)

func (h webHandler) indexHandler(r *http.Request) ResponseModel {
return ResponseModel{
Status: http.StatusOK,
Component: comp.WrapperComponent(comp.WrapperModel{
Main: templ.NopComponent,
Main: comp.Home(),
}),
IsFragment: true,
}
Expand Down
6 changes: 3 additions & 3 deletions v2/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func New() (http.Handler, error) {
}
mux := http.NewServeMux()
mux.HandleFunc("/", R(wh.indexHandler))
mux.HandleFunc("/home", R(RenderFragment(comp.Home())))
return mux, nil
}

Expand All @@ -39,9 +40,8 @@ func RenderIndex(path string) error {
func RenderFragment(frag templ.Component) func(r *http.Request) ResponseModel {
return func(r *http.Request) ResponseModel {
return ResponseModel{
Status: http.StatusOK,
IsFragment: true,
Component: frag,
Status: http.StatusOK,
Component: frag,
}
}
}

0 comments on commit fe3010e

Please sign in to comment.