Mobile navigation improvements, other links
This commit is contained in:
parent
ac10bbc536
commit
a2c2ae00c7
2 changed files with 85 additions and 34 deletions
18
_data/links.json
Normal file
18
_data/links.json
Normal file
|
@ -0,0 +1,18 @@
|
|||
[
|
||||
{
|
||||
"title": "ava@wroten.me",
|
||||
"url": "mailto:ava@wroten.me"
|
||||
},
|
||||
{
|
||||
"title": "Resume",
|
||||
"url": "/files/resume.pdf"
|
||||
},
|
||||
{
|
||||
"title": "Life (Blog)",
|
||||
"url": "https://gaiety.life/"
|
||||
},
|
||||
{
|
||||
"title": "Life (Blog)",
|
||||
"url": "https://gaiety.gallery/"
|
||||
}
|
||||
]
|
|
@ -12,6 +12,22 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link href="/styles.css" rel="stylesheet">
|
||||
<link href="https://unpkg.com/prismjs@1.20.0/themes/prism-okaidia.css" rel="stylesheet">
|
||||
|
||||
<script>
|
||||
let isOpen = false;
|
||||
function mobileToggle() {
|
||||
isOpen = !isOpen;
|
||||
|
||||
document.getElementById('mobileToggleButton').setAttribute('aria-expanded', isOpen);
|
||||
document.getElementById('mobileToggleText').innerText = `${isOpen ? 'Close' : 'Open'} Navigation`;
|
||||
document.getElementById(`mobileToggleIcon${isOpen ? 'Opened' : 'Closed'}`).classList.add('block');
|
||||
document.getElementById(`mobileToggleIcon${isOpen ? 'Opened' : 'Closed'}`).classList.remove('hidden');
|
||||
document.getElementById(`mobileToggleIcon${!isOpen ? 'Opened' : 'Closed'}`).classList.add('hidden');
|
||||
document.getElementById(`mobileToggleIcon${!isOpen ? 'Opened' : 'Closed'}`).classList.remove('block');
|
||||
document.getElementById('mobileNavigation').classList.add(isOpen ? 'block' : 'hidden');
|
||||
document.getElementById('mobileNavigation').classList.remove(isOpen ? 'hidden' : 'block');
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body class="bg-gray-100">
|
||||
|
@ -19,40 +35,35 @@
|
|||
<nav class="bg-white shadow">
|
||||
<div class="max-w-7xl mx-auto px-2 sm:px-6 lg:px-8">
|
||||
<div class="relative flex justify-between h-16">
|
||||
<div class="absolute inset-y-0 left-0 flex items-center sm:hidden">
|
||||
<!-- Mobile menu button -->
|
||||
<button class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-indigo-500" aria-expanded="false">
|
||||
<span class="sr-only">Open main menu</span>
|
||||
<!-- Icon when menu is closed. -->
|
||||
<!--
|
||||
Heroicon name: menu
|
||||
|
||||
Menu open: "hidden", Menu closed: "block"
|
||||
-->
|
||||
<svg class="block h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true">
|
||||
<div class="absolute inset-y-0 left-0 flex justify-between w-full sm:hidden">
|
||||
<button
|
||||
class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-indigo-500"
|
||||
aria-expanded="false"
|
||||
onclick="mobileToggle()"
|
||||
id="mobileToggleButton">
|
||||
<span id="mobileToggleText" class="sr-only">Open navigation</span>
|
||||
<svg id="mobileToggleIconClosed" class="block h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
|
||||
</svg>
|
||||
<!-- Icon when menu is open. -->
|
||||
<!--
|
||||
Heroicon name: x
|
||||
|
||||
Menu open: "block", Menu closed: "hidden"
|
||||
-->
|
||||
<svg class="hidden h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true">
|
||||
<svg id="mobileToggleIconOpened" class="hidden h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</button>
|
||||
<a
|
||||
href="/"
|
||||
{% if page.url == navItem.url %}aria-current="page"{% endif %}
|
||||
>
|
||||
<img class="h-12 w-12 p-2 rounded-full" src="/img/site/avatar.png" alt="Home">
|
||||
</a>
|
||||
</div>
|
||||
<div class="flex-1 flex items-center justify-center sm:items-stretch sm:justify-start">
|
||||
<div class="flex-shrink-0 flex items-center">
|
||||
<div class="flex-1 flex justify-between sm:items-stretch sm:justify-start">
|
||||
<div class="hidden sm:ml-6 sm:flex sm:space-x-8">
|
||||
<a
|
||||
href="/"
|
||||
{% if page.url == navItem.url %}aria-current="page"{% endif %}
|
||||
>
|
||||
<img class="h-12 w-12 rounded-full w-auto" src="/img/site/avatar.png" alt="Home">
|
||||
<img class="h-12 w-12 rounded-full" src="/img/site/avatar.png" alt="Home">
|
||||
</a>
|
||||
</div>
|
||||
<div class="hidden sm:ml-6 sm:flex sm:space-x-8">
|
||||
{%- for navItem in navigation -%}
|
||||
<a
|
||||
href="{{navItem.url}}"
|
||||
|
@ -63,22 +74,44 @@
|
|||
</a>
|
||||
{%- endfor -%}
|
||||
</div>
|
||||
<div class="hidden sm:ml-6 sm:flex sm:space-x-8">
|
||||
{%- for navItem in links -%}
|
||||
<a
|
||||
href="{{navItem.url}}"
|
||||
class="border-transparent hover:border-pink-700 text-gray-500 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium focus:outline-link"
|
||||
{% if page.url == navItem.url %}aria-current="page"{% endif %}
|
||||
>
|
||||
{{navItem.title}}
|
||||
</a>
|
||||
{%- endfor -%}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
Mobile menu, toggle classes based on menu state.
|
||||
|
||||
Menu open: "block", Menu closed: "hidden"
|
||||
-->
|
||||
<div class="hidden sm:hidden">
|
||||
<div id="mobileNavigation" class="hidden sm:hidden">
|
||||
<div class="pt-2 pb-4 space-y-1">
|
||||
<!-- Current: "bg-indigo-50 border-indigo-500 text-indigo-700", Default: "border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700" -->
|
||||
<a href="#" class="bg-indigo-50 border-indigo-500 text-indigo-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Dashboard</a>
|
||||
<a href="#" class="border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Team</a>
|
||||
<a href="#" class="border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Projects</a>
|
||||
<a href="#" class="border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Calendar</a>
|
||||
{%- for navItem in navigation -%}
|
||||
<a
|
||||
href="{{navItem.url}}"
|
||||
class="{% if page.url == navItem.url %}border-pink-700 bg-pink-50 text-pink-700{% else %}border-transparent hover:border-pink-700 text-gray-500{% endif %} block pl-3 pr-4 py-2 border-l-4 text-base font-medium focus:outline-link"
|
||||
{% if page.url == navItem.url %}aria-current="page"{% endif %}
|
||||
>
|
||||
{{navItem.title}}
|
||||
</a>
|
||||
{%- endfor -%}
|
||||
</div>
|
||||
|
||||
<div class="pt-2 pb-4 space-y-1">
|
||||
{%- for navItem in links -%}
|
||||
<a
|
||||
href="{{navItem.url}}"
|
||||
class="border-transparent hover:border-pink-700 text-gray-500 block pl-3 pr-4 py-2 border-l-4 text-base font-medium focus:outline-link"
|
||||
{% if page.url == navItem.url %}aria-current="page"{% endif %}
|
||||
>
|
||||
{{navItem.title}}
|
||||
</a>
|
||||
{%- endfor -%}
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
Loading…
Add table
Reference in a new issue