mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 21:09:11 +00:00
117 lines
2.7 KiB
Plaintext
117 lines
2.7 KiB
Plaintext
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
|
|
templ View(title string) {
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
@Head(title, "0.0.11")
|
|
<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-lg gap-y-3">
|
|
{ children... }
|
|
</main>
|
|
</body>
|
|
</html>
|
|
}
|
|
|
|
templ Head(title string, nebulaVersion string) {
|
|
<head>
|
|
@Turnstile()
|
|
@Tailwind()
|
|
@Alpine()
|
|
@Htmx()
|
|
@Dexie()
|
|
@Nebula(nebulaVersion)
|
|
<meta charset="UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
<title>{ title }</title>
|
|
<!-- Sets the status bar style to transparent -->
|
|
<meta name="apple-mobile-web-app-capable" content="yes"/>
|
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
|
|
<link rel="icon" type="image/png" href="https://cdn.sonr.id/favicon.png"/>
|
|
<style>
|
|
@keyframes fade-in {
|
|
from { opacity: 0; }
|
|
}
|
|
|
|
@keyframes fade-out {
|
|
to { opacity: 0; }
|
|
}
|
|
|
|
@keyframes slide-from-right {
|
|
from { transform: translateX(90px); }
|
|
}
|
|
|
|
@keyframes slide-to-left {
|
|
to { transform: translateX(-90px); }
|
|
}
|
|
|
|
.slide-it {
|
|
view-transition-name: slide-it;
|
|
}
|
|
|
|
::view-transition-old(slide-it) {
|
|
animation: 180ms cubic-bezier(0.4, 0, 1, 1) both fade-out,
|
|
600ms cubic-bezier(0.4, 0, 0.2, 1) both slide-to-left;
|
|
}
|
|
::view-transition-new(slide-it) {
|
|
animation: 420ms cubic-bezier(0, 0, 0.2, 1) 90ms both fade-in,
|
|
600ms cubic-bezier(0.4, 0, 0.2, 1) both slide-from-right;
|
|
}
|
|
</style>
|
|
{ children... }
|
|
</head>
|
|
}
|
|
|
|
templ Body(align Alignment, screenWidth ScreenWidth) {
|
|
<style>
|
|
.sl-toast-stack {
|
|
top: auto;
|
|
bottom: 0;
|
|
left: auto;
|
|
right: 0;
|
|
}
|
|
.no-scrollbar::-webkit-scrollbar {
|
|
display: none;
|
|
}
|
|
</style>
|
|
<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
|
|
}
|