From 7c3fcf9f1bbed568e86f8ba1de8efc79452989f1 Mon Sep 17 00:00:00 2001
From: Anton Sarukhanov <code@ant.sr>
Date: Wed, 2 Nov 2016 00:49:17 -0400
Subject: [PATCH] Minimal forms css, autosize textareas

---
 bower.json                 |  3 ++-
 theme/static/css/style.css | 11 +++++++++++
 theme/templates/base.html  |  4 ++++
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/bower.json b/bower.json
index 0a997b7..ddec083 100644
--- a/bower.json
+++ b/bower.json
@@ -13,7 +13,8 @@
     "tests"
   ],
   "dependencies": {
-    "normalize-css": "normalize.css#^4.1.1"
+    "normalize-css": "normalize.css#^4.1.1",
+    "autosize": "^3.0.18"
   },
   "install": {
     "path": "theme/static/lib"
diff --git a/theme/static/css/style.css b/theme/static/css/style.css
index d399173..e33c1c7 100644
--- a/theme/static/css/style.css
+++ b/theme/static/css/style.css
@@ -128,6 +128,17 @@ h6:first-child {
     margin-top: 0;
 }
 
+/* Forms */
+form {
+    display: flex;
+    flex-wrap: wrap;
+}
+input {
+    flex: 1 0 10em;
+}
+textarea {
+    flex: 0 0 100%;
+}
 
 /* Links */
 a:link,
diff --git a/theme/templates/base.html b/theme/templates/base.html
index 651b121..6450c32 100644
--- a/theme/templates/base.html
+++ b/theme/templates/base.html
@@ -85,6 +85,10 @@
     </footer>
     {% endif %}
     {% endblock %}
+    {% if "textarea" in self.content() %}
+    <script src="{{ SITEURL }}/theme/lib/autosize/autosize.js"></script>
+    <script>autosize(document.querySelectorAll('textarea'));</script>
+    {% endif %}
     <script src="{{ SITEURL }}/theme/js/script.js"></script>
     {% include 'analytics.html' %}
 </body>
-- 
GitLab