From d7a2aa1001fc99fb16ccaa36fa08a08301744840 Mon Sep 17 00:00:00 2001 From: Greg Newman Date: Fri, 30 Jun 2023 10:29:54 -0400 Subject: [PATCH] :hammer: refactor the structure of the news list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The original ordered list does not scale well width wise so I’ve refactored this to adjust nicely when resizing the window. --- static/css/styles.css | 79 +++++++++++++++++++++++++++++----------- templates/news/list.html | 79 +++++++++++++++++++++++++++++++++++----- 2 files changed, 127 insertions(+), 31 deletions(-) diff --git a/static/css/styles.css b/static/css/styles.css index 802ee55f..ab54b3bc 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -1283,6 +1283,14 @@ input[type=file] { margin-left: 1rem; } +.-ml-5 { + margin-left: -1.25rem; +} + +.-ml-4 { + margin-left: -1rem; +} + .block { display: block; } @@ -1467,6 +1475,42 @@ input[type=file] { width: 200px; } +.w-2\/5 { + width: 40%; +} + +.w-2\/6 { + width: 33.333333%; +} + +.w-3\/6 { + width: 50%; +} + +.w-\[50px\] { + width: 50px; +} + +.w-\[150px\] { + width: 150px; +} + +.w-\[160px\] { + width: 160px; +} + +.w-\[180px\] { + width: 180px; +} + +.w-\[70px\] { + width: 70px; +} + +.w-\[170px\] { + width: 170px; +} + .min-w-0 { min-width: 0px; } @@ -1567,6 +1611,10 @@ input[type=file] { grid-template-columns: repeat(2, minmax(0, 1fr)); } +.grid-cols-4 { + grid-template-columns: repeat(4, minmax(0, 1fr)); +} + .grid-rows-1 { grid-template-rows: repeat(1, minmax(0, 1fr)); } @@ -1840,6 +1888,10 @@ input[type=file] { border-bottom-width: 4px; } +.border-l-2 { + border-left-width: 2px; +} + .border-gray-700 { --tw-border-opacity: 1; border-color: rgb(55 65 81 / var(--tw-border-opacity)); @@ -2757,28 +2809,6 @@ input[type=file] { background-color: rgb(49 74 87 / var(--tw-bg-opacity)); } -.dark .dark\:bg-yellow-300 { - --tw-bg-opacity: 1; - background-color: rgb(253 224 71 / var(--tw-bg-opacity)); -} - -.dark .dark\:bg-yellow-300\/70 { - background-color: rgb(253 224 71 / 0.7); -} - -.dark .dark\:bg-yellow-300\/50 { - background-color: rgb(253 224 71 / 0.5); -} - -.dark .dark\:bg-yellow-200 { - --tw-bg-opacity: 1; - background-color: rgb(254 240 138 / var(--tw-bg-opacity)); -} - -.dark .dark\:bg-yellow-200\/80 { - background-color: rgb(254 240 138 / 0.8); -} - .dark .dark\:font-medium { font-weight: 500; } @@ -2834,6 +2864,11 @@ input[type=file] { --tw-ring-color: rgb(107 114 128 / var(--tw-ring-opacity)); } +.dark .dark\:hover\:bg-orange:hover { + --tw-bg-opacity: 1; + background-color: rgb(255 159 0 / var(--tw-bg-opacity)); +} + .dark .hover\:dark\:text-white:hover { --tw-text-opacity: 1; color: rgb(255 255 255 / var(--tw-text-opacity)); diff --git a/templates/news/list.html b/templates/news/list.html index 57309bd1..3c5d8c00 100644 --- a/templates/news/list.html +++ b/templates/news/list.html @@ -18,47 +18,107 @@
{% url 'news' as target_url %} - +
{% url 'news-news-list' as target_url %} - +
{% url 'news-blogpost-list' as target_url %} - +
{% url 'news-link-list' as target_url %} - +
{% url 'news-poll-list' as target_url %} - +
{% url 'news-video-list' as target_url %} - +
{% if user.is_authenticated %}
- Submit News + Submit News
{% endif %} +
+
+ {% for entry in entry_list %} +
+ +
+ {% if entry.tag == "link" %} + {% url 'news-link-list' as target_url %} + + + + {% elif entry.tag == "news" %} + {% url 'news-news-list' as target_url %} + + + + {% elif entry.tag == "blogpost" %} + {% url 'news-blogpost-list' as target_url %} + + + + {% elif entry.tag == "poll" %} + {% url 'news-poll-list' as target_url %} + + + + {% elif entry.tag == "video" %} + {% url 'news-video-list' as target_url %} + + + + {% else %} + + {% endif %} +
+
+ {% if entry.author.image %} + {{ entry.author.get_full_name }} + {% else %} + + + + {% endif %} +
+
+ +

{{ entry.content|truncatechars:300 }}

+
+
+ {% endfor %} +
+
+ + {% comment %}
{% if entry_list %}
    @@ -100,10 +160,10 @@
@@ -123,5 +183,6 @@

No news items were found.

{% endif %} + {% endcomment %} {% endblock %}