Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: add footer variants and refine language switcher UI
  • Loading branch information
yakhyo committed Feb 27, 2026
commit 6f62e3887fc51c8d55a5bb370652a88e8c30b915
83 changes: 83 additions & 0 deletions _includes/footer.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{% set footerVariant = footerVariant or 'compact' %}
{% set currentUrl = page.url or '/' %}
{% set isUzPage = (lang or '') == 'uz' or currentUrl == '/uz/' or currentUrl.startsWith('/uz/') %}
{% set homeUrl = '/uz/' if isUzPage else '/' %}
{% set tutorialUrl = '/uz/tutorial/what-is-python/' if isUzPage else '/tutorial/what-is-python/' %}
{% set githubUrl = 'https://github.com/codeuzhub/python-lessons' %}
{% set contributeUrl = githubUrl + '/blob/main/.github/CONTRIBUTING.md' %}
{% set issueUrl = githubUrl + '/issues' %}
{% set siteLabel = "Python Lessons" %}
{% set taglineText = "Python tutorials in English and Uzbek." if not isUzPage else "Python darslari ingliz va o'zbek tillarida." %}
{% set quickLinksLabel = "Quick Links" if not isUzPage else "Tezkor havolalar" %}
{% set projectLabel = "Project" if not isUzPage else "Loyiha" %}
{% set homeLabel = "Home" if not isUzPage else "Bosh sahifa" %}
{% set tutorialLabel = "Tutorials" if not isUzPage else "Darslar" %}
{% set toolsLabel = "Online IDE" if not isUzPage else "Onlayn IDE" %}
{% set joinGithubLabel = "Join on GitHub" if not isUzPage else "GitHub'da qo'shiling" %}
{% set contributeLabel = "Contributing Guide" if not isUzPage else "Hissa qo'shish qo'llanmasi" %}
{% set issueLabel = "Report an Issue" if not isUzPage else "Muammo haqida yozing" %}
{% set compactTutorialLabel = "Tutorial Index" if not isUzPage else "Darslar ro'yxati" %}
{% set licenseLabel = "MIT Licensed" if not isUzPage else "MIT litsenziyasi asosida" %}

