summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunwox <me@unwox.com>2024-10-08 14:07:45 +0600
committerunwox <me@unwox.com>2024-10-08 14:07:58 +0600
commitadd39175e929ac28864dbdaaee773973567f682c (patch)
tree32129ea7acfb230836d9b2caf4c8747c36f05d28
parentb9e86f6efc66dac7a46f4f098b0eb109c46f8a2b (diff)
small html/css improvements
-rw-r--r--bin/serve.fnl27
-rw-r--r--static/style.css4
2 files changed, 19 insertions, 12 deletions
diff --git a/bin/serve.fnl b/bin/serve.fnl
index f98a5ff..eb56d8a 100644
--- a/bin/serve.fnl
+++ b/bin/serve.fnl
@@ -60,19 +60,22 @@
(fn item-template [product]
[:div {:class "tile"}
- [:a {:href product.url :style "display: block;"}
- [:img {:src product.image} ""]]
+ [:a {:href product.url :style "display: block;" :rel "nofollow"}
+ [:img {:src product.image :title product.title :alt product.title} ""]]
(site-name-template product.site)
- [:a {:href product.url :style "text-decoration: none;"}
+ [:a {:href product.url :style "text-decoration: none;" :rel "nofollow"}
[:NO-ESCAPE (.. "<h2>" (unescape product.title) "</h2>")]]
[:div {:class "price"}
(if product.price (.. product.price "₽") "")
- (if product.quantity (.. " за " product.quantity "г") "")
- (if (and product.price-per
+ (if (< 0 product.weight)
+ [:NO-ESCAPE (.. "за&nbsp;" product.weight "&nbsp;гр.")]
+ "")
+ (if (and (< 1 product.weight)
+ product.price-per
(< 0 product.price-per))
- [:NO-ESCAPE (.. " (" product.price-per "₽ за&nbsp;1г)")]
+ [:NO-ESCAPE (.. " (" product.price-per "₽ за&nbsp;1&nbsp;гр.)")]
"")]
- [:small {} (or product.description "")]])
+ [:small {} (unescape (str.truncate product.description 200))]])
(fn paginator-template [query page limit total]
(local last-page (math.ceil (/ total limit)))
@@ -109,11 +112,15 @@
[:div {:class "content"}
[:aside {:class "aside"}
[:div {:class "aside-content"}
- [:a {:href "/" :style "display: block;"}
- [:img {:class "logo" :src "static/logo.svg" :alt "Логотип meicha.ru"}]]
+ (if (~= query "")
+ [:a {:href "/" :style "display: block;"}
+ [:img {:class "logo" :src "static/logo.svg"
+ :alt "Логотип meicha.ru" :title "Логотип meicha.ru"}]]
+ [:img {:class "logo" :src "static/logo.svg"
+ :alt "Логотип meicha.ru" :title "Логотип meicha.ru"}])
[:form {:class "form"}
[:input {:type :search :name :query :value query
- :autofocus true :placeholder "enter search query"}]
+ :autofocus true :placeholder "Введите поисковый запрос"}]
[:button {:type :submit} "Искать"]]
paginator]]
[:section {}
diff --git a/static/style.css b/static/style.css
index 388ce24..9f68da1 100644
--- a/static/style.css
+++ b/static/style.css
@@ -21,7 +21,7 @@ body {
.aside-content {
position: sticky;
- top: 1rem;
+ top: 3rem;
}
.list {
@@ -38,7 +38,7 @@ body {
.tile h2 {
font-size: 1rem;
- margin-bottom: 0.5rem;
+ margin-bottom: 0.25rem;
margin-top: 0;
}