From ab2585c2e249991f04011ef1b4de732faad41980 Mon Sep 17 00:00:00 2001 From: Mavis Ou Date: Fri, 3 May 2024 01:12:16 -0700 Subject: [PATCH] various styling fixes - mostly for desktop nav --- .../fragments/blocks/nav/button.html | 2 +- .../fragments/blocks/nav/column.html | 6 +-- .../fragments/blocks/nav/dropdown.html | 38 +++++++------- .../fragments/blocks/nav/featured-column.html | 6 +-- .../templates/fragments/blocks/nav/item.html | 2 +- .../fragments/blocks/nav/overview.html | 8 +-- .../fragments/nav/blog/blog-dropdown.html | 5 +- .../fragments/nav/blog/featured-posts.html | 2 +- .../templates/fragments/nav/menu.html | 2 +- source/js/components/nav/desktop-dropdown.js | 4 +- tailwind-plugins/site-nav.js | 50 +++++++++++++++++++ tailwind.config.js | 4 +- 12 files changed, 94 insertions(+), 35 deletions(-) create mode 100644 tailwind-plugins/site-nav.js diff --git a/network-api/networkapi/templates/fragments/blocks/nav/button.html b/network-api/networkapi/templates/fragments/blocks/nav/button.html index 49210c0098a..50e49b89ee2 100644 --- a/network-api/networkapi/templates/fragments/blocks/nav/button.html +++ b/network-api/networkapi/templates/fragments/blocks/nav/button.html @@ -5,7 +5,7 @@ {% elif style == "primary-full-width" %} {% fragment as nav_button_style %}tw-btn-primary tw-min-w-full tw-py-4 tw-px-8{% endfragment %} {% elif style == "cta" %} - {% fragment as nav_button_style %}tw-leading-[130%] tw-text-blue-80 tw-p-2 hover:tw-underline{% endfragment %} + {% fragment as nav_button_style %}tw-leading-[130%] tw-text-blue-80 tw-p-4 hover:tw-underline{% endfragment %} {% endif %} {% fragment as base_styles %}link-button tw-font-bold tw-text-lg{% endfragment %} diff --git a/network-api/networkapi/templates/fragments/blocks/nav/column.html b/network-api/networkapi/templates/fragments/blocks/nav/column.html index e33576d1fdb..ac74ed38690 100644 --- a/network-api/networkapi/templates/fragments/blocks/nav/column.html +++ b/network-api/networkapi/templates/fragments/blocks/nav/column.html @@ -1,9 +1,9 @@ {% load wagtailcore_tags wagtailadmin_tags %} -{% fragment as base_styles %}tw-flex tw-flex-col tw-items-start tw-gap-8 tw-py-8{% endfragment %} -{% fragment as desktop_layout %}large:tw-py-22 large:tw-px-12{% endfragment %} +{% fragment as base_styles %}tw-gap-y-8{% endfragment %} +{% fragment as desktop_layout %}{% endfragment %} -
+
{% block title %}{{ value.title }}{% endblock title %}
{% block content %} diff --git a/network-api/networkapi/templates/fragments/blocks/nav/dropdown.html b/network-api/networkapi/templates/fragments/blocks/nav/dropdown.html index 9ae3422fb03..a6e794c3a49 100644 --- a/network-api/networkapi/templates/fragments/blocks/nav/dropdown.html +++ b/network-api/networkapi/templates/fragments/blocks/nav/dropdown.html @@ -1,9 +1,9 @@ {% load static wagtailcore_tags wagtailadmin_tags nav_tags %} -{% fragment as content_base_styles %}tw-py-0 tw-px-0 tw-gap-8 tw-overflow-y-auto tw-transition-all tw-duration-500{% endfragment %} -{% fragment as dropdown_selector_base %}tw-flex tw-flex-row tw-items-center tw-justify-between tw-w-full tw-py-12 tw-px-8 tw-gap-4{% endfragment %} +{% fragment as content_base_styles %}tw-container tw-overflow-y-auto tw-transition-all tw-duration-500 xlarge:tw-max-w-[1200px]{% endfragment %} +{% fragment as dropdown_selector_base %}tw-container tw-flex tw-flex-row tw-items-center tw-justify-between tw-w-full tw-py-12 tw-px-8 tw-gap-4{% endfragment %} -{% fragment as content_desktop %}xlarge:tw-max-w-[1350px] 2xl:tw-max-w-[1600px] xlarge:tw-w-full xlarge:tw-px-24 xlarge:tw-hidden{% endfragment %} +{% fragment as content_desktop %}xlarge:tw-px-0 xlarge:tw-hidden{% endfragment %} {% fragment as content_desktop_border %}xlarge:tw-border xlarge:tw-border-gray-20{% endfragment %} {% comment %} 40 (5rem) is the height of the navbar {% endcomment %} {% fragment as content_desktop_positioning %}xlarge:tw-fixed xlarge:tw-top-40 xlarge:tw-left-0 xlarge:tw-right-0 xlarge:tw-mx-auto{% endfragment %} @@ -27,28 +27,32 @@
-
-
- {% block content %} - {% if value.has_overview %} - {% include_block value.overview_value with button=value.button %} - {% endif %} - {% for column in value.columns %} - {% include_block column %} - {% endfor %} - {% if value.has_featured_column %} - {% include_block value.featured_column_value %} - {% endif %} +
+
+ + {% block full_span_button %} {% comment %} If there is a button but no overview, we want to render the button at the bottom of the dropdown. Otherwise it will be rendered together with the overview. {% endcomment %} {% if value.button and not value.has_overview %} -
+
{% include_block value.button with style="primary-full-width" %}
{% endif %} - {% endblock content %} + {% endblock full_span_button %}
diff --git a/network-api/networkapi/templates/fragments/blocks/nav/featured-column.html b/network-api/networkapi/templates/fragments/blocks/nav/featured-column.html index 09587435fb3..62556f667f2 100644 --- a/network-api/networkapi/templates/fragments/blocks/nav/featured-column.html +++ b/network-api/networkapi/templates/fragments/blocks/nav/featured-column.html @@ -1,9 +1,9 @@ {% load wagtailcore_tags wagtailadmin_tags %} -{% fragment as base_styles %}tw-flex tw-flex-col tw-items-start tw-gap-12 tw-py-8 tw-px-12 tw-bg-gray-02 tw-rounded-2xl{% endfragment %} -{% fragment as desktop_layout %}large:tw-py-22 large:tw-px-12 large:tw-rounded-none large:tw-col-span-1{% endfragment %} +{% fragment as base_styles %}tw-gap-12 tw-bg-gray-02 tw-rounded-2xl{% endfragment %} +{% fragment as desktop_layout %}xlarge:tw-rounded-none xlarge:tw-col-span-1{% endfragment %} -
+