start theme core templates

This commit is contained in:
Zeni Kim 2024-10-07 18:10:04 -05:00
parent da7925ae08
commit 015e85bf7b
12 changed files with 72 additions and 35 deletions

View file

@ -1,6 +1,6 @@
package components package components
type Button struct { type FormButton struct {
Text string Text string
Link string Link string
Icon string Icon string

View file

@ -1,7 +1,6 @@
{{define "button"}} {{define "form_button"}}
<button class="button-container"> <button class="btn btn-{{if .IsPrimary}}primary{{end}}" {{if eq .IsSubmit true}}type="submit"{{else}}type="button"{{end}} {{if .IsDisabled}}disabled{{end}}>
<a class="button {{if .IsPrimary}}primary{{end}}" {{if eq .IsSubmit true}}type="submit"{{else}}href="{{.Link}}"{{end}}> {{.Text}}</button>
{{.Text}}
<!-- tailwind heroicons --> <!-- tailwind heroicons -->
{{if eq .Icon "gear"}} {{if eq .Icon "gear"}}
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="icon"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="icon">
@ -17,6 +16,4 @@
<path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" /> <path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" />
</svg> </svg>
{{end}} {{end}}
</a>
</button>
{{end}} {{end}}

View file

@ -0,0 +1,12 @@
package components
type FormInput struct {
ID string
Label string
Type string
Placeholder string
Value string
Hint string
Error string
IsDisabled bool
}

View file

@ -0,0 +1,15 @@
{{define "form_input"}}
<div class="input-container">
<label class="form-label" for="{{.ID}}">{{.Label}}</label>
<input type="{{.Type}}" id="{{.ID}}" name="{{.ID}}" placeholder="{{.Placeholder}}" class="form-control{{if ne .Error ""}} error{{end}}"
{{if eq .IsDisabled true}}
disabled
{{end}}
{{if ne .Value ""}}
value="{{.Value}}"
{{end}}
aria-describedby="{{.ID}}Help">
{{if ne .Hint ""}}<small id="{{.ID}}Help" class="form-text text-muted">{{.Hint}}</small>{{end}}
{{if ne .Error ""}}<div class="error">{{.Error}}</div>{{end}}
</div>
{{end}}

View file

@ -1,17 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>My Website</title>
<link rel="stylesheet" href="./style.css">
<link rel="icon" href="./favicon.ico" type="image/x-icon">
</head>
<body>
<main>
<h1>Welcome to My Website</h1>
</main>
<script src="index.js"></script>
</body>
</html>

View file

@ -0,0 +1,8 @@
package components
type PageCard struct {
CardTitle string
CardSubTitle string
CardBody string
CardLink string
}

View file

@ -0,0 +1,11 @@
{{define "page_card"}}
<div class="card">
<div class="card-body">
{{if .CardTitle}}<h5 class="card-title">{{.CardTitle}}</h5>{{end}}
{{if .CardSubTitle}}<h6 class="card-subtitle mb-2 text-muted">{{.CardSubTitle}}</h6>{{end}}
{{if .CardBody}}<p class="card-text">{{.CardBody}}</p>{{end}}
{{block "page_card_content" .}}{{end}}
{{if .CardLink}}<a href="{{.CardLink}}" class="card-link">Card link</a>{{end}}
</div>
</div>
{{end}}

View file

@ -0,0 +1,6 @@
{{define "page_footer"}}
<footer>
<script src="/public/app.js"></script>
</footer>
<script src="/public/bootstrap/js/bootstrap.min.js"></script>
{{end}}

View file

@ -1,4 +1,4 @@
{{define "head"}} {{define "page_head"}}
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
@ -6,5 +6,6 @@
<title>{{.}} | Goffee</title> <title>{{.}} | Goffee</title>
<link rel="stylesheet" href="/public/style.css"> <link rel="stylesheet" href="/public/style.css">
<link rel="icon" href="/public/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="/public/img/favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="/public/bootstrap/css/bootstrap.min.css">
</head> </head>
{{end}} {{end}}

View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
{{template "page_head" "Goffee"}}
<body>
<div class="container">
{{block "page_content" .}}
<main>
<h1>Use this file as base inside cup application</h1>
</main>
{{end}}
{{template "page_footer"}}
</div>
</body>
</html>

View file

@ -1,5 +0,0 @@
package components
type Title struct {
Label string
}

View file

@ -1,5 +0,0 @@
{{define "title"}}
<div class="title">
<h1>{{.Label}}</h1>
</div>
{{end}}