2024-12-08 18:48:04 -05:00
|
|
|
package layout
|
|
|
|
|
|
|
|
type (
|
|
|
|
Alignment templ.Attributes
|
|
|
|
ScreenWidth templ.Attributes
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
AlignCenter = Alignment{
|
|
|
|
"class": "flex items-center justify-center",
|
|
|
|
}
|
|
|
|
AlignEnd = Alignment{
|
|
|
|
"class": "flex items-end justify-center",
|
|
|
|
}
|
|
|
|
MaxWidthSmall = ScreenWidth{
|
|
|
|
"class": "max-w-screen-sm",
|
|
|
|
}
|
|
|
|
MaxWidthMedium = ScreenWidth{
|
|
|
|
"class": "max-w-screen-md",
|
|
|
|
}
|
|
|
|
MaxWidthFull = ScreenWidth{
|
|
|
|
"class": "w-full",
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
// Layout is a component that renders the general layout of the application
|
2024-12-11 15:11:24 -05:00
|
|
|
templ View(title string) {
|
2024-12-08 18:48:04 -05:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
2024-12-09 21:45:52 -05:00
|
|
|
@Head(title, "0.0.11")
|
2024-12-08 18:48:04 -05:00
|
|
|
<body class="flex items-center justify-center h-full lg:p-24 md:16 p-4 no-scrollbar">
|
2024-12-11 14:55:19 -05:00
|
|
|
<main class="flex-row items-center justify-center mx-auto w-fit max-w-screen-lg gap-y-3">
|
2024-12-08 18:48:04 -05:00
|
|
|
{ children... }
|
|
|
|
</main>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
}
|
|
|
|
|
|
|
|
templ Body(align Alignment, screenWidth ScreenWidth) {
|
2024-12-09 15:21:02 -05:00
|
|
|
<style>
|
|
|
|
.sl-toast-stack {
|
|
|
|
top: auto;
|
|
|
|
bottom: 0;
|
|
|
|
left: auto;
|
|
|
|
right: 0;
|
|
|
|
}
|
|
|
|
.no-scrollbar::-webkit-scrollbar {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
</style>
|
2024-12-08 18:48:04 -05:00
|
|
|
<body class="flex items-center justify-center h-full lg:p-24 md:16 p-4 no-scrollbar">
|
|
|
|
<main class="flex-row items-center justify-center mx-auto w-fit max-w-screen-sm gap-y-3">
|
|
|
|
{ children... }
|
|
|
|
</main>
|
|
|
|
</body>
|
|
|
|
}
|
|
|
|
|
|
|
|
func Clsx(attrs ...templ.Attributes) templ.Attributes {
|
|
|
|
merged := templ.Attributes{}
|
|
|
|
for _, attr := range attrs {
|
|
|
|
for k, v := range attr {
|
|
|
|
merged[k] = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return merged
|
|
|
|
}
|