Skip to content
This repository was archived by the owner on May 22, 2024. It is now read-only.

Commit 5f86232

Browse files
update active tab and nav item
1 parent 7776271 commit 5f86232

File tree

5 files changed

+74
-3
lines changed

5 files changed

+74
-3
lines changed

docs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
This template is under construction and should only be used for prototyping
66

7-
The MkDocs Tech Docs Template is an [MkDocs theme](https://www.mkdocs.org/) that you can use to build technical documentation with a GOV.UK style. For a demo visit [mkdocs-tech-docs-template](https://ministryofjustice.github.io/mkdocs-tech-docs-template/).
7+
The MkDocs Tech Docs Template is an [MkDocs theme](https://www.mkdocs.org/) that you can use to build technical documentation with a [GOV.UK style](https://design-system.service.gov.uk/). For a demo visit [mkdocs-tech-docs-template](https://ministryofjustice.github.io/mkdocs-tech-docs-template/).
88

99
The MkDocs Tech Docs Template is a python-based alternative to the ruby-based Middleman [Tech Docs Template](https://github.com/alphagov/tech-docs-template) with the following benefits:
1010

1111
- simple to setup, use and customise
1212
- exploits the [MkDocs Materials theme](https://squidfunk.github.io/mkdocs-material/) and all it's associated features
13-
- compatible with the vast and growing ecosystem of [MkDocs Plugins](https://github.com/mkdocs/mkdocs/wiki/MkDocs-Plugins) see [plugins](plugins/) for some examples
13+
- compatible with the vast ecosystem of [MkDocs Plugins](https://github.com/mkdocs/mkdocs/wiki/MkDocs-Plugins), see [plugins](plugins/) for some examples
1414
- unified tech stack for python-based teams and projects
1515
- easy to upgrade as new versions of the theme are released
1616

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ tech_docs_template =
3838
assets/stylesheets/*
3939
favicons/*
4040
logos/*
41+
partials/*

tech_docs_template/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.0.16"
1+
__version__ = "0.0.17"

tech_docs_template/assets/stylesheets/extra.css

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,21 @@
7171
text-underline-offset: 2px;
7272
}
7373

74+
.md-nav__item--active .md-nav__item--active {
75+
font-weight: 700;
76+
margin-left: 10px;
77+
padding-left: 3px;
78+
border-left: 3px solid;
79+
border-left-color: #1d70b8;
80+
}
81+
82+
.md-nav--secondary .md-nav__link--active {
83+
/* font-weight: 700; */
84+
padding-left: 3px;
85+
border-left: 3px solid;
86+
border-left-color: #1d70b8;
87+
}
88+
7489
/* Configures the tabs below the header */
7590
.md-tabs {
7691
color: #1d70b8;
@@ -87,6 +102,21 @@
87102
font-weight: 700;
88103
}
89104

105+
.md-tabs__link:hover {
106+
text-decoration: underline;
107+
text-decoration-thickness: 3px;
108+
text-underline-offset: 3px;
109+
}
110+
111+
.md-tabs__item--active {
112+
border-bottom: 4px solid;
113+
border-bottom-color: #1d70b8;
114+
/* text-decoration: underline;
115+
text-decoration-thickness: 3px;
116+
text-underline-offset: 10px;
117+
text-decoration-color: #1d70b8; */
118+
}
119+
90120
.md-typeset .admonition,
91121
.md-typeset details {
92122
font-size: 16px;
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!-- Work-around until fix merged into mkdocs material -->
2+
<!-- https://github.com/squidfunk/mkdocs-material/discussions/5048 -->
3+
4+
{% block tab_items %}
5+
{% if not class %}
6+
{% set class = "md-tabs__link" %}
7+
{% set item_class = "md-tabs__item" %}
8+
{% if nav_item.active %}
9+
{% set class = class ~ " md-tabs__link--active" %}
10+
{% set item_class = item_class ~ " md-tabs__item--active" %}
11+
{% endif %}
12+
{% endif %}
13+
14+
<!-- Main navigation item with nested items -->
15+
{% if nav_item.children %}
16+
{% set title = title | d(nav_item.title) %}
17+
{% set nav_item = nav_item.children | first %}
18+
19+
<!-- Recurse, if the first item has further nested items -->
20+
{% if nav_item.children %}
21+
{% include "partials/tabs-item.html" %}
22+
23+
<!-- Render item -->
24+
{% else %}
25+
<li class="{{ item_class }}">
26+
<a href="{{ nav_item.url | url }}" class="{{ class }}">
27+
{{ title }}
28+
</a>
29+
</li>
30+
{% endif %}
31+
32+
<!-- Main navigation item -->
33+
{% else %}
34+
<li class="{{ item_class }}">
35+
<a href="{{ nav_item.url | url }}" class="{{ class }}">
36+
{{ nav_item.title }}
37+
</a>
38+
</li>
39+
{% endif %}
40+
{% endblock %}

0 commit comments

Comments
 (0)