initial
This commit is contained in:
commit
5721ea14a9
29 changed files with 2714 additions and 0 deletions
0
.gitignore
vendored
Normal file
0
.gitignore
vendored
Normal file
0
README.md
Normal file
0
README.md
Normal file
5
gothkit/cmd/gothkit/main.go
Normal file
5
gothkit/cmd/gothkit/main.go
Normal file
|
@ -0,0 +1,5 @@
|
|||
package main
|
||||
|
||||
func main() {
|
||||
|
||||
}
|
5
gothkit/go.mod
Normal file
5
gothkit/go.mod
Normal file
|
@ -0,0 +1,5 @@
|
|||
module github.com/anthdm/gothkit
|
||||
|
||||
go 1.22.0
|
||||
|
||||
require github.com/a-h/templ v0.2.707
|
4
gothkit/go.sum
Normal file
4
gothkit/go.sum
Normal file
|
@ -0,0 +1,4 @@
|
|||
github.com/a-h/templ v0.2.707 h1:T1Gkd2ugbRglZ9rYw/VBchWOSZVKmetDbBkm4YubM7U=
|
||||
github.com/a-h/templ v0.2.707/go.mod h1:5cqsugkq9IerRNucNsI4DEamdHPsoGMQy99DzydLhM8=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
125
gothkit/pkg/kit/kit.go
Normal file
125
gothkit/pkg/kit/kit.go
Normal file
|
@ -0,0 +1,125 @@
|
|||
package kit
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
|
||||
"github.com/a-h/templ"
|
||||
)
|
||||
|
||||
type HandlerFunc func(kit *Kit) error
|
||||
|
||||
type Authenticater interface {
|
||||
Authenticate(http.ResponseWriter, *http.Request) error
|
||||
}
|
||||
|
||||
type ErrorHandlerFunc func(kit *Kit, err error)
|
||||
|
||||
type AuthKey struct{}
|
||||
|
||||
type Auth interface {
|
||||
Check() bool
|
||||
}
|
||||
|
||||
var (
|
||||
auth Auth = defaultAuth{}
|
||||
errorHandler = func(kit *Kit, err error) {
|
||||
kit.Text(http.StatusInternalServerError, err.Error())
|
||||
}
|
||||
)
|
||||
|
||||
type defaultAuth struct{}
|
||||
|
||||
func (defaultAuth) Check() bool { return false }
|
||||
|
||||
type Kit struct {
|
||||
Response http.ResponseWriter
|
||||
Request *http.Request
|
||||
}
|
||||
|
||||
func UseErrorHandler(h ErrorHandlerFunc) { errorHandler = h }
|
||||
func SetAuth(a Auth) { auth = a }
|
||||
|
||||
func (kit *Kit) Auth() Auth {
|
||||
value, ok := kit.Request.Context().Value(AuthKey{}).(Auth)
|
||||
if !ok {
|
||||
slog.Warn("kit authentication not set")
|
||||
return auth
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
func (kit *Kit) Redirect(status int, url string) {
|
||||
http.Redirect(kit.Response, kit.Request, url, status)
|
||||
}
|
||||
|
||||
func (kit *Kit) JSON(status int, v any) error {
|
||||
kit.Response.WriteHeader(status)
|
||||
kit.Response.Header().Set("Content-Type", "application/json")
|
||||
return json.NewEncoder(kit.Response).Encode(v)
|
||||
}
|
||||
|
||||
func (kit *Kit) Text(status int, msg string) error {
|
||||
kit.Response.WriteHeader(status)
|
||||
kit.Response.Header().Set("Content-Type", "text/plain")
|
||||
_, err := kit.Response.Write([]byte(msg))
|
||||
return err
|
||||
}
|
||||
|
||||
func (kit *Kit) Bytes(status int, b []byte) error {
|
||||
kit.Response.WriteHeader(status)
|
||||
kit.Response.Header().Set("Content-Type", "text/plain")
|
||||
_, err := kit.Response.Write(b)
|
||||
return err
|
||||
}
|
||||
|
||||
func (kit *Kit) Render(c templ.Component) error {
|
||||
return c.Render(kit.Request.Context(), kit.Response)
|
||||
}
|
||||
|
||||
func Handler(h HandlerFunc) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
kit := &Kit{
|
||||
Response: w,
|
||||
Request: r,
|
||||
}
|
||||
if err := h(kit); err != nil {
|
||||
if errorHandler != nil {
|
||||
errorHandler(kit, err)
|
||||
return
|
||||
}
|
||||
kit.Text(http.StatusInternalServerError, err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type AuthenticationConfig struct {
|
||||
AuthFunc func(http.ResponseWriter, *http.Request) (Auth, error)
|
||||
RedirectURL string
|
||||
}
|
||||
|
||||
func WithAuthentication(config AuthenticationConfig, strict bool) func(http.Handler) http.Handler {
|
||||
return func(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
kit := &Kit{
|
||||
Response: w,
|
||||
Request: r,
|
||||
}
|
||||
auth, err := config.AuthFunc(w, r)
|
||||
if err != nil {
|
||||
errorHandler(kit, err)
|
||||
return
|
||||
}
|
||||
if strict && !auth.Check() && r.URL.Path != config.RedirectURL {
|
||||
kit.Redirect(http.StatusSeeOther, config.RedirectURL)
|
||||
return
|
||||
}
|
||||
|
||||
ctx := context.WithValue(r.Context(), AuthKey{}, auth)
|
||||
|
||||
next.ServeHTTP(w, r.WithContext(ctx))
|
||||
})
|
||||
}
|
||||
}
|
14
gothkit/pkg/kit/middleware/middleware.go
Normal file
14
gothkit/pkg/kit/middleware/middleware.go
Normal file
|
@ -0,0 +1,14 @@
|
|||
package middleware
|
||||
|
||||
// func Authenticated(next http.Handler) http.Handler {
|
||||
// return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
// kit := &kit.Kit{
|
||||
// Response: w,
|
||||
// Request: r,
|
||||
// }
|
||||
// if !kit.Auth().LoggedIn {
|
||||
|
||||
// }
|
||||
// next.ServeHTTP(w, r.WithContext(ctx))
|
||||
// })
|
||||
// }
|
1
gothkit/pkg/validate/validate.go
Normal file
1
gothkit/pkg/validate/validate.go
Normal file
|
@ -0,0 +1 @@
|
|||
package validate
|
1
install.sh
Executable file
1
install.sh
Executable file
|
@ -0,0 +1 @@
|
|||
echo "this is working fine"
|
6
project/.gitignore
vendored
Normal file
6
project/.gitignore
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
.env
|
||||
bin
|
||||
*_templ.go
|
||||
*_templ.txt
|
||||
node_modules
|
||||
tmp
|
51
project/Makefile
Normal file
51
project/Makefile
Normal file
|
@ -0,0 +1,51 @@
|
|||
# Load environment variables from .env file
|
||||
ifneq (,$(wildcard ./.env))
|
||||
include .env
|
||||
export
|
||||
endif
|
||||
|
||||
# run templ generation in watch mode to detect all .templ files and
|
||||
# re-create _templ.txt files on change, then send reload event to browser.
|
||||
# Default url: http://localhost:7331
|
||||
live/templ:
|
||||
@templ generate --watch --proxy="http://localhost$(HTTP_LISTEN_ADDR)" --open-browser=false -v
|
||||
|
||||
# run air to detect any go file changes to re-build and re-run the server.
|
||||
live/server:
|
||||
@go run github.com/cosmtrek/air@v1.51.0 \
|
||||
--build.cmd "go build --tags dev -o tmp/bin/main ./cmd/app/" --build.bin "tmp/bin/main" --build.delay "100" \
|
||||
--build.exclude_dir "node_modules" \
|
||||
--build.include_ext "go" \
|
||||
--build.stop_on_error "false" \
|
||||
--misc.clean_on_exit true
|
||||
|
||||
# run tailwindcss to generate the styles.css bundle in watch mode.
|
||||
live/tailwind:
|
||||
tailwindcss -i assets/app.css -o ./public/styles.css --watch
|
||||
|
||||
# run esbuild to generate the index.js bundle in watch mode.
|
||||
live/esbuild:
|
||||
npx esbuild views/js/index.js --bundle --outdir=public/ --watch
|
||||
|
||||
# watch for any js or css change in the assets/ folder, then reload the browser via templ proxy.
|
||||
live/sync_assets:
|
||||
go run github.com/cosmtrek/air@v1.51.0 \
|
||||
--build.cmd "templ generate --notify-proxy" \
|
||||
--build.bin "true" \
|
||||
--build.delay "100" \
|
||||
--build.exclude_dir "" \
|
||||
--build.include_dir "public" \
|
||||
--build.include_ext "js,css"
|
||||
|
||||
# start the application in development
|
||||
dev:
|
||||
@make -j5 live/templ live/server live/tailwind live/sync_assets
|
||||
|
||||
reset:
|
||||
@GOOSE_DRIVER=postgres GOOSE_DBSTRING=$(dsn) goose -dir=$(migrationPath) reset
|
||||
|
||||
up:
|
||||
@GOOSE_DRIVER=postgres GOOSE_DBSTRING=$(dsn) goose -dir=$(migrationPath) up
|
||||
|
||||
seed:
|
||||
@go run scripts/seed/main.go
|
56
project/assets/app.css
Normal file
56
project/assets/app.css
Normal file
|
@ -0,0 +1,56 @@
|
|||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
@layer base {
|
||||
* {
|
||||
@apply border-border;
|
||||
}
|
||||
body {
|
||||
@apply bg-background text-foreground;
|
||||
}
|
||||
|
||||
:root {
|
||||
--background: 224 71.4% 4.1%;
|
||||
--foreground: 210 20% 98%;
|
||||
--card: 224 71.4% 4.1%;
|
||||
--card-foreground: 210 20% 98%;
|
||||
--popover: 224 71.4% 4.1%;
|
||||
--popover-foreground: 210 20% 98%;
|
||||
--primary: 263.4 70% 50.4%;
|
||||
--primary-foreground: 210 20% 98%;
|
||||
--secondary: 215 27.9% 16.9%;
|
||||
--secondary-foreground: 210 20% 98%;
|
||||
--muted: 215 27.9% 16.9%;
|
||||
--muted-foreground: 217.9 10.6% 64.9%;
|
||||
--accent: 215 27.9% 16.9%;
|
||||
--accent-foreground: 210 20% 98%;
|
||||
--destructive: 0 62.8% 30.6%;
|
||||
--destructive-foreground: 210 20% 98%;
|
||||
--border: 215 27.9% 16.9%;
|
||||
--input: 215 27.9% 16.9%;
|
||||
--ring: 263.4 70% 50.4%;
|
||||
}
|
||||
|
||||
.dark {
|
||||
--background: 224 71.4% 4.1%;
|
||||
--foreground: 210 20% 98%;
|
||||
--card: 224 71.4% 4.1%;
|
||||
--card-foreground: 210 20% 98%;
|
||||
--popover: 224 71.4% 4.1%;
|
||||
--popover-foreground: 210 20% 98%;
|
||||
--primary: 263.4 70% 50.4%;
|
||||
--primary-foreground: 210 20% 98%;
|
||||
--secondary: 215 27.9% 16.9%;
|
||||
--secondary-foreground: 210 20% 98%;
|
||||
--muted: 215 27.9% 16.9%;
|
||||
--muted-foreground: 217.9 10.6% 64.9%;
|
||||
--accent: 215 27.9% 16.9%;
|
||||
--accent-foreground: 210 20% 98%;
|
||||
--destructive: 0 62.8% 30.6%;
|
||||
--destructive-foreground: 210 20% 98%;
|
||||
--border: 215 27.9% 16.9%;
|
||||
--input: 215 27.9% 16.9%;
|
||||
--ring: 263.4 70% 50.4%;
|
||||
}
|
||||
}
|
44
project/cmd/app/main.go
Normal file
44
project/cmd/app/main.go
Normal file
|
@ -0,0 +1,44 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"example-app/db"
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
)
|
||||
|
||||
func main() {
|
||||
db, err := db.New()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
_ = db
|
||||
|
||||
// Routes configuration
|
||||
router := chi.NewMux()
|
||||
if true {
|
||||
router.Handle("/*", disableCache(staticDev()))
|
||||
}
|
||||
initializeRoutes(router, db)
|
||||
|
||||
listenAddr := os.Getenv("HTTP_LISTEN_ADDR")
|
||||
slog.Info("application started", "listenAddr", listenAddr)
|
||||
|
||||
http.ListenAndServe(os.Getenv("HTTP_LISTEN_ADDR"), router)
|
||||
}
|
||||
|
||||
func staticDev() http.Handler {
|
||||
return http.StripPrefix("/public/", http.FileServerFS(os.DirFS("public")))
|
||||
}
|
||||
|
||||
func disableCache(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Cache-Control", "no-store")
|
||||
next.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
61
project/cmd/app/routes.go
Normal file
61
project/cmd/app/routes.go
Normal file
|
@ -0,0 +1,61 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
|
||||
"github.com/anthdm/gothkit/pkg/kit"
|
||||
"github.com/go-chi/chi/v5"
|
||||
|
||||
"example-app/handlers"
|
||||
"example-app/views/errors"
|
||||
)
|
||||
|
||||
// Define your routes in here
|
||||
func initializeRoutes(router *chi.Mux, db *sql.DB) {
|
||||
// Configure the error handler
|
||||
kit.UseErrorHandler(func(kit *kit.Kit, err error) {
|
||||
slog.Error("internal server error", "err", err.Error(), "path", kit.Request.URL.Path)
|
||||
kit.Render(errors.Error500())
|
||||
})
|
||||
|
||||
// Comment out to configure your authentication
|
||||
authConfig := kit.AuthenticationConfig{
|
||||
AuthFunc: handleAuthentication,
|
||||
RedirectURL: "/login",
|
||||
}
|
||||
|
||||
landingHandler := handlers.NewLandingHandler(db)
|
||||
// Routes that "might" have an authenticated user
|
||||
router.Group(func(app chi.Router) {
|
||||
app.Use(kit.WithAuthentication(authConfig, false)) // strict set to false
|
||||
|
||||
// Routes
|
||||
app.Get("/", kit.Handler(landingHandler.HandleIndex))
|
||||
})
|
||||
|
||||
// Routes that "must" have an authenticated user or else they
|
||||
// will be redirected to the configured redirectURL, set in the
|
||||
// AuthenticationConfig.
|
||||
router.Group(func(app chi.Router) {
|
||||
app.Use(kit.WithAuthentication(authConfig, true)) // strict set to true
|
||||
|
||||
// Routes
|
||||
// app.Get("/path", kit.Handler(myHandler.HandleIndex))
|
||||
})
|
||||
}
|
||||
|
||||
type AuthUser struct {
|
||||
ID int
|
||||
Email string
|
||||
LoggedIn bool
|
||||
}
|
||||
|
||||
func (user AuthUser) Check() bool {
|
||||
return user.ID > 0 && user.LoggedIn
|
||||
}
|
||||
|
||||
func handleAuthentication(w http.ResponseWriter, r *http.Request) (kit.Auth, error) {
|
||||
return AuthUser{}, nil
|
||||
}
|
28
project/db/db.go
Normal file
28
project/db/db.go
Normal file
|
@ -0,0 +1,28 @@
|
|||
package db
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
)
|
||||
|
||||
const (
|
||||
DriverSqlite3 = "sqlite3"
|
||||
)
|
||||
|
||||
func New() (*sql.DB, error) {
|
||||
driver := os.Getenv("DB_DRIVER")
|
||||
|
||||
switch driver {
|
||||
case DriverSqlite3:
|
||||
name := os.Getenv("DB_NAME")
|
||||
if len(name) == 0 {
|
||||
name = "gothkit"
|
||||
}
|
||||
return sql.Open(driver, name)
|
||||
default:
|
||||
return nil, fmt.Errorf("invalid database driver (%s): currently only sqlite3 is supported", driver)
|
||||
}
|
||||
}
|
15
project/go.mod
Normal file
15
project/go.mod
Normal file
|
@ -0,0 +1,15 @@
|
|||
module example-app
|
||||
|
||||
go 1.22.0
|
||||
|
||||
require (
|
||||
github.com/anthdm/gothkit v0.0.0-00010101000000-000000000000
|
||||
github.com/go-chi/chi/v5 v5.0.12
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/a-h/templ v0.2.707 // indirect
|
||||
github.com/mattn/go-sqlite3 v1.14.22
|
||||
)
|
||||
|
||||
replace github.com/anthdm/gothkit => ../gothkit
|
8
project/go.sum
Normal file
8
project/go.sum
Normal file
|
@ -0,0 +1,8 @@
|
|||
github.com/a-h/templ v0.2.707 h1:T1Gkd2ugbRglZ9rYw/VBchWOSZVKmetDbBkm4YubM7U=
|
||||
github.com/a-h/templ v0.2.707/go.mod h1:5cqsugkq9IerRNucNsI4DEamdHPsoGMQy99DzydLhM8=
|
||||
github.com/go-chi/chi/v5 v5.0.12 h1:9euLV5sTrTNTRUU9POmDUvfxyj6LAABLUcEWO+JJb4s=
|
||||
github.com/go-chi/chi/v5 v5.0.12/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
|
||||
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/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
|
||||
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
22
project/handlers/landing.go
Normal file
22
project/handlers/landing.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
package handlers
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"example-app/views/landing"
|
||||
|
||||
"github.com/anthdm/gothkit/pkg/kit"
|
||||
)
|
||||
|
||||
type LandingHandler struct {
|
||||
db *sql.DB
|
||||
}
|
||||
|
||||
func NewLandingHandler(db *sql.DB) *LandingHandler {
|
||||
return &LandingHandler{
|
||||
db: db,
|
||||
}
|
||||
}
|
||||
|
||||
func (h *LandingHandler) HandleIndex(kit *kit.Kit) error {
|
||||
return kit.Render(landing.Index())
|
||||
}
|
1383
project/package-lock.json
generated
Normal file
1383
project/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
14
project/package.json
Normal file
14
project/package.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"name": "gothkit",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"tailwindcss": "^3.4.3"
|
||||
}
|
||||
}
|
0
project/public/favicon.ico
Normal file
0
project/public/favicon.ico
Normal file
720
project/public/styles.css
Normal file
720
project/public/styles.css
Normal file
|
@ -0,0 +1,720 @@
|
|||
/*
|
||||
! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com
|
||||
*/
|
||||
|
||||
/*
|
||||
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
|
||||
2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
|
||||
*/
|
||||
|
||||
*,
|
||||
::before,
|
||||
::after {
|
||||
box-sizing: border-box;
|
||||
/* 1 */
|
||||
border-width: 0;
|
||||
/* 2 */
|
||||
border-style: solid;
|
||||
/* 2 */
|
||||
border-color: #e5e7eb;
|
||||
/* 2 */
|
||||
}
|
||||
|
||||
::before,
|
||||
::after {
|
||||
--tw-content: '';
|
||||
}
|
||||
|
||||
/*
|
||||
1. Use a consistent sensible line-height in all browsers.
|
||||
2. Prevent adjustments of font size after orientation changes in iOS.
|
||||
3. Use a more readable tab size.
|
||||
4. Use the user's configured `sans` font-family by default.
|
||||
5. Use the user's configured `sans` font-feature-settings by default.
|
||||
6. Use the user's configured `sans` font-variation-settings by default.
|
||||
7. Disable tap highlights on iOS
|
||||
*/
|
||||
|
||||
html,
|
||||
:host {
|
||||
line-height: 1.5;
|
||||
/* 1 */
|
||||
-webkit-text-size-adjust: 100%;
|
||||
/* 2 */
|
||||
-moz-tab-size: 4;
|
||||
/* 3 */
|
||||
-o-tab-size: 4;
|
||||
tab-size: 4;
|
||||
/* 3 */
|
||||
font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||
/* 4 */
|
||||
font-feature-settings: normal;
|
||||
/* 5 */
|
||||
font-variation-settings: normal;
|
||||
/* 6 */
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
/* 7 */
|
||||
}
|
||||
|
||||
/*
|
||||
1. Remove the margin in all browsers.
|
||||
2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.
|
||||
*/
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
/* 1 */
|
||||
line-height: inherit;
|
||||
/* 2 */
|
||||
}
|
||||
|
||||
/*
|
||||
1. Add the correct height in Firefox.
|
||||
2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
|
||||
3. Ensure horizontal rules are visible by default.
|
||||
*/
|
||||
|
||||
hr {
|
||||
height: 0;
|
||||
/* 1 */
|
||||
color: inherit;
|
||||
/* 2 */
|
||||
border-top-width: 1px;
|
||||
/* 3 */
|
||||
}
|
||||
|
||||
/*
|
||||
Add the correct text decoration in Chrome, Edge, and Safari.
|
||||
*/
|
||||
|
||||
abbr:where([title]) {
|
||||
-webkit-text-decoration: underline dotted;
|
||||
text-decoration: underline dotted;
|
||||
}
|
||||
|
||||
/*
|
||||
Remove the default font size and weight for headings.
|
||||
*/
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
font-size: inherit;
|
||||
font-weight: inherit;
|
||||
}
|
||||
|
||||
/*
|
||||
Reset links to optimize for opt-in styling instead of opt-out.
|
||||
*/
|
||||
|
||||
a {
|
||||
color: inherit;
|
||||
text-decoration: inherit;
|
||||
}
|
||||
|
||||
/*
|
||||
Add the correct font weight in Edge and Safari.
|
||||
*/
|
||||
|
||||
b,
|
||||
strong {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
/*
|
||||
1. Use the user's configured `mono` font-family by default.
|
||||
2. Use the user's configured `mono` font-feature-settings by default.
|
||||
3. Use the user's configured `mono` font-variation-settings by default.
|
||||
4. Correct the odd `em` font sizing in all browsers.
|
||||
*/
|
||||
|
||||
code,
|
||||
kbd,
|
||||
samp,
|
||||
pre {
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||
/* 1 */
|
||||
font-feature-settings: normal;
|
||||
/* 2 */
|
||||
font-variation-settings: normal;
|
||||
/* 3 */
|
||||
font-size: 1em;
|
||||
/* 4 */
|
||||
}
|
||||
|
||||
/*
|
||||
Add the correct font size in all browsers.
|
||||
*/
|
||||
|
||||
small {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
/*
|
||||
Prevent `sub` and `sup` elements from affecting the line height in all browsers.
|
||||
*/
|
||||
|
||||
sub,
|
||||
sup {
|
||||
font-size: 75%;
|
||||
line-height: 0;
|
||||
position: relative;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
sub {
|
||||
bottom: -0.25em;
|
||||
}
|
||||
|
||||
sup {
|
||||
top: -0.5em;
|
||||
}
|
||||
|
||||
/*
|
||||
1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
|
||||
2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
|
||||
3. Remove gaps between table borders by default.
|
||||
*/
|
||||
|
||||
table {
|
||||
text-indent: 0;
|
||||
/* 1 */
|
||||
border-color: inherit;
|
||||
/* 2 */
|
||||
border-collapse: collapse;
|
||||
/* 3 */
|
||||
}
|
||||
|
||||
/*
|
||||
1. Change the font styles in all browsers.
|
||||
2. Remove the margin in Firefox and Safari.
|
||||
3. Remove default padding in all browsers.
|
||||
*/
|
||||
|
||||
button,
|
||||
input,
|
||||
optgroup,
|
||||
select,
|
||||
textarea {
|
||||
font-family: inherit;
|
||||
/* 1 */
|
||||
font-feature-settings: inherit;
|
||||
/* 1 */
|
||||
font-variation-settings: inherit;
|
||||
/* 1 */
|
||||
font-size: 100%;
|
||||
/* 1 */
|
||||
font-weight: inherit;
|
||||
/* 1 */
|
||||
line-height: inherit;
|
||||
/* 1 */
|
||||
color: inherit;
|
||||
/* 1 */
|
||||
margin: 0;
|
||||
/* 2 */
|
||||
padding: 0;
|
||||
/* 3 */
|
||||
}
|
||||
|
||||
/*
|
||||
Remove the inheritance of text transform in Edge and Firefox.
|
||||
*/
|
||||
|
||||
button,
|
||||
select {
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
/*
|
||||
1. Correct the inability to style clickable types in iOS and Safari.
|
||||
2. Remove default button styles.
|
||||
*/
|
||||
|
||||
button,
|
||||
[type='button'],
|
||||
[type='reset'],
|
||||
[type='submit'] {
|
||||
-webkit-appearance: button;
|
||||
/* 1 */
|
||||
background-color: transparent;
|
||||
/* 2 */
|
||||
background-image: none;
|
||||
/* 2 */
|
||||
}
|
||||
|
||||
/*
|
||||
Use the modern Firefox focus style for all focusable elements.
|
||||
*/
|
||||
|
||||
:-moz-focusring {
|
||||
outline: auto;
|
||||
}
|
||||
|
||||
/*
|
||||
Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)
|
||||
*/
|
||||
|
||||
:-moz-ui-invalid {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
/*
|
||||
Add the correct vertical alignment in Chrome and Firefox.
|
||||
*/
|
||||
|
||||
progress {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
/*
|
||||
Correct the cursor style of increment and decrement buttons in Safari.
|
||||
*/
|
||||
|
||||
::-webkit-inner-spin-button,
|
||||
::-webkit-outer-spin-button {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
/*
|
||||
1. Correct the odd appearance in Chrome and Safari.
|
||||
2. Correct the outline style in Safari.
|
||||
*/
|
||||
|
||||
[type='search'] {
|
||||
-webkit-appearance: textfield;
|
||||
/* 1 */
|
||||
outline-offset: -2px;
|
||||
/* 2 */
|
||||
}
|
||||
|
||||
/*
|
||||
Remove the inner padding in Chrome and Safari on macOS.
|
||||
*/
|
||||
|
||||
::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
/*
|
||||
1. Correct the inability to style clickable types in iOS and Safari.
|
||||
2. Change font properties to `inherit` in Safari.
|
||||
*/
|
||||
|
||||
::-webkit-file-upload-button {
|
||||
-webkit-appearance: button;
|
||||
/* 1 */
|
||||
font: inherit;
|
||||
/* 2 */
|
||||
}
|
||||
|
||||
/*
|
||||
Add the correct display in Chrome and Safari.
|
||||
*/
|
||||
|
||||
summary {
|
||||
display: list-item;
|
||||
}
|
||||
|
||||
/*
|
||||
Removes the default spacing and border for appropriate elements.
|
||||
*/
|
||||
|
||||
blockquote,
|
||||
dl,
|
||||
dd,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
hr,
|
||||
figure,
|
||||
p,
|
||||
pre {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
legend {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
ol,
|
||||
ul,
|
||||
menu {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Reset default styling for dialogs.
|
||||
*/
|
||||
|
||||
dialog {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Prevent resizing textareas horizontally by default.
|
||||
*/
|
||||
|
||||
textarea {
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
/*
|
||||
1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)
|
||||
2. Set the default placeholder color to the user's configured gray 400 color.
|
||||
*/
|
||||
|
||||
input::-moz-placeholder, textarea::-moz-placeholder {
|
||||
opacity: 1;
|
||||
/* 1 */
|
||||
color: #9ca3af;
|
||||
/* 2 */
|
||||
}
|
||||
|
||||
input::placeholder,
|
||||
textarea::placeholder {
|
||||
opacity: 1;
|
||||
/* 1 */
|
||||
color: #9ca3af;
|
||||
/* 2 */
|
||||
}
|
||||
|
||||
/*
|
||||
Set the default cursor for buttons.
|
||||
*/
|
||||
|
||||
button,
|
||||
[role="button"] {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/*
|
||||
Make sure disabled buttons don't get the pointer cursor.
|
||||
*/
|
||||
|
||||
:disabled {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/*
|
||||
1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)
|
||||
2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
|
||||
This can trigger a poorly considered lint error in some tools but is included by design.
|
||||
*/
|
||||
|
||||
img,
|
||||
svg,
|
||||
video,
|
||||
canvas,
|
||||
audio,
|
||||
iframe,
|
||||
embed,
|
||||
object {
|
||||
display: block;
|
||||
/* 1 */
|
||||
vertical-align: middle;
|
||||
/* 2 */
|
||||
}
|
||||
|
||||
/*
|
||||
Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)
|
||||
*/
|
||||
|
||||
img,
|
||||
video {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
/* Make elements with the HTML hidden attribute stay hidden by default */
|
||||
|
||||
[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
* {
|
||||
--tw-border-opacity: 1;
|
||||
border-color: hsl(var(--border) / var(--tw-border-opacity));
|
||||
}
|
||||
|
||||
body {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: hsl(var(--background) / var(--tw-bg-opacity));
|
||||
--tw-text-opacity: 1;
|
||||
color: hsl(var(--foreground) / var(--tw-text-opacity));
|
||||
}
|
||||
|
||||
:root {
|
||||
--background: 224 71.4% 4.1%;
|
||||
--foreground: 210 20% 98%;
|
||||
--card: 224 71.4% 4.1%;
|
||||
--card-foreground: 210 20% 98%;
|
||||
--popover: 224 71.4% 4.1%;
|
||||
--popover-foreground: 210 20% 98%;
|
||||
--primary: 263.4 70% 50.4%;
|
||||
--primary-foreground: 210 20% 98%;
|
||||
--secondary: 215 27.9% 16.9%;
|
||||
--secondary-foreground: 210 20% 98%;
|
||||
--muted: 215 27.9% 16.9%;
|
||||
--muted-foreground: 217.9 10.6% 64.9%;
|
||||
--accent: 215 27.9% 16.9%;
|
||||
--accent-foreground: 210 20% 98%;
|
||||
--destructive: 0 62.8% 30.6%;
|
||||
--destructive-foreground: 210 20% 98%;
|
||||
--border: 215 27.9% 16.9%;
|
||||
--input: 215 27.9% 16.9%;
|
||||
--ring: 263.4 70% 50.4%;
|
||||
}
|
||||
|
||||
*, ::before, ::after {
|
||||
--tw-border-spacing-x: 0;
|
||||
--tw-border-spacing-y: 0;
|
||||
--tw-translate-x: 0;
|
||||
--tw-translate-y: 0;
|
||||
--tw-rotate: 0;
|
||||
--tw-skew-x: 0;
|
||||
--tw-skew-y: 0;
|
||||
--tw-scale-x: 1;
|
||||
--tw-scale-y: 1;
|
||||
--tw-pan-x: ;
|
||||
--tw-pan-y: ;
|
||||
--tw-pinch-zoom: ;
|
||||
--tw-scroll-snap-strictness: proximity;
|
||||
--tw-gradient-from-position: ;
|
||||
--tw-gradient-via-position: ;
|
||||
--tw-gradient-to-position: ;
|
||||
--tw-ordinal: ;
|
||||
--tw-slashed-zero: ;
|
||||
--tw-numeric-figure: ;
|
||||
--tw-numeric-spacing: ;
|
||||
--tw-numeric-fraction: ;
|
||||
--tw-ring-inset: ;
|
||||
--tw-ring-offset-width: 0px;
|
||||
--tw-ring-offset-color: #fff;
|
||||
--tw-ring-color: rgb(59 130 246 / 0.5);
|
||||
--tw-ring-offset-shadow: 0 0 #0000;
|
||||
--tw-ring-shadow: 0 0 #0000;
|
||||
--tw-shadow: 0 0 #0000;
|
||||
--tw-shadow-colored: 0 0 #0000;
|
||||
--tw-blur: ;
|
||||
--tw-brightness: ;
|
||||
--tw-contrast: ;
|
||||
--tw-grayscale: ;
|
||||
--tw-hue-rotate: ;
|
||||
--tw-invert: ;
|
||||
--tw-saturate: ;
|
||||
--tw-sepia: ;
|
||||
--tw-drop-shadow: ;
|
||||
--tw-backdrop-blur: ;
|
||||
--tw-backdrop-brightness: ;
|
||||
--tw-backdrop-contrast: ;
|
||||
--tw-backdrop-grayscale: ;
|
||||
--tw-backdrop-hue-rotate: ;
|
||||
--tw-backdrop-invert: ;
|
||||
--tw-backdrop-opacity: ;
|
||||
--tw-backdrop-saturate: ;
|
||||
--tw-backdrop-sepia: ;
|
||||
}
|
||||
|
||||
::backdrop {
|
||||
--tw-border-spacing-x: 0;
|
||||
--tw-border-spacing-y: 0;
|
||||
--tw-translate-x: 0;
|
||||
--tw-translate-y: 0;
|
||||
--tw-rotate: 0;
|
||||
--tw-skew-x: 0;
|
||||
--tw-skew-y: 0;
|
||||
--tw-scale-x: 1;
|
||||
--tw-scale-y: 1;
|
||||
--tw-pan-x: ;
|
||||
--tw-pan-y: ;
|
||||
--tw-pinch-zoom: ;
|
||||
--tw-scroll-snap-strictness: proximity;
|
||||
--tw-gradient-from-position: ;
|
||||
--tw-gradient-via-position: ;
|
||||
--tw-gradient-to-position: ;
|
||||
--tw-ordinal: ;
|
||||
--tw-slashed-zero: ;
|
||||
--tw-numeric-figure: ;
|
||||
--tw-numeric-spacing: ;
|
||||
--tw-numeric-fraction: ;
|
||||
--tw-ring-inset: ;
|
||||
--tw-ring-offset-width: 0px;
|
||||
--tw-ring-offset-color: #fff;
|
||||
--tw-ring-color: rgb(59 130 246 / 0.5);
|
||||
--tw-ring-offset-shadow: 0 0 #0000;
|
||||
--tw-ring-shadow: 0 0 #0000;
|
||||
--tw-shadow: 0 0 #0000;
|
||||
--tw-shadow-colored: 0 0 #0000;
|
||||
--tw-blur: ;
|
||||
--tw-brightness: ;
|
||||
--tw-contrast: ;
|
||||
--tw-grayscale: ;
|
||||
--tw-hue-rotate: ;
|
||||
--tw-invert: ;
|
||||
--tw-saturate: ;
|
||||
--tw-sepia: ;
|
||||
--tw-drop-shadow: ;
|
||||
--tw-backdrop-blur: ;
|
||||
--tw-backdrop-brightness: ;
|
||||
--tw-backdrop-contrast: ;
|
||||
--tw-backdrop-grayscale: ;
|
||||
--tw-backdrop-hue-rotate: ;
|
||||
--tw-backdrop-invert: ;
|
||||
--tw-backdrop-opacity: ;
|
||||
--tw-backdrop-saturate: ;
|
||||
--tw-backdrop-sepia: ;
|
||||
}
|
||||
|
||||
.container {
|
||||
width: 100%;
|
||||
margin-right: auto;
|
||||
margin-left: auto;
|
||||
padding-right: 2rem;
|
||||
padding-left: 2rem;
|
||||
}
|
||||
|
||||
@media (min-width: 1400px) {
|
||||
.container {
|
||||
max-width: 1400px;
|
||||
}
|
||||
}
|
||||
|
||||
.mx-auto {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.mt-12 {
|
||||
margin-top: 3rem;
|
||||
}
|
||||
|
||||
.mt-20 {
|
||||
margin-top: 5rem;
|
||||
}
|
||||
|
||||
.flex {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.h-screen {
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.w-full {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.max-w-7xl {
|
||||
max-width: 80rem;
|
||||
}
|
||||
|
||||
.flex-col {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.items-center {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.justify-center {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.gap-4 {
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.border-b {
|
||||
border-bottom-width: 1px;
|
||||
}
|
||||
|
||||
.bg-background {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: hsl(var(--background) / var(--tw-bg-opacity));
|
||||
}
|
||||
|
||||
.py-3 {
|
||||
padding-top: 0.75rem;
|
||||
padding-bottom: 0.75rem;
|
||||
}
|
||||
|
||||
.text-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.align-middle {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.text-4xl {
|
||||
font-size: 2.25rem;
|
||||
line-height: 2.5rem;
|
||||
}
|
||||
|
||||
.text-5xl {
|
||||
font-size: 3rem;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.text-lg {
|
||||
font-size: 1.125rem;
|
||||
line-height: 1.75rem;
|
||||
}
|
||||
|
||||
.text-3xl {
|
||||
font-size: 1.875rem;
|
||||
line-height: 2.25rem;
|
||||
}
|
||||
|
||||
.font-bold {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.font-semibold {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.text-blue-500 {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(59 130 246 / var(--tw-text-opacity));
|
||||
}
|
||||
|
||||
.text-muted-foreground {
|
||||
--tw-text-opacity: 1;
|
||||
color: hsl(var(--muted-foreground) / var(--tw-text-opacity));
|
||||
}
|
||||
|
||||
.antialiased {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
.lg\:text-5xl {
|
||||
font-size: 3rem;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.lg\:text-7xl {
|
||||
font-size: 4.5rem;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.lg\:text-6xl {
|
||||
font-size: 3.75rem;
|
||||
line-height: 1;
|
||||
}
|
||||
}
|
61
project/tailwind.config.js
Normal file
61
project/tailwind.config.js
Normal file
|
@ -0,0 +1,61 @@
|
|||
import { fontFamily } from "tailwindcss/defaultTheme";
|
||||
|
||||
module.exports = {
|
||||
content: [ "./**/*.html", "./**/*.templ", "./**/*.go", ],
|
||||
safelist: [],
|
||||
theme: {
|
||||
container: {
|
||||
center: true,
|
||||
padding: "2rem",
|
||||
screens: {
|
||||
"2xl": "1400px"
|
||||
}
|
||||
},
|
||||
extend: {
|
||||
colors: {
|
||||
border: "hsl(var(--border) / <alpha-value>)",
|
||||
input: "hsl(var(--input) / <alpha-value>)",
|
||||
ring: "hsl(var(--ring) / <alpha-value>)",
|
||||
background: "hsl(var(--background) / <alpha-value>)",
|
||||
foreground: "hsl(var(--foreground) / <alpha-value>)",
|
||||
primary: {
|
||||
DEFAULT: "hsl(var(--primary) / <alpha-value>)",
|
||||
foreground: "hsl(var(--primary-foreground) / <alpha-value>)"
|
||||
},
|
||||
secondary: {
|
||||
DEFAULT: "hsl(var(--secondary) / <alpha-value>)",
|
||||
foreground: "hsl(var(--secondary-foreground) / <alpha-value>)"
|
||||
},
|
||||
destructive: {
|
||||
DEFAULT: "hsl(var(--destructive) / <alpha-value>)",
|
||||
foreground: "hsl(var(--destructive-foreground) / <alpha-value>)"
|
||||
},
|
||||
muted: {
|
||||
DEFAULT: "hsl(var(--muted) / <alpha-value>)",
|
||||
foreground: "hsl(var(--muted-foreground) / <alpha-value>)"
|
||||
},
|
||||
accent: {
|
||||
DEFAULT: "hsl(var(--accent) / <alpha-value>)",
|
||||
foreground: "hsl(var(--accent-foreground) / <alpha-value>)"
|
||||
},
|
||||
popover: {
|
||||
DEFAULT: "hsl(var(--popover) / <alpha-value>)",
|
||||
foreground: "hsl(var(--popover-foreground) / <alpha-value>)"
|
||||
},
|
||||
card: {
|
||||
DEFAULT: "hsl(var(--card) / <alpha-value>)",
|
||||
foreground: "hsl(var(--card-foreground) / <alpha-value>)"
|
||||
}
|
||||
},
|
||||
borderRadius: {
|
||||
lg: "var(--radius)",
|
||||
md: "calc(var(--radius) - 2px)",
|
||||
sm: "calc(var(--radius) - 4px)"
|
||||
},
|
||||
fontFamily: {
|
||||
sans: [...fontFamily.sans]
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
11
project/views/components/navigation.templ
Normal file
11
project/views/components/navigation.templ
Normal file
|
@ -0,0 +1,11 @@
|
|||
package components
|
||||
|
||||
templ Navigation() {
|
||||
<nav class="border-b py-3">
|
||||
<div class="container mx-auto">
|
||||
<div class="text-lg">
|
||||
<a href="/" class="font-semibold">Gothkit</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
}
|
14
project/views/errors/404.templ
Normal file
14
project/views/errors/404.templ
Normal file
|
@ -0,0 +1,14 @@
|
|||
package errors
|
||||
|
||||
import (
|
||||
"example-app/views/layouts"
|
||||
)
|
||||
|
||||
templ Error400() {
|
||||
@layouts.BaseLayout() {
|
||||
<div class="h-screen w-full flex flex-col justify-center align-middle items-center gap-4">
|
||||
<div class="text-muted-foreground text-5xl font-bold">404</div>
|
||||
<div class="text-lg">The page you are looking for does not exist</div>
|
||||
</div>
|
||||
}
|
||||
}
|
12
project/views/errors/500.templ
Normal file
12
project/views/errors/500.templ
Normal file
|
@ -0,0 +1,12 @@
|
|||
package errors
|
||||
|
||||
import "example-app/views/layouts"
|
||||
|
||||
templ Error500() {
|
||||
@layouts.BaseLayout() {
|
||||
<div class="h-screen w-full flex flex-col justify-center align-middle items-center gap-4">
|
||||
<div class="text-muted-foreground text-5xl font-bold">500</div>
|
||||
<div class="text-lg">An unexpected error occured</div>
|
||||
</div>
|
||||
}
|
||||
}
|
11
project/views/landing/index.templ
Normal file
11
project/views/landing/index.templ
Normal file
|
@ -0,0 +1,11 @@
|
|||
package landing
|
||||
|
||||
import "example-app/views/layouts"
|
||||
|
||||
templ Index() {
|
||||
@layouts.App() {
|
||||
<div class="mt-20">
|
||||
<h1 class="text-3xl lg:text-6xl font-bold text-center">Ship stuff with small teams</h1>
|
||||
</div>
|
||||
}
|
||||
}
|
12
project/views/layouts/app_layout.templ
Normal file
12
project/views/layouts/app_layout.templ
Normal file
|
@ -0,0 +1,12 @@
|
|||
package layouts
|
||||
|
||||
import "example-app/views/components"
|
||||
|
||||
templ App() {
|
||||
@BaseLayout() {
|
||||
@components.Navigation()
|
||||
<div class="max-w-7xl mx-auto">
|
||||
{ children... }
|
||||
</div>
|
||||
}
|
||||
}
|
30
project/views/layouts/base_layout.templ
Normal file
30
project/views/layouts/base_layout.templ
Normal file
|
@ -0,0 +1,30 @@
|
|||
package layouts
|
||||
|
||||
var (
|
||||
title = "Example blog made with gothkit"
|
||||
)
|
||||
|
||||
templ BaseLayout() {
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>{ title }</title>
|
||||
<link rel="icon" type="image/x-icon" href="/public/favicon.ico"/>
|
||||
<meta charset="UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<link rel="stylesheet" href="/public/styles.css"/>
|
||||
<!-- Jquery -->
|
||||
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
|
||||
<!-- Alpine Plugins -->
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/@alpinejs/focus@3.x.x/dist/cdn.min.js"></script>
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
||||
<!-- HTMX -->
|
||||
<script src="https://unpkg.com/htmx.org@1.9.9" defer></script>
|
||||
<!-- Font Awesome -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/js/all.min.js"></script>
|
||||
</head>
|
||||
<body class="antialiased">
|
||||
{ children... }
|
||||
</body>
|
||||
</html>
|
||||
}
|
Loading…
Reference in a new issue