Skip to content

Commit 0f9b2a1

Browse files
committed
refactor クラスを書く順序を整理
1 parent 64d57d1 commit 0f9b2a1

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

_includes/header.html

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
1-
<h1 class="hidden xl:block max-w-lg mx-auto pt-5 px-8">
1+
<h1 class="xl:block hidden mx-auto max-w-lg pt-5 px-8">
22
<a href="/">
33
<img src="/img/common/header-logo.webp" alt="DojoCon Japan 2025 Inspire Next." />
44
</a>
55
</h1>
66

7-
<div class="xl:hidden fixed top-9 left-0 min-h-18 w-screen flex justify-center z-10">
8-
<div class="flex h-full flex-col w-[calc(100%-max(10%,32px))] items-stretch rounded-[10px] bg-[#f5f5f5] px-4 py-2 inset-shadow-[0px_-2px_10px_rgba(125,125,125,0.25)] shadow-[7px_7px_10px_rgba(125,125,125,0.15)]">
9-
<div class="flex justify-between items-center gap-2">
10-
<a href="/" class="flex items-center h-full">
11-
<img src="/img/common/header-logo.webp" class="max-h-full max-w-[250px] w-full" alt="DojoCon Japan 2025 Inspire Next." />
7+
<div class="fixed xl:hidden left-0 top-9 z-10 flex w-screen min-h-18 justify-center">
8+
<div
9+
class="flex flex-col h-full w-[calc(100%-max(10%,32px))] items-stretch rounded-[10px] bg-[#f5f5f5] px-4 py-2 shadow-[7px_7px_10px_rgba(125,125,125,0.15)] inset-shadow-[0px_-2px_10px_rgba(125,125,125,0.25)]">
10+
<div class="flex items-center justify-between gap-2">
11+
<a href="/" class="flex h-full items-center">
12+
<img src="/img/common/header-logo.webp" class="w-full max-w-[250px] max-h-full"
13+
alt="DojoCon Japan 2025 Inspire Next." />
1214
</a>
13-
<button id="menu-btn" type="button" aria-label="メニューを開く" class="w-12 h-9 flex flex-col justify-center items-center shrink-0 rounded cursor-pointer border border-gray-300 bg-white">
14-
<span class="block w-8 h-0.5 bg-gray-400 mb-1.5 rounded"></span>
15-
<span class="block w-8 h-0.5 bg-gray-400 mb-1.5 rounded"></span>
16-
<span class="block w-8 h-0.5 bg-gray-400 rounded"></span>
15+
<button id="menu-btn" type="button" aria-label="メニューを開く"
16+
class="flex h-9 w-12 shrink-0 flex-col items-center justify-center rounded border border-gray-300 bg-white cursor-pointer">
17+
<span class="block w-8 h-0.5 mb-1.5 rounded bg-gray-400"></span>
18+
<span class="block w-8 h-0.5 mb-1.5 rounded bg-gray-400"></span>
19+
<span class="block w-8 h-0.5 rounded bg-gray-400"></span>
1720
</button>
1821
</div>
19-
<nav id="menu-nav" class="hidden flex-col items-stretch transition-all duration-300 my-2">
20-
<ul class="flex flex-col min-h-20 items-stretch gap-2 *:leading-[1.75] *:text-[#cc8f2e] *:text-center *:text-[20px] *:px-6">
22+
<nav id="menu-nav" class="hidden my-2 flex-col items-stretch transition-all duration-300">
23+
<ul
24+
class="flex flex-col min-h-20 items-stretch gap-2 *:px-6 *:text-center *:text-[20px] *:leading-[1.75] *:text-[#cc8f2e]">
2125
<li><a href="#outline">開催概要</a></li>
2226
<li><a href="#session">セッション</a></li>
2327
<li><a href="/events">企画</a></li>
@@ -31,20 +35,20 @@ <h1 class="hidden xl:block max-w-lg mx-auto pt-5 px-8">
3135
</div>
3236

3337
<script>
34-
document.addEventListener('DOMContentLoaded', function() {
35-
const menuBtn = document.getElementById('menu-btn');
36-
const menuNav = document.getElementById('menu-nav');
37-
if (!menuBtn || !menuNav) return;
38+
document.addEventListener('DOMContentLoaded', function () {
39+
const menuBtn = document.getElementById('menu-btn');
40+
const menuNav = document.getElementById('menu-nav');
41+
if (!menuBtn || !menuNav) return;
3842

39-
menuBtn.addEventListener('click', function() {
40-
menuNav.classList.toggle('flex');
41-
menuNav.classList.toggle('hidden');
42-
});
43-
menuNav.querySelectorAll('a').forEach(function(link) {
44-
link.addEventListener('click', function() {
45-
menuNav.classList.remove('flex');
46-
menuNav.classList.add('hidden');
43+
menuBtn.addEventListener('click', function () {
44+
menuNav.classList.toggle('flex');
45+
menuNav.classList.toggle('hidden');
46+
});
47+
menuNav.querySelectorAll('a').forEach(function (link) {
48+
link.addEventListener('click', function () {
49+
menuNav.classList.remove('flex');
50+
menuNav.classList.add('hidden');
51+
});
4752
});
4853
});
49-
});
5054
</script>

0 commit comments

Comments
 (0)