-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
restructure and add tailwind, daisy-ui and htmx
- Loading branch information
Dennis Werner
authored and
Dennis Werner
committed
Jun 5, 2024
1 parent
448a350
commit cf3c948
Showing
11 changed files
with
87 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
*_templ.go | ||
*_templ.go | ||
blokhouse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package api | ||
|
||
type API struct{} | ||
|
||
func NewAPI() API { | ||
return API{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package ui | ||
|
||
templ Index() { | ||
@template(){ | ||
<div> hello world </div> | ||
<div><button hx-post="/clicked" hx-swap="outerHTML"> | ||
Click Me | ||
</button> | ||
</div> | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package ui | ||
|
||
templ template() { | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/full.min.css" rel="stylesheet" type="text/css" /> | ||
<script src="https://cdn.tailwindcss.com"></script> | ||
<script src="https://unpkg.com/[email protected]"></script> | ||
</head> | ||
<body> | ||
{ children... } | ||
</body> | ||
</html> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package ui | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/a-h/templ" | ||
ui "github.com/d4sw4r/blokhouse/web/ui/view" | ||
"github.com/labstack/echo/v4" | ||
) | ||
|
||
// This custom Render replaces Echo's echo.Context.Render() with templ's templ.Component.Render(). | ||
func Render(ctx echo.Context, statusCode int, t templ.Component) error { | ||
buf := templ.GetBuffer() | ||
defer templ.ReleaseBuffer(buf) | ||
|
||
if err := t.Render(ctx.Request().Context(), buf); err != nil { | ||
return err | ||
} | ||
|
||
return ctx.HTML(statusCode, buf.String()) | ||
} | ||
|
||
func IndexHandler(c echo.Context) error { | ||
return Render(c, http.StatusOK, ui.Index()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.