Make calendar work reasonably on mobile

This commit is contained in:
2022-12-11 00:44:14 +00:00
parent 6e8779c81b
commit 951227e68b

View File

@@ -23,12 +23,13 @@
<style> <style>
.week { .week {
display:grid; display:grid;
grid-template-columns: repeat(7, 1fr); grid-template-columns: repeat(7, minmax(0, 1fr));
grid-auto-flow: dense; grid-auto-flow: dense;
grid-gap: 2px 10px; grid-gap: 2px 10px;
border: 1px solid black; border: 1px solid black;
height: 8em; height: 8em;
align-content: start; align-content: start;
max-width: 100%;
} }
.day { .day {
@@ -50,6 +51,7 @@
background-color: #CCC; background-color: #CCC;
font-size: 0.8em !important; font-size: 0.8em !important;
white-space: nowrap; white-space: nowrap;
overflow: hidden;
} }
.event-end { .event-end {
@@ -62,6 +64,15 @@
border-bottom-left-radius: 5px; border-bottom-left-radius: 5px;
} }
.week-day {
font-size: 0.8em;
}
@media (max-width: 767.98px) {
.event {
padding: 2px;
}
}
[data-span="1"] { grid-column-end: span 1; } [data-span="1"] { grid-column-end: span 1; }
[data-span="2"] { grid-column-end: span 2; } [data-span="2"] { grid-column-end: span 2; }
@@ -106,14 +117,14 @@
{% for week in weeks %} {% for week in weeks %}
<div class="week"> <div class="week">
{% for day in week %} {% for day in week %}
{% if day.0 != 0 %} {% if day.0 != 0 %}
<div class="day" id="{{day.0}}"> <div class="day" id="{{day.0}}">
<h3 class="day-label text-muted">{{day.0}}</h3> <h3 class="day-label text-muted">{{day.0}}</h3>
{{ day.2|safe }} {{ day.2|safe }}
</div> </div>
{% else %} {% else %}
<div class="day"><span style="grid-row-start: 1;">&nbsp;<span></div> <div class="day"><span style="grid-row-start: 1;">&nbsp;<span></div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</div> </div>
{% endfor %} {% endfor %}