Skip to content

Commit 5f624da

Browse files
Merge pull request #83 from coderdojo-japan/fix-time-table-mobile-display
fix: タイムテーブルのモバイル表示を改善
2 parents 80e7720 + 3bf2ce7 commit 5f624da

File tree

2 files changed

+9
-47
lines changed

2 files changed

+9
-47
lines changed

_pages/time-table.html

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,18 @@
1717
{% assign total_slots = tte.total_slots %}
1818
{% assign total_rooms = tte.total_rooms %}
1919

20-
<section class="max-w-[1200px] mx-auto px-4 sm:px-8 mt-30 xl:mt-15">
20+
<section class="w-[calc(100dvw-40px)] max-w-7xl mx-auto mt-25 xl:mt-5">
2121
<h2 class="text-4xl text-center mb-8">
2222
Time table
2323
<span class="block mt-3 text-2xl">タイムテーブル</span>
2424
</h2>
25-
26-
<div class="ttable-wrap" aria-label="タイムテーブル(横スクロール可)">
25+
<div class="overflow-x-auto border-[1px] border-[#e6e6e9]" aria-label="タイムテーブル(横スクロール可)">
2726
<table class="ttable" style="--room-count: {{ rooms | size }};">
2827
<caption>
2928
{{ site.date_event }} のタイムテーブル
3029
</caption>
31-
3230
<thead>
33-
<tr>
31+
<tr class="sticky z-5">
3432
<th scope="col" class="ttable__th ttable__th--start">時間</th>
3533
{% comment %} ルーム単位でヘッダーを描画 {% endcomment %}
3634
{% for room in rooms %}

_sass/pages/time-table.scss

Lines changed: 6 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
@use '../global/variables' as *;
2-
3-
@media (max-width: 640px) {
4-
:root, body { max-width: 100%; overflow-x: clip; }
5-
}
6-
@supports not (overflow-x: clip) {
7-
@media (max-width: 640px) { :root, body { overflow-x: hidden; } }
8-
}
9-
101
/* ====== スクロール容器 ====== */
112
.ttable-wrap{
123
position: relative;
@@ -25,17 +16,12 @@
2516
table-layout: auto と最小幅制約を組み合わせる
2617
*/
2718
.ttable{
28-
--w-start: 8ch;
29-
--room-min: 20rem;
19+
table-layout: fixed;
20+
--w-start: 5rem;
21+
--room-min: clamp(235px, calc((100dvw - var(--w-start) - 10rem)), 20rem);
3022
--row-h: 56px;
3123

3224
width: calc(var(--w-start) + var(--room-min) * var(--room-count));
33-
min-width: 100%;
34-
border-collapse: separate;
35-
border-spacing: 0;
36-
table-layout: auto;
37-
background: #fff;
38-
border: 1px solid #e6e6e9;
3925
}
4026

4127
/* ヘッダー */
@@ -59,9 +45,9 @@
5945
/* 会場ヘッダーと本文セルの最小幅をそろえる(PCで潰れない) */
6046
.ttable__th--room{ border-left: 1px solid #ececf1; color:#111; background:
6147
linear-gradient(0deg, rgba(255,255,255,0.88), rgba(255,255,255,0.88)), var(--room-color, #c43b3b);
62-
min-width: var(--room-min);
48+
width: var(--room-min);
6349
}
64-
.ttable tbody td{ min-width: var(--room-min); }
50+
.ttable tbody td{ width: var(--room-min); }
6551

6652
/* 行ストライプ & グリッド線 */
6753
.ttable tbody tr{ height: var(--row-h); }
@@ -111,35 +97,13 @@
11197
box-shadow: 0 2px 8px rgba(0,0,0,0.06);
11298
padding: 10px 12px 12px;
11399
background: #fff;
114-
overflow: hidden;
115100
height: 100%;
116101
display: flex;
117102
flex-direction: column;
103+
overflow: clip;
118104
}
119105
.ttable__event::before{ content:""; position:absolute; inset:0 0 auto 0; height: 6px; background: var(--accent, #c43b3b); }
120106
.ttable__event-time{ font-weight: 800; font-size: 1.05rem; letter-spacing: .3px; margin: 8px 0 4px; color: #c43b3b; }
121107
.ttable__event-title{ font-weight: 800; line-height: 1.35; margin-bottom: 4px; color: #121212; }
122108
.ttable__event-subtitle{ color: #ee7d05; font-weight: 700; font-size: .92rem; line-height: 1.3; }
123109
.ttable__badge{ position: absolute; top: 8px; right: 10px; padding: 2px 8px; border-radius: 999px; font-size: .85rem; font-weight: 800; color: #fff; background: var(--accent,#c43b3b); box-shadow: 0 1px 4px rgba(0,0,0,.1); }
124-
125-
/* スマホ微調整 */
126-
@media (max-width: 640px){
127-
.ttable{ --row-h: 54px; --room-min: 16rem; --w-start: 7ch; }
128-
.ttable thead th, .ttable__cell{ padding: 8px; font-size: .95rem; }
129-
.ttable thead th{ white-space: normal; }
130-
.ttable__room-cap{ overflow-wrap: anywhere; word-break: keep-all; }
131-
.ttable tbody tr:nth-child(6n){
132-
box-shadow: inset 0 -1.5px 0 rgba(0,0,0,0.18);
133-
}
134-
.ttable-wrap::before, .ttable-wrap::after{
135-
content: ""; position: absolute; top: 0; bottom: 0; width: 18px;
136-
pointer-events: none; z-index: 6;
137-
}
138-
.ttable-wrap::before{ left: 0; background: linear-gradient(to right, #fff, rgba(255,255,255,0)); }
139-
.ttable-wrap::after{ right: 0; background: linear-gradient(to left, #fff, rgba(255,255,255,0)); }
140-
.ttable tbody tr{ background-image: linear-gradient(to right, rgba(0,0,0,0.08) 50%, rgba(0,0,0,0) 0); }
141-
.ttable__event-time{ font-size: 1rem; margin-top: 6px; }
142-
.ttable__event-title{ font-size: .98rem; }
143-
.ttable__event-subtitle{ font-size: .86rem; }
144-
}
145-

0 commit comments

Comments
 (0)