From 901a548d2e3cd16cc3529ba4a650e0d01155dbaa Mon Sep 17 00:00:00 2001 From: Drew Bednar Date: Wed, 11 Oct 2023 22:44:11 -0400 Subject: [PATCH] Styled contact table --- htmx_contact/main.py | 5 ++ htmx_contact/static/css/main.css | 100 ++++++++++++++++++++++++ htmx_contact/templates/contacts.html | 21 +++-- htmx_contact/templates/new_contact.html | 5 ++ 4 files changed, 125 insertions(+), 6 deletions(-) create mode 100644 htmx_contact/templates/new_contact.html diff --git a/htmx_contact/main.py b/htmx_contact/main.py index 1fc6253..185c1ad 100644 --- a/htmx_contact/main.py +++ b/htmx_contact/main.py @@ -45,3 +45,8 @@ def contacts(): results = session.scalars(stmt).all() return render_template("contacts.html", contacts=results) + + +@bp.route("/contacts/new", methods=["GET"]) +def new_contact(): + return render_template("new_contact.html") diff --git a/htmx_contact/static/css/main.css b/htmx_contact/static/css/main.css index 00cff52..8d1c9c1 100644 --- a/htmx_contact/static/css/main.css +++ b/htmx_contact/static/css/main.css @@ -1,3 +1,9 @@ +*, +*:before, +*:after { + box-sizing: border-box; +} + .toast-basic { padding: 12px 20px; color: #ffffff; @@ -17,3 +23,97 @@ .toastify.on { opacity: 1; } + +input[type=text] { + width: 300px; + padding: 10px 5px; + border-radius: .25rem; + border: 2px solid black; + font-size: 16px; +} + + +body { + font-family: 'Roboto', "Helvetica Neue"; + font-size: 16px; +} + +a { + text-decoration: none; +} + +table a { + color: cadetblue; +} + +table a:hover { + color: #5477f5; + transition: all 0.2s ease-in-out; + cursor: pointer; + border-bottom: 2.5px solid; +} + +.button { + padding: 12px 15px; + color: #ffffff; + background-color: cadetblue; + border: none; + border-radius: .25rem; + font-size: 16px; +} + +.button:hover { + background-color: #5477f5; + transition: all 0.2s ease-in-out; + color: #ffffff; +} + +.button a:hover { + color: #ffffff; +} + +.container { + width: 100%; + text-align: center; +} + +.width-60 table { + margin-top: 30px; + width: 100%; + text-align: left; + margin-left: auto; + margin-right: auto; + border-collapse: collapse; + border-bottom: 2px solid black; +} + +th, +td { + padding: 5px; +} + +table { + margin-bottom: 20px; +} + + +.width-60 { + width: 60%; + margin-left: auto; + margin-right: auto; +} + +.width-60 form { + text-align: left; +} + +.width-60 table thead { + border-bottom: 2px solid black; +} + +.form-container { + margin-top: 20px; + display: flex; + justify-content: space-between; + align-items: center; +} diff --git a/htmx_contact/templates/contacts.html b/htmx_contact/templates/contacts.html index 062ac36..e458288 100644 --- a/htmx_contact/templates/contacts.html +++ b/htmx_contact/templates/contacts.html @@ -1,12 +1,16 @@ {% extends 'base.html' %} {% block content %} -
- - - -
- +
+
+
+
+ + + +
+ Add Contact +
@@ -21,8 +25,13 @@ + + + {% endfor %}
First{{ contact.last_name }} {{ contact.phone }} {{ contact.email }}EditView
+
+
{% endblock %} diff --git a/htmx_contact/templates/new_contact.html b/htmx_contact/templates/new_contact.html new file mode 100644 index 0000000..286bef6 --- /dev/null +++ b/htmx_contact/templates/new_contact.html @@ -0,0 +1,5 @@ +{% extends 'base.html' %} + +{% block content %} +

New Contact

+{% endblock %}