diff --git a/components/project_card.templ b/components/project_card.templ new file mode 100644 index 0000000..4853950 --- /dev/null +++ b/components/project_card.templ @@ -0,0 +1,74 @@ +package components + +import "strings" +import "slices" +import "cmp" + +type Project struct { + Name string + Summary string + Image templ.SafeURL + Link templ.SafeURL + Icon string + WIP bool + Current bool + Language string +} + +func SortProjects(projects []Project) []Project { + slices.SortFunc(projects, func(a, b Project) int { + if (a.Current && !b.Current) || (a.WIP && !b.WIP) { + return -1 + } + return cmp.Compare(a.Name, b.Name) + }) + return projects +} + +templ ProjectCard(project Project) { +
+ +
+
+

+ { project.Name } +

+

+ if project.Current { + Current + } + if project.WIP { + + WIP + + } +

+
+

+ { project.Summary } +

+ +
+
+} diff --git a/pages/homepage.templ b/pages/homepage.templ index d45b915..442e3b8 100644 --- a/pages/homepage.templ +++ b/pages/homepage.templ @@ -5,6 +5,39 @@ import ( "www/components" ) +var mockProjects = []components.Project{ + { + Name: "rec-sh", + Summary: "Lorem ipsum dolor sit amet, qui minim labore adipisicing minim sint cillum sint consectetur cupidatat.", + Link: templ.SafeURL("https://github.com/dot013/rec-sh"), + Image: templ.SafeURL("https://images.unsplash.com/photo-1461749280684-dccba630e2f6?q=80&w=2669&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"), + Icon: "i-solar:programming-bold", + WIP: false, + Current: false, + Language: "bash", + }, + { + Name: ".mdparser", + Summary: "Lorem ipsum dolor sit amet, qui minim labore adipisicing minim sint cillum sint consectetur cupidatat.", + Link: templ.SafeURL("https://github.com/dot013/rec-sh"), + Image: templ.SafeURL("https://images.unsplash.com/photo-1560697024-fd4affa63094?q=80&w=2630&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"), + Icon: "i-simple-icons:rust", + WIP: true, + Current: false, + Language: "rust", + }, + { + Name: ".www", + Summary: "Lorem ipsum dolor sit amet, qui minim labore adipisicing minim sint cillum sint consectetur cupidatat.", + Link: templ.SafeURL("https://github.com/dot013/.www"), + Image: templ.SafeURL("https://images.unsplash.com/photo-1461749280684-dccba630e2f6?q=80&w=2669&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"), + Icon: "i-simple-icons:go", + WIP: true, + Current: true, + Language: "golang", + }, +} + templ Homepage() { @layouts.Page("013") { @components.Nav([]components.Link{ @@ -66,6 +99,23 @@ templ Homepage() { consectetur et est culpa et culpa duis.

+
+

Projects.

+
+ for i, project := range components.SortProjects(mockProjects) { + if i == 0 { + + @components.ProjectCard(project) + + } else { + @components.ProjectCard(project) + } + } +
+