This commit is contained in:
2024-02-22 14:14:11 -07:00
parent 044bd9820e
commit 3bebca6b48
8 changed files with 196 additions and 0 deletions

39
pages/resize.go Normal file
View File

@ -0,0 +1,39 @@
package pages
import (
"atri.dad/lib"
"github.com/labstack/echo/v4"
)
type ResizeProps struct {
Talks []lib.CardLink
}
func Resize(c echo.Context) error {
talks := []lib.CardLink{
{
Name: "How to ship less JavaScript",
Description: "A talk on building websites while being mindful of the JavaScript we ship. Presented at the Dev Edmonton July 2023 JS/Ruby/Python Meetup",
Href: "https://github.com/atridadl/devedmonton-july-2023",
Tags: []string{"astro", "ssr"},
Date: "July 06, 2023",
},
{
Name: "Hypermedia as the engine of application state - an Introduction",
Description: "A talk on building reactive websites using tools like HTMX instead of JSON + JS. Will be presented at the Dev Edmonton Fabruary 2024 JS/Ruby/Python Meetup",
Href: lib.GeneratePublicURL("hypermedia_talk_atridad.pdf"),
Tags: []string{"golang", "htmx", "ssr"},
Date: "February 01, 2024",
},
}
props := TalkProps{
Talks: talks,
}
// Specify the partials used by this page
partials := []string{"header", "navitems", "cardlinks"}
// Render the template
return lib.RenderTemplate(c.Response().Writer, "base", partials, props)
}

View File

@ -0,0 +1,31 @@
{{define "title"}}
Atridad Lahiji // Tools // Resizer
{{end}}
{{define "headercontent"}}
Atridad Lahiji // Tools // Resizer
{{end}}
{{define "head"}}
<link rel="stylesheet" href="/public/css/styles.resize.css" />
{{end}}
{{define "main"}}
<h2 class="text-2xl font-extrabold tracking-tight text-white sm:text-[2rem]">Image Resizer</h2>
<form action="/api/resize" method="post" enctype="multipart/form-data" class="flex-col flex gap-4">
Select image to resize:
<input type="file" name="image" accept="image/*"
class="file-input file-input-bordered file-input-secondary w-full max-w-xs" required />
<br>
New width (px):
<input type="number" id="newWidth" name="width" min="1" class="input input-bordered w-full max-w-xs" required>
<br>
New height (px):
<input type="number" id="newHeight" name="height" min="1" class="input input-bordered w-full max-w-xs" required>
<br>
<button type="submit" class="btn btn-secondary">Resize Image</button>
</form>
{{end}}
{{define "foot"}}
{{end}}

View File

@ -0,0 +1,22 @@
{{define "title"}}
Atridad Lahiji // Tools
{{end}}
{{define "headercontent"}}
Atridad Lahiji // Tools
{{end}}
{{define "head"}}
<link rel="stylesheet" href="/public/css/styles.tools.css" />
{{end}}
{{define "main"}}
<section class="flex flex-row flex-wrap gap-2 justify-center align-middle">
{{range .Tools}}
{{template "cardlinks" .}}
{{end}}
</section>
{{end}}
{{define "foot"}}
{{end}}

31
pages/tools.go Normal file
View File

@ -0,0 +1,31 @@
package pages
import (
"atri.dad/lib"
"github.com/labstack/echo/v4"
)
type ToolsProps struct {
Tools []lib.CardLink
}
func Tools(c echo.Context) error {
tools := []lib.CardLink{
{
Name: "Image Resizer",
Description: "Image Resizer Tool",
Href: "/tools/resize",
Internal: true,
},
}
props := ToolsProps{
Tools: tools,
}
// Specify the partials used by this page
partials := []string{"header", "navitems", "cardlinks"}
// Render the template
return lib.RenderTemplate(c.Response().Writer, "base", partials, props)
}