initial commit
This commit is contained in:
commit
dd48aef782
8 changed files with 1010 additions and 0 deletions
67
index.templ
Normal file
67
index.templ
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
import "sauce/shared"
|
||||
|
||||
templ form() {
|
||||
<marquee behavior="alternate"><h1>sauce guru</h1></marquee>
|
||||
<p>upload your image:</p>
|
||||
<form enctype="multipart/form-data" action="/search" method="POST" onsubmit="false">
|
||||
<div>
|
||||
<input name="search" type="file"/>
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit">find!</button>
|
||||
</div>
|
||||
</form>
|
||||
}
|
||||
|
||||
templ results(originalB64 string, images []shared.Page) {
|
||||
<div style="display: flex;">
|
||||
<div>
|
||||
<h2>searched image:</h2>
|
||||
<img style="width: 20vw;" src={ originalB64 } crossorigin="anonymous"/>
|
||||
</div>
|
||||
<hr style="margin: 10px;">
|
||||
<div style="margin: 30px;">
|
||||
<h2>results:</h2>
|
||||
<div style="
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
">
|
||||
for i, img := range images {
|
||||
<div style="display: flex">
|
||||
<a href={ templ.SafeURL(img.Url) } target="_blank">
|
||||
<img
|
||||
if i == 0 {
|
||||
style="width: 20vw;"
|
||||
} else {
|
||||
style="width: 10vw;"
|
||||
}
|
||||
src={ fmt.Sprintf("/src?src=%s", img.Url) }/>
|
||||
</a>
|
||||
<div>
|
||||
<p>{img.Publication.Title}</p>
|
||||
<p>{fmt.Sprintf("page: %d", img.Order)}</p>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
templ layout(body templ.Component) {
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>sauce guru</title>
|
||||
// <link href="css/style.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
@body
|
||||
</body>
|
||||
</html>
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue