From 8a474a3082ebc6f9169c9e55631a6787ecdb64d5 Mon Sep 17 00:00:00 2001 From: adibwp Date: Thu, 2 May 2024 14:03:40 +0700 Subject: [PATCH 1/2] create component footer --- go.mod | 3 +- go.sum | 16 +------- views/landingpage/footer.templ | 72 ++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 16 deletions(-) create mode 100644 views/landingpage/footer.templ diff --git a/go.mod b/go.mod index da7c5a1..bda6003 100644 --- a/go.mod +++ b/go.mod @@ -4,14 +4,13 @@ go 1.21.0 require ( github.com/a-h/templ v0.2.663 + github.com/glebarez/go-sqlite v1.22.0 github.com/labstack/echo/v4 v4.11.3 - github.com/mattn/go-sqlite3 v1.14.19 golang.org/x/text v0.14.0 ) require ( github.com/dustin/go-humanize v1.0.1 // indirect - github.com/glebarez/go-sqlite v1.22.0 // indirect github.com/golang-jwt/jwt v3.2.2+incompatible // indirect github.com/google/uuid v1.5.0 // indirect github.com/labstack/gommon v0.4.0 // indirect diff --git a/go.sum b/go.sum index 449e0d0..0f02fb0 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,3 @@ -github.com/a-h/templ v0.2.476 h1:+H4hP4CwK4kfJwXsE6kHeFWMGtcVOVoOm/I64uzARBk= -github.com/a-h/templ v0.2.476/go.mod h1:zQ95mSyadNTGHv6k5Fm+wQU8zkBMMbHCHg7eAvUZKNM= github.com/a-h/templ v0.2.663 h1:aa0WMm27InkYHGjimcM7us6hJ6BLhg98ZbfaiDPyjHE= github.com/a-h/templ v0.2.663/go.mod h1:SA7mtYwVEajbIXFRh3vKdYm/4FYyLQAtPH1+KxzGPA8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -13,6 +11,8 @@ github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keL github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbuBVKCudVG457BR2GZFIz3uw3hQ= +github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo= github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/labstack/echo/v4 v4.11.3 h1:Upyu3olaqSHkCjs1EJJwQ3WId8b8b1hxbogyommKktM= @@ -24,12 +24,8 @@ github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxec github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= -github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= 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/mattn/go-sqlite3 v1.14.19 h1:fhGleo2h1p8tVChob4I9HpmVFIAkKGpiukdrgQbWfGI= -github.com/mattn/go-sqlite3 v1.14.19/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= @@ -43,12 +39,8 @@ github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyC github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= 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.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= 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-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -56,12 +48,8 @@ golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 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.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.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.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= diff --git a/views/landingpage/footer.templ b/views/landingpage/footer.templ new file mode 100644 index 0000000..120127c --- /dev/null +++ b/views/landingpage/footer.templ @@ -0,0 +1,72 @@ +package landingpage + +templ FooterSection() { + +} \ No newline at end of file From f4c7507e6d4c31989c1e78d238c7176b04dc432d Mon Sep 17 00:00:00 2001 From: adibwp Date: Thu, 2 May 2024 16:58:26 +0700 Subject: [PATCH 2/2] footer + responsive layout --- handlers/landingpage.handlers.go | 7 +- services/landingpage.services.go | 82 +++++++++++++ views/landingpage/footer.templ | 164 +++++++++++++++++--------- views/landingpage/footer_templ.go | 184 ++++++++++++++++++++++++++++++ 4 files changed, 384 insertions(+), 53 deletions(-) create mode 100644 views/landingpage/footer_templ.go diff --git a/handlers/landingpage.handlers.go b/handlers/landingpage.handlers.go index 84e332a..1e4510d 100644 --- a/handlers/landingpage.handlers.go +++ b/handlers/landingpage.handlers.go @@ -14,6 +14,7 @@ type LandingPageService interface { GetClientService() ([]services.ClientService, error) GetClientAdvantage() ([]services.AdvantageClient, error) GetPromotionList() ([]services.Promotion, error) + GetFooterNavList() ([]services.FooterNav, error) } func NewLandingPageHandler(us LandingPageService) *LandingPageHandler { @@ -42,11 +43,15 @@ func (uh *LandingPageHandler) ShowLandingPage(c echo.Context) error { // fmt.Println(err) return err } + ftNav, err := uh.LandingPageService.GetFooterNavList() + if err != nil { + return err + } fmt.Printf("%+v\n", udata) helo := landingpage.ShowLandingPage("Hello World", landingpage.MainLandingPage(landingpage.ListMedicalService(udata), landingpage.ListAdvantage(adData), landingpage.ListPromotion(lpData), - landingpage.Footer()), + landingpage.FooterSection(ftNav)), landingpage.CssLandingPage(), landingpage.JsLandingPage()) return uh.View(c, helo) diff --git a/services/landingpage.services.go b/services/landingpage.services.go index 419a1ef..efae3b9 100644 --- a/services/landingpage.services.go +++ b/services/landingpage.services.go @@ -40,6 +40,18 @@ type Promotion struct { PromotionLink string `json:"PromotionLink"` } +type FooterSubNav struct { + FootSubNavID int `json:"FootSubNavID"` + FootSubNavTitle string `json:"FootSubNavTitle"` + FootSubNavLink string `json:"FootSubNavLink"` +} + +type FooterNav struct { + FooterNavID int `json:"FooterNavID"` + FooterNavTitle string `json:"FooterNavTitle"` + FooteSubNav []FooterSubNav `json:"FooterSubNav,omitempty"` +} + type ServicesLandingPage struct { LandingPage LandingPage LandingPageStore db.LandingPageStore @@ -203,3 +215,73 @@ func (su *ServicesLandingPage) GetPromotionList() ([]Promotion, error) { return data, nil } +func (su *ServicesLandingPage) GetFooterNavList() ([]FooterNav, error) { + data := []FooterNav{ + { + FooterNavID: 1, + FooterNavTitle: "Dashboard", + FooteSubNav: []FooterSubNav{ + { + FootSubNavID: 1, + FootSubNavTitle: "Dashboard #1", + FootSubNavLink: "/", + }, + { + FootSubNavID: 2, + FootSubNavTitle: "Dashboard #2", + FootSubNavLink: "/", + }, + }, + }, + { + FooterNavID: 2, + FooterNavTitle: "Benefit", + FooteSubNav: []FooterSubNav{ + { + FootSubNavID: 1, + FootSubNavTitle: "Benefit #1", + FootSubNavLink: "/", + }, + { + FootSubNavID: 2, + FootSubNavTitle: "Benefit #2", + FootSubNavLink: "/", + }, + }, + }, + { + FooterNavID: 3, + FooterNavTitle: "Finance & Claims", + FooteSubNav: []FooterSubNav{ + { + FootSubNavID: 1, + FootSubNavTitle: "Finance & Claims #1", + FootSubNavLink: "/", + }, + { + FootSubNavID: 2, + FootSubNavTitle: "Finance & Claims #2", + FootSubNavLink: "/", + }, + }, + }, + { + FooterNavID: 4, + FooterNavTitle: "Memberships", + FooteSubNav: []FooterSubNav{ + { + FootSubNavID: 1, + FootSubNavTitle: "Memberships #1", + FootSubNavLink: "/", + }, + { + FootSubNavID: 2, + FootSubNavTitle: "Memberships #2", + FootSubNavLink: "/", + }, + }, + }, + } + + return data, nil +} diff --git a/views/landingpage/footer.templ b/views/landingpage/footer.templ index 120127c..16b5c73 100644 --- a/views/landingpage/footer.templ +++ b/views/landingpage/footer.templ @@ -1,58 +1,118 @@ package landingpage -templ FooterSection() { +import "github.com/emarifer/go-templ-project-structure/services" + +templ FooterContact() { +
+ +
+ +
+
+ // + +
+
+
+
+ +
+
+ // for _, d := range phone { + // + // } + + + +
+
+} + +templ FooterNav(title string, data []services.FooterSubNav) { +
+ + for _, d := range data { +
+ { d.FootSubNavTitle } +
+ } +
+} + +templ FooterSection(navlist []services.FooterNav) {