refactor(middlewares,router): follow http package structure and interfaces
This commit is contained in:
52
routes/index.templ
Normal file
52
routes/index.templ
Normal file
@@ -0,0 +1,52 @@
|
||||
package routes
|
||||
|
||||
import (
|
||||
"extrovert/templates/layouts"
|
||||
"extrovert/components"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type Homepage struct{}
|
||||
|
||||
func (h Homepage) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
_ = h.page().Render(context.Background(), w)
|
||||
}
|
||||
|
||||
templ (h Homepage) page() {
|
||||
@layouts.Page("Project Extrovert") {
|
||||
<div style="max-width:50rem;">
|
||||
<div style="display:flex;flex-direction:column;gap:1rem;">
|
||||
<main
|
||||
style="height:15rem"
|
||||
>
|
||||
<aside
|
||||
style="height:100%;display:flex;gap:2rem;"
|
||||
>
|
||||
<div style="display:flex;flex-direction:column;gap:1rem;width:15rem;">
|
||||
@components.LoginTwitter()
|
||||
@components.LoginMastodon()
|
||||
</div>
|
||||
<fieldset>
|
||||
<textarea
|
||||
style="height:100%;resize:none;"
|
||||
name="post"
|
||||
placeholder="Write a post..."
|
||||
aria-label="Post input"
|
||||
></textarea>
|
||||
</fieldset>
|
||||
</aside>
|
||||
</main>
|
||||
<footer>
|
||||
@components.Warning("In Development") {
|
||||
<strong>
|
||||
This application is in active development and should not be used in production.
|
||||
</strong>
|
||||
Expect bugs, lost data, logouts, etc. Use it at your own risk.
|
||||
This software is provided "as is", without any warranty of any kind.
|
||||
}
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user