Фикс стилей

This commit is contained in:
Александр Кирюхин 2024-10-08 18:48:55 +03:00
parent e849e705c3
commit a20e2ace25
Signed by: neonxp
SSH key fingerprint: SHA256:SVt7TjxbVc87m1QYaQziOJ0N3OCFURv2g76gD/UTTXI
7 changed files with 30 additions and 22 deletions

View file

@ -21,18 +21,16 @@ templ Layout(params HeaderParams) {
</head> </head>
<body> <body>
<main class="container"> <main class="container">
<nav> <div class="header">
<ul> <a href="/"><strong>ШОргРу</strong></a>
<li><a href="/"><strong>ШОргРу</strong></a></li> <div class="top-menu" hx-boost="true" hx-indicator=".loader">
</ul>
<ul hx-boost="true" hx-indicator=".loader">
<span aria-busy="true" class="loader htmx-indicator">Загрузка...</span> <span aria-busy="true" class="loader htmx-indicator">Загрузка...</span>
<li><a href="/">Главная</a></li> <a href="/">Главная</a>
<li><a href="/random">Случайные</a></li> <a href="/random">Рандом</a>
<li><a href="/top">Топ</a></li> <a href="/top">Топ</a>
<li><a href="/add">Добавить цитату</a></li> <a href="/add">Добавить</a>
</ul> </div>
</nav> </div>
{ children... } { children... }
</main> </main>
</body> </body>

View file

@ -68,7 +68,7 @@ func Layout(params HeaderParams) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><meta name=\"yandex-verification\" content=\"ee0e23da00ce9fe4\"><title>ШОргРу</title></head><body><main class=\"container\"><nav><ul><li><a href=\"/\"><strong>ШОргРу</strong></a></li></ul><ul hx-boost=\"true\" hx-indicator=\".loader\"><span aria-busy=\"true\" class=\"loader htmx-indicator\">Загрузка...</span><li><a href=\"/\">Главная</a></li><li><a href=\"/random\">Случайные</a></li><li><a href=\"/top\">Топ</a></li><li><a href=\"/add\">Добавить цитату</a></li></ul></nav>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><meta name=\"yandex-verification\" content=\"ee0e23da00ce9fe4\"><title>ШОргРу</title></head><body><main class=\"container\"><div class=\"header\"><a href=\"/\"><strong>ШОргРу</strong></a><div class=\"top-menu\" hx-boost=\"true\" hx-indicator=\".loader\"><span aria-busy=\"true\" class=\"loader htmx-indicator\">Загрузка...</span> <a href=\"/\">Главная</a> <a href=\"/random\">Рандом</a> <a href=\"/top\">Топ</a> <a href=\"/add\">Добавить</a></div></div>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }

View file

@ -22,7 +22,7 @@ templ List(quotes []model.Quote, page, count int) {
<nav> <nav>
<ul hx-boost="true" hx-indicator=".loader"> <ul hx-boost="true" hx-indicator=".loader">
if page > 0 { if page > 0 {
<li><a href={ templ.URL(fmt.Sprintf("/?page=%d", page-1)) }>&larr;</a></li> <li><a href={ templ.URL(fmt.Sprintf("?page=%d", page-1)) }>&larr;</a></li>
} }
for _, p := range generatePagination(page, count/20) { for _, p := range generatePagination(page, count/20) {
if p == "..." { if p == "..." {
@ -30,12 +30,12 @@ templ List(quotes []model.Quote, page, count int) {
} else if p == strconv.Itoa(page) { } else if p == strconv.Itoa(page) {
<li>[{ p }]</li> <li>[{ p }]</li>
} else { } else {
<li><a href={ templ.URL(fmt.Sprintf("/?page=%s", p)) }>{ p }</a></li> <li><a href={ templ.URL(fmt.Sprintf("?page=%s", p)) }>{ p }</a></li>
} }
} }
if page < count/20 { if page < count/20 {
<li><a href={ templ.URL(fmt.Sprintf("/?page=%d", page+1)) }>&rarr;</a></li> <li><a href={ templ.URL(fmt.Sprintf("?page=%d", page+1)) }>&rarr;</a></li>
} }
</ul> </ul>
</nav> </nav>

View file

@ -65,7 +65,7 @@ func List(quotes []model.Quote, page, count int) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var3 templ.SafeURL = templ.URL(fmt.Sprintf("/?page=%d", page-1)) var templ_7745c5c3_Var3 templ.SafeURL = templ.URL(fmt.Sprintf("?page=%d", page-1))
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var3))) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var3)))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
@ -104,7 +104,7 @@ func List(quotes []model.Quote, page, count int) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var5 templ.SafeURL = templ.URL(fmt.Sprintf("/?page=%s", p)) var templ_7745c5c3_Var5 templ.SafeURL = templ.URL(fmt.Sprintf("?page=%s", p))
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var5))) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var5)))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
@ -116,7 +116,7 @@ func List(quotes []model.Quote, page, count int) templ.Component {
var templ_7745c5c3_Var6 string var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(p) templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(p)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/tpl/list.templ`, Line: 33, Col: 64} return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/tpl/list.templ`, Line: 33, Col: 63}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@ -133,7 +133,7 @@ func List(quotes []model.Quote, page, count int) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var7 templ.SafeURL = templ.URL(fmt.Sprintf("/?page=%d", page+1)) var templ_7745c5c3_Var7 templ.SafeURL = templ.URL(fmt.Sprintf("?page=%d", page+1))
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var7))) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var7)))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err

View file

@ -22,12 +22,11 @@ templ Random(quotes []model.Quote) {
hx-get="/random" hx-get="/random"
hx-swap="outerHTML" hx-swap="outerHTML"
hx-select="#random" hx-select="#random"
hx-target="#random"
hx-indicator="#loader" hx-indicator="#loader"
> >
Загрузить ещё... Загрузить ещё...
</a> </a>
<span aria-busy="true" id="loader" class="htmx-indicator">Загрузка...</span>
</div> </div>
<span aria-busy="true" id="loader" class="htmx-indicator">Загрузка...</span>
} }
} }

View file

@ -58,7 +58,7 @@ func Random(quotes []model.Quote) templ.Component {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a role=\"button\" hx-get=\"/random\" hx-swap=\"outerHTML\" hx-select=\"#random\" hx-target=\"#random\" hx-indicator=\"#loader\">Загрузить ещё...</a> <span aria-busy=\"true\" id=\"loader\" class=\"htmx-indicator\">Загрузка...</span></div>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a role=\"button\" hx-get=\"/random\" hx-swap=\"outerHTML\" hx-select=\"#random\" hx-indicator=\"#loader\">Загрузить ещё...</a></div><span aria-busy=\"true\" id=\"loader\" class=\"htmx-indicator\">Загрузка...</span>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }

View file

@ -23,3 +23,14 @@ article footer {
.htmx-request.htmx-indicator{ .htmx-request.htmx-indicator{
opacity:1; opacity:1;
} }
.header {
display: flex;
flex-direction: row;
justify-content: space-between;
margin-bottom: var(--pico-block-spacing-vertical);
}
.top-menu {
text-align: end;
}