Skip to content

Commit 0eecc84

Browse files
authored
Fix/main branch bugs (#389)
* Fix: Styling bugs in switcher * Fix:Banner version issue * fix(ui): resolve navigation layout issues on mobile devices * fix: styling issues * docs: Add comments for better readability
1 parent 8fa1875 commit 0eecc84

7 files changed

Lines changed: 188 additions & 127 deletions

File tree

.github/workflows/build-gh-pages.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: deploy-book
22

3+
# Run when pushing to main or translation branches
34
on:
45
push:
56
branches:
@@ -12,6 +13,7 @@ concurrency:
1213
cancel-in-progress: true
1314

1415
jobs:
16+
# Get language and version info
1517
get-info:
1618
runs-on: ubuntu-latest
1719
outputs:
@@ -21,12 +23,14 @@ jobs:
2123
- name: Checkout repository
2224
uses: actions/checkout@v4
2325

26+
# Read languages from JSON file
2427
- name: Get languages directly with jq
2528
id: get-languages
2629
run: |
2730
languages=$(jq -c '[.[] | .code]' DISCOVER/_static/languages.json)
2831
echo "languages=${languages}" >> "$GITHUB_OUTPUT"
2932
33+
# Determine version based on ref type and name
3034
- name: Determine version from GitHub context
3135
id: version-info
3236
env:
@@ -40,12 +44,13 @@ jobs:
4044
version="${REF_NAME%-translations}"
4145
fi
4246
echo "version=$version" >> "$GITHUB_OUTPUT"
43-
47+
48+
# Build docs for each language
4449
deploy-book:
4550
needs: get-info
4651
runs-on: ubuntu-latest
4752
strategy:
48-
max-parallel: 1
53+
max-parallel: 1 # Build one at a time
4954
matrix:
5055
language: ${{ fromJSON(needs.get-info.outputs.languages) }}
5156
steps:
@@ -59,13 +64,15 @@ jobs:
5964
with:
6065
python-version: '3.13'
6166

67+
# Build the documentation
6268
- name: Build documentation with script
6369
env:
6470
VERSION: ${{ needs.get-info.outputs.version }}
6571
LANGUAGE: ${{ matrix.language }}
6672
run: |
6773
bash ci/build_website.sh
6874
75+
# Deploy the built documentation
6976
- name: Deploy language to GitHub Pages
7077
uses: peaceiris/actions-gh-pages@v4
7178
with:
@@ -74,6 +81,7 @@ jobs:
7481
destination_dir: ${{ needs.get-info.outputs.version }}/${{ matrix.language }}
7582
keep_files: true
7683

84+
# Create redirect for version
7785
create-redirect:
7886
needs: [get-info, deploy-book]
7987
runs-on: ubuntu-latest
@@ -105,6 +113,7 @@ jobs:
105113
destination_dir: ${{ needs.get-info.outputs.version }}
106114
keep_files: true
107115

116+
# Deploy files to root (main branch only)
108117
deploy-root-files:
109118
needs: [create-redirect]
110119
runs-on: ubuntu-latest
@@ -113,12 +122,13 @@ jobs:
113122
- name: Checkout repository
114123
uses: actions/checkout@v4
115124

125+
# Copy important files to root
116126
- name: Create root files directory
117127
run: |
118128
mkdir -p root_files
119-
cp DISCOVER/404.html root_files/
120-
cp index.html root_files/
121-
cp DISCOVER/_static/versions.json root_files/
129+
cp DISCOVER/404.html root_files/ # Error page
130+
cp index.html root_files/ # Landing page
131+
cp DISCOVER/_static/versions.json root_files/ # Versions list
122132
123133
- name: Deploy root files to GitHub Pages
124134
uses: peaceiris/actions-gh-pages@v4

DISCOVER/_static/css/Switchers.css

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
/* Version switcher and language switcher */
2+
.version-switcher__button,
3+
#language-switcher-button {
4+
font-size: 1rem !important;
5+
color: #495057 !important;
6+
border: 1px solid #dee2e6 !important;
7+
}
8+
9+
.version-switcher__button:hover,
10+
#language-switcher-button:hover,
11+
.version-switcher__button:focus,
12+
#language-switcher-button:focus {
13+
background-color: #f8f9fa !important;
14+
border-color: transparent !important;
15+
box-shadow: 0 0 0 0.1875rem #e89217 !important;
16+
}
17+
18+
.version-switcher__button:hover,
19+
#language-switcher-button:hover {
20+
color: #222832 !important;
21+
}
22+
23+
.version-switcher__button:focus,
24+
#language-switcher-button:focus {
25+
outline: none !important;
26+
}
27+
28+
.version-switcher__button::after,
29+
#language-switcher-button::after {
30+
content: "" !important;
31+
display: inline-block !important;
32+
margin-left: 0.5rem !important;
33+
vertical-align: 0.125em !important;
34+
border: 0.3em solid transparent !important;
35+
border-top-color: #495057 !important;
36+
border-bottom-width: 0 !important;
37+
}
38+
39+
.version-switcher__button:hover::after,
40+
#language-switcher-button:hover::after {
41+
border-top-color: #222832 !important;
42+
}
43+
44+
.version-switcher__button .caret,
45+
.version-switcher__button::before {
46+
display: none !important;
47+
}
48+
49+
.version-switcher__menu .list-group-item:hover,
50+
.dropdown-item:hover {
51+
background-color: #f8f9fa !important;
52+
color: #e89217 !important;
53+
text-decoration: underline !important;
54+
text-decoration-thickness: 0.15rem !important;
55+
}
56+
57+
.dropdown-item.active {
58+
color: #528fe4 !important;
59+
background-color: #ffffff !important;
60+
box-shadow: inset 3px 0 0 #528fe4 !important;
61+
}
62+
63+
.dropdown-menu > li:not(:last-child) {
64+
border-bottom: 1px solid #dee2e6 !important;
65+
}
66+
67+
.dropdown-item.active:hover {
68+
background-color: #f8f9fa !important;
69+
color: #e89217 !important;
70+
}
71+
72+
73+
html[data-theme=dark] .version-switcher__button,
74+
html[data-theme=dark] #language-switcher-button {
75+
color: #9ca4af !important;
76+
background-color: #121212 !important;
77+
border-color: #48566b !important;
78+
}
79+
80+
html[data-theme=dark] .version-switcher__button:hover,
81+
html[data-theme=dark] #language-switcher-button:hover,
82+
html[data-theme=dark] .version-switcher__button:focus,
83+
html[data-theme=dark] #language-switcher-button:focus{
84+
color: #ced6dd !important;
85+
border-color: transparent !important;
86+
}
87+
88+
html[data-theme=dark] .version-switcher__button:focus,
89+
html[data-theme=dark] #language-switcher-button:focus{
90+
outline: none !important;
91+
}
92+
93+
html[data-theme=dark] .version-switcher__button::after,
94+
html[data-theme=dark] #language-switcher-button::after {
95+
border-top-color: #9ca4af !important;
96+
}
97+
98+
html[data-theme=dark] .version-switcher__button:hover::after,
99+
html[data-theme=dark] #language-switcher-button:hover::after {
100+
border-top-color: #ced6dd !important;
101+
}
102+
103+
html[data-theme=dark] .version-switcher__menu,
104+
html[data-theme=dark] .version-switcher__menu .list-group-item {
105+
background-color: #121212 !important;
106+
}
107+
108+
html[data-theme=dark] .version-switcher__menu .list-group-item:hover,
109+
html[data-theme=dark] .dropdown-item:hover {
110+
background-color: #0D0D0D !important;
111+
color: #e89217 !important;
112+
text-decoration: underline !important;
113+
text-decoration-thickness: 0.15rem !important;
114+
}
115+
116+
html[data-theme=dark] .dropdown-item.active {
117+
background-color: #121212 !important;
118+
}
119+
120+
html[data-theme=dark] .dropdown-item.active:hover {
121+
background-color: #0D0D0D !important;
122+
}
123+
124+
.bd-header-article .version-switcher__button,
125+
.bd-header-article #language-switcher-button {
126+
margin: 0 !important;
127+
}
128+
129+
html[data-theme=dark] .dropdown-menu > li:not(:last-child) {
130+
border-bottom: 1px solid #48566b !important;
131+
}

