diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..721c661 --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +run: + @templ generate + @go run cmd/main.go diff --git a/BSI-Portrait_Lorenz_Q.jpg b/assets/BSI-Portrait_Lorenz_Q.jpg similarity index 100% rename from BSI-Portrait_Lorenz_Q.jpg rename to assets/BSI-Portrait_Lorenz_Q.jpg diff --git a/assets/robot.png b/assets/robot.png new file mode 100644 index 0000000..00da917 Binary files /dev/null and b/assets/robot.png differ diff --git a/assets/test.jpg b/assets/test.jpg new file mode 100644 index 0000000..311d563 Binary files /dev/null and b/assets/test.jpg differ diff --git a/cmd/main.go b/cmd/main.go new file mode 100644 index 0000000..87c69d2 --- /dev/null +++ b/cmd/main.go @@ -0,0 +1,16 @@ +package main + +import ( + "github.com/labstack/echo/v4" + "github.com/lorenzhohermuth/portfolio/internal/handler" +) + +func main() { + app := echo.New() + + h := handler.Homehandler{} + app.GET("/", h.HandleUserShow) + app.Static("/static", "assets") + + app.Start(":3030") +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..4a68653 --- /dev/null +++ b/go.mod @@ -0,0 +1,17 @@ +module github.com/lorenzhohermuth/portfolio + +go 1.22.1 + +require ( + github.com/a-h/templ v0.2.648 // indirect + github.com/labstack/echo/v4 v4.11.4 // indirect + github.com/labstack/gommon v0.4.2 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/valyala/bytebufferpool v1.0.0 // indirect + github.com/valyala/fasttemplate v1.2.2 // indirect + golang.org/x/crypto v0.17.0 // indirect + golang.org/x/net v0.19.0 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..707f5c5 --- /dev/null +++ b/go.sum @@ -0,0 +1,25 @@ +github.com/a-h/templ v0.2.648 h1:A1ggHGIE7AONOHrFaDTM8SrqgqHL6fWgWCijQ21Zy9I= +github.com/a-h/templ v0.2.648/go.mod h1:SA7mtYwVEajbIXFRh3vKdYm/4FYyLQAtPH1+KxzGPA8= +github.com/labstack/echo/v4 v4.11.4 h1:vDZmA+qNeh1pd/cCkEicDMrjtrnMGQ1QFI9gWN1zGq8= +github.com/labstack/echo/v4 v4.11.4/go.mod h1:noh7EvLwqDsmh/X/HWKPUl1AjzJrhyptRyEbQJfxen8= +github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0= +github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= +github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= diff --git a/internal/handler/handler.go b/internal/handler/handler.go new file mode 100644 index 0000000..7783fde --- /dev/null +++ b/internal/handler/handler.go @@ -0,0 +1,12 @@ +package handler + +import ( + "github.com/labstack/echo/v4" + "github.com/lorenzhohermuth/portfolio/view/page" +) + +type Homehandler struct {} + +func(h Homehandler) HandleUserShow(ctx echo.Context) error { + return render(ctx, page.ShowHome()) +} diff --git a/internal/handler/util.go b/internal/handler/util.go new file mode 100644 index 0000000..0c45c7a --- /dev/null +++ b/internal/handler/util.go @@ -0,0 +1,10 @@ +package handler + +import ( + "github.com/a-h/templ" + "github.com/labstack/echo/v4" +) + +func render(ctx echo.Context, component templ.Component) error { + return component.Render(ctx.Request().Context(), ctx.Response()) +} diff --git a/view/component/carousel.templ b/view/component/carousel.templ new file mode 100644 index 0000000..5cfac60 --- /dev/null +++ b/view/component/carousel.templ @@ -0,0 +1,22 @@ +package component + +type CarouselEntry struct { + ImgPath string + Title string + Text string +} + +templ Carousel(elm CarouselEntry) { +
{elm.Title}
+{elm.Text}
+") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var3 string + templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(elm.Title) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/component/carousel.templ`, Line: 16, Col: 69} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var4 string + templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(elm.Text) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/component/carousel.templ`, Line: 20, Col: 44} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("