{% if footerVariant == 'full' %}
<footer class="mt-12 border-t border-slate-200 bg-slate-900 text-slate-200">
<div class="mx-auto max-w-6xl px-4 py-10 md:px-10 md:py-12">
<div class="grid gap-8 md:grid-cols-3">
<div>
<a href="{{ homeUrl | url }}" class="text-xl font-semibold tracking-wide text-white no-underline hover:text-secondary-400">
{{ siteLabel }}
</a>
<p class="mt-3 max-w-md text-sm leading-6 text-slate-300">
{{ taglineText }}
</p>
</div>
<div>
<h2 class="text-xs font-semibold uppercase tracking-wide text-slate-400">{{ quickLinksLabel }}</h2>
<ul class="mt-3 space-y-2 text-sm">
<li>
<a href="{{ homeUrl | url }}" class="text-slate-200 no-underline hover:text-secondary-400">{{ homeLabel }}</a>
</li>
<li>
<a href="{{ tutorialUrl | url }}" class="text-slate-200 no-underline hover:text-secondary-400">{{ tutorialLabel }}</a>
</li>
<li>
<a href="{{ '/online-python-ide/' | url }}" class="text-slate-200 no-underline hover:text-secondary-400">{{ toolsLabel }}</a>
</li>
</ul>
</div>
<div>
<h2 class="text-xs font-semibold uppercase tracking-wide text-slate-400">{{ projectLabel }}</h2>
<ul class="mt-3 space-y-2 text-sm">
<li>
<a href="{{ githubUrl }}" class="text-slate-200 no-underline hover:text-secondary-400">{{ joinGithubLabel }}</a>
</li>
<li>
<a href="{{ contributeUrl }}" class="text-slate-200 no-underline hover:text-secondary-400">{{ contributeLabel }}</a>
</li>
<li>
<a href="{{ issueUrl }}" class="text-slate-200 no-underline hover:text-secondary-400">{{ issueLabel }}</a>
</li>
</ul>
</div>
</div>
<div class="mt-8 flex flex-col gap-2 border-t border-slate-800 pt-4 text-xs text-slate-400 md:flex-row md:items-center md:justify-between">
<p>© 2026 {{ siteLabel }}</p>
<a href="{{ '/LICENSE' | url }}" class="text-slate-300 no-underline hover:text-secondary-400">{{ licenseLabel }}</a>
</div>
</div>
</footer>
{% else %}
<footer class="mt-10 border-t border-slate-200 bg-white">
<div class="mx-auto max-w-4xl px-4 py-6 text-sm md:px-6">
<div class="flex flex-wrap items-center gap-x-5 gap-y-2">
<a href="{{ tutorialUrl | url }}" class="text-slate-700 no-underline hover:text-primary-500">{{ compactTutorialLabel }}</a>
<a href="{{ githubUrl }}" class="text-slate-700 no-underline hover:text-primary-500">GitHub</a>
<a href="{{ issueUrl }}" class="text-slate-700 no-underline hover:text-primary-500">{{ issueLabel }}</a>
</div>
<div class="mt-4 flex flex-col gap-2 border-t border-slate-200 pt-3 text-xs text-slate-500 md:flex-row md:items-center md:justify-between">
<p>© 2026 {{ siteLabel }}</p>
<a href="{{ '/LICENSE' | url }}" class="text-slate-500 no-underline hover:text-primary-500">{{ licenseLabel }}</a>
</div>
</div>
</footer>
{% endif %}
73 changes: 45 additions & 28 deletions _includes/navbar.njk
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
{% set tutorialUrl = '/uz/tutorial/what-is-python/' if isUzPage else '/tutorial/what-is-python/' %}
{% set tutorialLabel = "Darslar" if isUzPage else "Tutorial" %}
{% set githubLabel = "GitHub'da qo'shiling" if isUzPage else "Join on Github" %}
{% set languageSwitchUrl = uzUrl if not isUzPage else enUrl %}
{% set languageSwitchAriaLabel = "Switch to Uzbek" if not isUzPage else "Switch to English" %}
{% set languageSwitchCode = "UZ" if not isUzPage else "EN" %}

<nav class="h-16 bg-primary-500 text-white {{ 'fixed top-0 left-0 right-0 z-[60] shadow-md' if not isHomepage }}">
<div class="relative flex items-center justify-center md:justify-between pt-3 max-w-7xl px-4 md:px-10 mx-auto">
Expand All @@ -25,40 +28,54 @@
<img class="h-10 pt-1" src="{{ '/img/logo-belajarpython-140.png' | url }}" alt="logo-belajarpython"/>
</a>
<div class="absolute right-4 top-[13px] md:hidden">
<div class="flex items-center rounded-full border border-white/30 bg-white/10 p-1 text-[11px] font-semibold backdrop-blur-sm">
<a
href="{{ enUrl | url }}"
class="rounded-full px-2.5 py-1 transition {{ 'bg-white text-primary-700 shadow-sm' if not isUzPage else 'text-white/80 hover:text-white' }}">
EN
</a>
<a
href="{{ uzUrl | url }}"
class="rounded-full px-2.5 py-1 transition {{ 'bg-white text-primary-700 shadow-sm' if isUzPage else 'text-white/80 hover:text-white' }}">
UZ
</a>
</div>
<a
href="{{ languageSwitchUrl | url }}"
aria-label="{{ languageSwitchAriaLabel }}"
class="inline-flex items-center gap-1.5 rounded-full bg-white px-2 py-1 text-[11px] font-bold leading-none text-slate-900 shadow-sm transition hover:bg-slate-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/70 focus-visible:ring-offset-2 focus-visible:ring-offset-primary-500">
<span
aria-hidden="true"
class="relative h-5 w-5 overflow-hidden rounded-full border border-slate-300 shadow-sm">
{% if not isUzPage %}
<span
class="absolute inset-0"
style="background: linear-gradient(to bottom, #1eb6f0 0 31%, #ce1126 31% 35%, #ffffff 35% 65%, #ce1126 65% 69%, #1eb53a 69% 100%);"></span>
{% else %}
<span
class="absolute inset-0"
style="background: repeating-linear-gradient(to bottom, #b22234 0 14.3%, #ffffff 14.3% 28.6%);"></span>
<span class="absolute left-0 top-0 h-[55%] w-[45%] bg-[#3c3b6e]"></span>
{% endif %}
</span>
<span>{{ languageSwitchCode }}</span>
</a>
</div>
<div class="hidden md:flex items-center justify-end">
<div class="mr-5 flex items-center gap-5">
<div class="mr-5 flex items-center gap-4">
<a
class="w-[92px] text-center text-white text-opacity-70 hover:text-opacity-100 whitespace-nowrap"
class="text-center text-white/80 hover:text-white whitespace-nowrap"
href="{{ tutorialUrl | url }}">
{{ tutorialLabel }}
</a>
<div class="flex items-center">
<div class="flex items-center rounded-full border border-white/30 bg-white/10 p-1 text-xs font-semibold backdrop-blur-sm">
<a
href="{{ enUrl | url }}"
class="rounded-full px-3 py-1 transition {{ 'bg-white text-primary-700 shadow-sm' if not isUzPage else 'text-white/80 hover:text-white' }}">
EN
</a>
<a
href="{{ uzUrl | url }}"
class="rounded-full px-3 py-1 transition {{ 'bg-white text-primary-700 shadow-sm' if isUzPage else 'text-white/80 hover:text-white' }}">
UZ
</a>
</div>
</div>
<a
href="{{ languageSwitchUrl | url }}"
aria-label="{{ languageSwitchAriaLabel }}"
class="inline-flex items-center gap-1.5 rounded-full bg-white px-2.5 py-1 text-xs font-bold leading-none text-slate-900 shadow-sm transition hover:bg-slate-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/70 focus-visible:ring-offset-2 focus-visible:ring-offset-primary-500">
<span
aria-hidden="true"
class="relative h-5 w-5 overflow-hidden rounded-full border border-slate-300 shadow-sm">
{% if not isUzPage %}
<span
class="absolute inset-0"
style="background: linear-gradient(to bottom, #1eb6f0 0 31%, #ce1126 31% 35%, #ffffff 35% 65%, #ce1126 65% 69%, #1eb53a 69% 100%);"></span>
{% else %}
<span
class="absolute inset-0"
style="background: repeating-linear-gradient(to bottom, #b22234 0 14.3%, #ffffff 14.3% 28.6%);"></span>
<span class="absolute left-0 top-0 h-[55%] w-[45%] bg-[#3c3b6e]"></span>
{% endif %}
</span>
<span>{{ languageSwitchCode }}</span>
</a>
</div>
<a
class="inline-flex h-9 w-[210px] items-center justify-center rounded-full bg-gradient-to-l from-secondary-500 to-secondary-400 text-sm text-black whitespace-nowrap"
Expand Down
2 changes: 2 additions & 0 deletions _layouts/base.njk
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
</main>
</div>
{% endif %}
{% set footerVariant = 'full' if isHomepage else 'compact' %}
{% include "footer.njk" %}
{% include "analytics.njk" %}
</body>
</html>
2 changes: 2 additions & 0 deletions _layouts/tool-simple.njk
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
{{ content | safe }}
</main>
</div>
{% set footerVariant = 'compact' %}
{% include "footer.njk" %}
{% include "analytics.njk" %}
</body>
</html>
2 changes: 2 additions & 0 deletions _layouts/tool-split.njk
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<main class="flex-1 flex flex-col h-full min-h-0 relative">
{{ content | safe }}
</main>
{% set footerVariant = 'compact' %}
{% include "footer.njk" %}
{% include "analytics.njk" %}
</body>
</html>
2 changes: 2 additions & 0 deletions _layouts/tutorial.njk
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@
</div>
</main>
</div>
{% set footerVariant = 'compact' %}
{% include "footer.njk" %}
{% include "analytics.njk" %}
<script>
(function () {
Expand Down
Loading