DISCOVER/_static/css/mainLogo.css

Lines changed: 0 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -119,110 +119,3 @@ html[data-theme=dark] .social-links a:hover {
119119
margin: 1rem 0 0 0;
120120
}
121121
}
122-
123-
/* Version switcher and language switcher */
124-
.version-switcher__button,
125-
#language-switcher-button {
126-
font-size: 1rem !important;
127-
color: #495057 !important;
128-
border: 1px solid #dee2e6 !important;
129-
}
130-
131-
.version-switcher__button:hover,
132-
#language-switcher-button:hover,
133-
.version-switcher__button:focus,
134-
#language-switcher-button:focus {
135-
background-color: #f8f9fa !important;
136-
border-color: transparent !important;
137-
box-shadow: 0 0 0 0.1875rem #e89217 !important;
138-
}
139-
140-
.version-switcher__button:hover,
141-
#language-switcher-button:hover {
142-
color: #222832 !important;
143-
}
144-
145-
.version-switcher__button:focus,
146-
#language-switcher-button:focus {
147-
outline: none !important;
148-
}
149-
150-
.version-switcher__button::after,
151-
#language-switcher-button::after {
152-
content: "" !important;
153-
display: inline-block !important;
154-
margin-left: 0.5rem !important;
155-
vertical-align: 0.125em !important;
156-
border: 0.3em solid transparent !important;
157-
border-top-color: #495057 !important;
158-
border-bottom-width: 0 !important;
159-
}
160-
161-
.version-switcher__button:hover::after,
162-
#language-switcher-button:hover::after {
163-
border-top-color: #222832 !important;
164-
}
165-
166-
.version-switcher__button .caret,
167-
.version-switcher__button::before {
168-
display: none !important;
169-
}
170-
171-
.version-switcher__menu .list-group-item:hover,
172-
.dropdown-item:hover {
173-
background-color: #f8f9fa !important;
174-
}
175-
176-
.dropdown-item.active {
177-
color: #528fe4 !important;
178-
background-color: #ffffff !important;
179-
box-shadow: inset 3px 0 0 #528fe4 !important;
180-
border-bottom: 1px solid #dee2e6 !important;
181-
}
182-
183-
html[data-theme=dark] .version-switcher__button,
184-
html[data-theme=dark] #language-switcher-button {
185-
color: #9ca4af !important;
186-
background-color: #121212 !important;
187-
border-color: #48566b !important;
188-
}
189-
190-
html[data-theme=dark] .version-switcher__button:hover,
191-
html[data-theme=dark] #language-switcher-button:hover {
192-
color: #ced6dd !important;
193-
}
194-
195-
html[data-theme=dark] .version-switcher__button::after,
196-
html[data-theme=dark] #language-switcher-button::after {
197-
border-top-color: #9ca4af !important;
198-
}
199-
200-
html[data-theme=dark] .version-switcher__button:hover::after,
201-
html[data-theme=dark] #language-switcher-button:hover::after {
202-
border-top-color: #ced6dd !important;
203-
}
204-
205-
html[data-theme=dark] .version-switcher__menu,
206-
html[data-theme=dark] .version-switcher__menu .list-group-item {
207-
background-color: #121212 !important;
208-
}
209-
210-
html[data-theme=dark] .version-switcher__menu .list-group-item:hover,
211-
html[data-theme=dark] .dropdown-item:hover {
212-
background-color: #000000 !important;
213-
}
214-
215-
html[data-theme=dark] .dropdown-item.active {
216-
background-color: #121212 !important;
217-
border-bottom-color: #48566b !important;
218-
}
219-
220-
html[data-theme=dark] .dropdown-item.active:hover {
221-
color: #ced6dd !important;
222-
background-color: #121212 !important;
223-
}
224-
225-
.bd-header-article .version-switcher__button,
226-
.bd-header-article #language-switcher-button {
227-
margin: 0 !important;
228-
}

