diff --git a/constants/projects.go b/constants/projects.go new file mode 100644 index 0000000..8996467 --- /dev/null +++ b/constants/projects.go @@ -0,0 +1,8 @@ +package constants + +type Project struct { + Url string + Name string + Description string + TechTags []string +} diff --git a/main.go b/main.go index a483409..089ba81 100644 --- a/main.go +++ b/main.go @@ -6,6 +6,7 @@ import ( "net/http" "os" "os/signal" + "personal-site/constants" "personal-site/handlers" "personal-site/pages" "syscall" @@ -22,6 +23,24 @@ func setupRoutesAndMiddleware() *gin.Engine { page := pages.Index() page.Render(c.Request.Context(), c.Writer) }) + var projects = []constants.Project{ + { + Url: "https://derrickgee.dev/projects/support-tickets", + Name: "Project One", + Description: "A simple Go Gin + Templ app demonstrating the project pattern.", + TechTags: []string{"Typescript", "Javascript", "React", "Express"}, + }, + { + Url: "https://derrickgee.dev/projects/support-tickets", + Name: "Project Two", + Description: "A simple Go Gin + Templ app demonstrating the project pattern.", + TechTags: []string{"Go", "Bash"}, + }, + } + r.GET("/projects", func(c *gin.Context) { + page := pages.ProjectPage(projects) + page.Render(c.Request.Context(), c.Writer) + }) r.NoRoute(handlers.NotFoundHandler) return r } diff --git a/pages/projects.templ b/pages/projects.templ new file mode 100644 index 0000000..ea81b9f --- /dev/null +++ b/pages/projects.templ @@ -0,0 +1,48 @@ +package pages + +import "personal-site/constants" +import "fmt" +import "personal-site/components" + +templ projectCard(idx int, project constants.Project) { + +
+
+ { project.Name } +
+

{ project.Description }

+
+ for _, tag := range project.TechTags { + { tag } + } +
+
+
+ + + +
+
+} + +templ ProjectPage(projects []constants.Project) { + {{ params := constants.NewLayoutParams("Home") }} + @components.MainLayout(params) { +
+

derrickgee.dev/projects

+

Projects Directory

+

+ A collection of projects built across different languages and frameworks. + Each runs as an independent service. +

+
+
+ for idx, p := range projects { + @projectCard(idx, p) + } + } +}