2024-05-18 13:43:22 +02:00
|
|
|
package components
|
|
|
|
|
|
|
|
|
|
import (
|
2024-05-18 15:22:35 +02:00
|
|
|
"github.com/delaneyj/gomponents-iconify/iconify/mdi"
|
2024-05-18 13:43:22 +02:00
|
|
|
g "github.com/maragudk/gomponents"
|
|
|
|
|
. "github.com/maragudk/gomponents/html"
|
2024-05-18 15:22:35 +02:00
|
|
|
b "github.com/willoma/bulma-gomponents"
|
|
|
|
|
e "github.com/willoma/gomplements"
|
2024-06-24 15:50:57 +02:00
|
|
|
"portfolio/database/ent"
|
2024-07-04 12:02:43 +02:00
|
|
|
"strconv"
|
2024-05-18 13:43:22 +02:00
|
|
|
)
|
|
|
|
|
|
2024-06-24 15:50:57 +02:00
|
|
|
func ProjectList(projects []*ent.Project) g.Node {
|
|
|
|
|
return Div(Class("py-2 px-2"), g.Group(g.Map(projects, func(p *ent.Project) g.Node {
|
2024-05-18 15:22:35 +02:00
|
|
|
return Project(p)
|
|
|
|
|
})),
|
2024-05-18 13:43:22 +02:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-24 15:50:57 +02:00
|
|
|
func Project(project *ent.Project) g.Node {
|
2024-05-18 15:22:35 +02:00
|
|
|
return b.Card(
|
|
|
|
|
b.Media(
|
|
|
|
|
b.MediaLeft(
|
|
|
|
|
b.ImageImg(
|
2024-06-24 15:50:57 +02:00
|
|
|
project.ImageURL,
|
2024-05-18 15:22:35 +02:00
|
|
|
e.Alt("project image"),
|
|
|
|
|
b.ImgSq64,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
b.Title(4, project.Name),
|
2024-05-19 00:21:08 +02:00
|
|
|
b.Subtitle(
|
|
|
|
|
6,
|
2024-06-24 15:50:57 +02:00
|
|
|
A(Class("flex"), Href(project.URL), mdi.Github(), g.Text("Checkout repo")),
|
|
|
|
|
A(Class("flex"), Href(project.DocURL), mdi.Document(), g.Text("Docs"))),
|
2024-05-18 15:22:35 +02:00
|
|
|
),
|
|
|
|
|
b.Content(
|
2024-05-19 00:21:08 +02:00
|
|
|
g.Raw(project.Description),
|
2024-05-18 15:22:35 +02:00
|
|
|
),
|
2024-05-18 13:43:22 +02:00
|
|
|
)
|
|
|
|
|
}
|
2024-06-25 00:26:56 +02:00
|
|
|
|
|
|
|
|
func EditProjectList(projects []*ent.Project) g.Node {
|
|
|
|
|
return Div(Class("py-2 px-2"), g.Group(g.Map(projects, func(p *ent.Project) g.Node {
|
|
|
|
|
return EditProject(p)
|
|
|
|
|
})),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func EditProject(project *ent.Project) g.Node {
|
|
|
|
|
return b.Card(
|
|
|
|
|
b.Media(
|
|
|
|
|
b.MediaLeft(
|
|
|
|
|
b.ImageImg(
|
|
|
|
|
project.ImageURL,
|
|
|
|
|
e.Alt("project image"),
|
|
|
|
|
b.ImgSq64,
|
|
|
|
|
),
|
|
|
|
|
),
|
2024-07-04 12:02:43 +02:00
|
|
|
Input(Type("hidden"), Value(strconv.Itoa(project.ID)), Name("project_id")),
|
|
|
|
|
//b.Label("ID: "+strconv.Itoa(project.ID), Name("project_id")),
|
2024-06-25 00:26:56 +02:00
|
|
|
b.Label("Name"),
|
2024-07-04 12:02:43 +02:00
|
|
|
b.Textarea(project.Name, b.Rows(1), Name("project_name")),
|
2024-06-25 00:26:56 +02:00
|
|
|
b.Subtitle(
|
|
|
|
|
6,
|
|
|
|
|
b.Label("Repo"),
|
2024-07-04 12:02:43 +02:00
|
|
|
b.Textarea(project.URL, b.Rows(1), Name("project_repo")),
|
2024-06-25 00:26:56 +02:00
|
|
|
b.Label("Docs"),
|
2024-07-04 12:02:43 +02:00
|
|
|
b.Textarea(project.DocURL, b.Rows(1), Name("project_docs"))),
|
2024-06-25 00:26:56 +02:00
|
|
|
),
|
|
|
|
|
b.Content(
|
2024-07-04 12:02:43 +02:00
|
|
|
b.Textarea(project.Description, Name("project_description")),
|
2024-06-25 00:26:56 +02:00
|
|
|
),
|
2024-07-04 12:02:43 +02:00
|
|
|
|
|
|
|
|
//b.CardFooter(
|
|
|
|
|
//Save(),
|
|
|
|
|
//),
|
2024-06-25 00:26:56 +02:00
|
|
|
)
|
|
|
|
|
}
|