DISCOVER/_templates/language-switcher.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<ul class="dropdown-menu" aria-labelledby="language-switcher-button">
77
{% for item in languages %}
88
<li>
9-
<a class="dropdown-item{% if current_language == item.code %}active{% endif %}"
9+
<a class="dropdown-item{% if current_language == item.code %} active{% endif %}"
1010
href="{{ baseurl }}/{{ current_version }}/{{ item.code }}/{{ pagename }}.html"
1111
{% if item.direction %}dir="{{ item.direction }}"{% endif %}>
1212
{{ item.name_local }}

DISCOVER/conf.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import json
22
import os
33

4+
# Get version and language from environment variables
45
version = os.environ.get("WEBSITE_VERSION", "dev")
6+
release = version
57
language = os.environ.get("WEBSITE_LANGUAGE", "en")
68

79
baseurl = 'https://discover-cookbook.numfocus.org'
@@ -50,7 +52,7 @@
5052
external_toc_exclude_missing = False
5153
external_toc_path = '_toc.yml'
5254
html_baseurl = ''
53-
html_css_files = ['css/mainLogo.css']
55+
html_css_files = ['css/mainLogo.css','css/Switchers.css']
5456
html_favicon = ''
5557
html_js_files = ['js/footer.js', 'js/logo-switcher.js']
5658
html_logo = '_static/images/logo-light.png'
@@ -72,10 +74,12 @@
7274
'use_edit_page_button': False,
7375
'use_issues_button': True,
7476

75-
77+
# Header layout
7678
"article_header_start": ["toggle-primary-sidebar","version-switcher","language-switcher"],
7779
"navigation_with_keys": False,
7880
"show_version_warning_banner": True,
81+
82+
# Version switcher config
7983
"switcher": {
8084
"json_url": "https://discover-cookbook.numfocus.org/versions.json",
8185
"version_match": version,

ci/build_website.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ pip install -r requirements.txt
1313
# Clean tags directory
1414
rm -rf DISCOVER/_tags/*
1515

16-
16+
# Build the documentation
1717
echo "Building $LANGUAGE version..."
1818
WEBSITE_VERSION="$VERSION" WEBSITE_LANGUAGE="$LANGUAGE" sphinx-build -b html DISCOVER/ DISCOVER/_build/html

0 commit comments

Comments
 (0)