generated from litestar-org/project-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update styles, add tailwind support, move basic functionalities into …
…theme (#3) * add menu structuring * add missing assets * remove dependencies on tailwind preflight * remove dependencies on tailwind preflight * add starlite colors as css variables and tailwind color * add makefile * rebranding
- Loading branch information
1 parent
72e2dca
commit 2cd4f2e
Showing
23 changed files
with
1,944 additions
and
526 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ __pycache__/ | |
.env | ||
.vscode | ||
.python-version | ||
/node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
install: | ||
poetry install | ||
npm install | ||
|
||
build-assets: | ||
npx tailwindcss -i litestar_sphinx_theme/style.css -o litestar_sphinx_theme/theme/static/litestar-sphinx-theme.css -m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
{% macro icon(icon_name) %} | ||
{% include "icons/" + icon_name + ".svg" %} | ||
{% endmacro %} | ||
|
||
|
||
{% macro nav_link(target) -%} | ||
{{ target if target.startswith('http') else pathto(target) }} | ||
{%- endmacro %} | ||
|
||
{% macro dropown_menu_item_link(link, title) %} | ||
<a href="{{ nav_link(link) }}" | ||
class="block font-semibold text-gray-900 dark:text-gray-200 hover:text-litestar-gold dark:hover:text-litestar-gold !no-underline select-none cursor-pointer"> | ||
{{ title }} | ||
<span class="absolute inset-0"></span> | ||
</a> | ||
{% endmacro %} | ||
|
||
{% macro dropdown_menu_item(title, item) %} | ||
{% if item is string %} | ||
<div class="group relative rounded-lg p-2 text-sm hover:bg-gray-50 dark:hover:bg-zinc-800"> | ||
{{ dropown_menu_item_link(item, title) }} | ||
</div> | ||
{% else %} | ||
<div class="group relative flex items-center gap-x-6 rounded-lg p-4 text-sm leading-6 hover:bg-gray-50 dark:hover:bg-zinc-800"> | ||
<div class=" | ||
h-11 w-11 flex flex-none items-center justify-center | ||
rounded-lg | ||
bg-gray-50 group-hover:bg-white dark:bg-zinc-900 dark:group-hover:bg-zinc-700 | ||
text-gray-600 dark:text-gray-300 group-hover:text-litestar-gold"> | ||
{{ icon(item.icon) }} | ||
</div> | ||
<div class="flex-auto"> | ||
{{ dropown_menu_item_link(item.link, title) }} | ||
<div class="mt-1 text-gray-600 dark:text-gray-300">{{ item.description }}</div> | ||
</div> | ||
</div> | ||
{% endif %} | ||
{% endmacro %} | ||
|
||
{% macro dropdown_menu(title, menu_item) %} | ||
<div class="relative"> | ||
<span type="button" | ||
class="flex items-center gap-x-1 text-sm font-semibold leading-6 text-gray-900 dark:text-gray-100 hover:!text-litestar-gold st-dropdown-toggle dropdown-closed select-none cursor-pointer" | ||
data-dropdown-state="closed" | ||
aria-expanded="false"> | ||
{{ title }} | ||
<div class="menu-state-indicator"> | ||
{{ icon("chevron-down") }} | ||
</div> | ||
</span> | ||
|
||
<div class=" | ||
absolute -left-8 top-full z-10 mt-3 | ||
w-max max-w-md | ||
overflow-hidden rounded-3xl | ||
bg-white shadow-lg dark:!bg-zinc-700 ring-1 ring-gray-900/5 | ||
hidden | ||
st-dropdown-menu"> | ||
<div class="p-4"> | ||
{% for sub_title, sub_item in menu_item | items %} | ||
{{ dropdown_menu_item(title=sub_title, item=sub_item) }} | ||
{% endfor %} | ||
</div> | ||
</div> | ||
</div> | ||
{% endmacro %} | ||
|
||
{% macro menu(menu_items) %} | ||
{% for title, item in menu_items | items %} | ||
{% if item is string %} | ||
<a href="{{ nav_link(item) }}" | ||
class="text-sm font-semibold leading-6 text-gray-900 dark:text-gray-100 hover:!text-litestar-gold select-none cursor-pointer">{{ title }}</a> | ||
{% else %} | ||
{{ dropdown_menu(title=title, menu_item=item) }} | ||
{% endif %} | ||
{% endfor %} | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{% from "macros.html" import menu with context %} | ||
|
||
|
||
{% if use_page_nav %} | ||
{% include "navbar-nav.html" %} | ||
{% endif %} | ||
{% if extra_navbar_items %} | ||
<nav class="hidden lg:flex lg:gap-x-4"> | ||
{{ menu(extra_navbar_items) }} | ||
</nav> | ||
{% endif %} |
File renamed without changes
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
function initDropdowns() { | ||
const dropdownToggles = document.querySelectorAll(".st-dropdown-toggle") | ||
|
||
const dropdowns = [...dropdownToggles].map(toggleEl => ({ | ||
toggleEl, | ||
contentEL: toggleEl.parentElement.querySelector(".st-dropdown-menu") | ||
})) | ||
|
||
const close = (dropdown) => { | ||
const {toggleEl, contentEL} = dropdown | ||
toggleEl.setAttribute("aria-expanded", "false") | ||
contentEL.classList.toggle("hidden", true) | ||
} | ||
|
||
const closeAll = () => dropdowns.forEach(close) | ||
|
||
const open = (dropdown) => { | ||
closeAll() | ||
dropdown.toggleEl.setAttribute("aria-expanded", "true") | ||
dropdown.contentEL.classList.toggle("hidden", false) | ||
const boundaries = [dropdown.contentEL, ...dropdownToggles] | ||
const clickOutsideListener = (event) => { | ||
const target = event.target | ||
if (!target) return | ||
|
||
if (!boundaries.some(b => b.contains(target))) { | ||
closeAll() | ||
document.removeEventListener("click", clickOutsideListener) | ||
} | ||
|
||
} | ||
document.addEventListener("click", clickOutsideListener) | ||
} | ||
|
||
|
||
dropdowns.forEach(dropdown => { | ||
dropdown.toggleEl.addEventListener("click", () => { | ||
if (dropdown.toggleEl.getAttribute("aria-expanded") === "true") { | ||
close(dropdown) | ||
} else { | ||
open(dropdown) | ||
} | ||
}) | ||
}) | ||
} | ||
|
||
window.addEventListener("DOMContentLoaded", () => { | ||
initDropdowns() | ||
}) |
File renamed without changes
File renamed without changes.
Oops, something went wrong.