From 581467e95cf618030d1d0200673e65a27dd716a0 Mon Sep 17 00:00:00 2001 From: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> Date: Fri, 7 Feb 2025 11:32:19 +0100 Subject: [PATCH] Added documentation type filtering to search. --- djangoproject/scss/_style.scss | 36 +++++++++++++ docs/templates/docs/search_results.html | 7 +++ docs/tests.py | 67 +++++++++++++++++++++++++ docs/views.py | 5 ++ 4 files changed, 115 insertions(+) diff --git a/djangoproject/scss/_style.scss b/djangoproject/scss/_style.scss index 48b436a08..daf9ad799 100644 --- a/djangoproject/scss/_style.scss +++ b/djangoproject/scss/_style.scss @@ -2563,6 +2563,42 @@ table.docutils th { } } +.tabs { + display: flex; + gap: 10px; + border-bottom: 2px solid var(--hairline-color); + overflow-x: auto; + white-space: nowrap; + padding-bottom: 0; + position: relative; + + a:not(.active):focus, + a:not(.active):active, + a:not(.active):hover { + outline: none; + border-bottom: 3px solid var(--hairline-color); + } + + .tab { + padding: 10px 20px; + text-decoration: none; + background: transparent; + border: none; + border-bottom: 3px solid transparent; + transition: color 0.3s ease, border-bottom 0.3s ease; + font-size: 16px; + color: var(--text-light); + flex-shrink: 0; + } + + .active { + color: var(--body-fg); + font-weight: bold; + border-bottom: 3px solid var(--primary); + } +} + + .search-links { @extend .list-links; diff --git a/docs/templates/docs/search_results.html b/docs/templates/docs/search_results.html index 11daede6c..5eaf95bd6 100644 --- a/docs/templates/docs/search_results.html +++ b/docs/templates/docs/search_results.html @@ -32,6 +32,13 @@

{% trans "No search query given" %}

{% if query %}
+
+ {% trans "All" %} + {% trans "API Reference" %} + {% trans "Using Django" %} + {% trans "How-to guides" %} + {% trans "Release notes" %} +