layout tweaks to card info

- negative margins result in truncated text when the window size
is reduced, so avoid them
- having a 100% table inside a flexbox is not responsive - the table
does not adjust its size as the width is increased or decreased
- in order to look decent on narrow screens (eg phones), we allow
margin collapsing
- in order to look decent on wide screens, we limit the maximum
width to something that is readable
- hide some columns in portrait mode on narrow screens

I tried preserving the centering with margin-left/right: auto, but
could not get it looking right, so have had to move things back to
left alignment.
This commit is contained in:
Damien Elmes 2021-10-14 18:49:40 +10:00
parent 53ce7d2759
commit abad6c3844
2 changed files with 17 additions and 10 deletions

View file

@ -98,13 +98,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
<style> <style>
.container { .container {
display: flex; max-width: 40em;
justify-content: center;
white-space: nowrap;
} }
.stats-table { .stats-table {
width: 100%; width: 100%;
border-spacing: 1em 0;
border-collapse: collapse;
text-align: start; text-align: start;
} }
</style> </style>

View file

@ -81,22 +81,22 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
<div class="revlog-container"> <div class="revlog-container">
<table class="revlog-table"> <table class="revlog-table">
<tr> <tr>
<th>{tr2.cardStatsReviewLogDate()}</th> <th class="left">{tr2.cardStatsReviewLogDate()}</th>
<th>{tr2.cardStatsReviewLogType()}</th> <th class="hidden-xs">{tr2.cardStatsReviewLogType()}</th>
<th>{tr2.cardStatsReviewLogRating()}</th> <th>{tr2.cardStatsReviewLogRating()}</th>
<th>{tr2.cardStatsInterval()}</th> <th>{tr2.cardStatsInterval()}</th>
<th>{tr2.cardStatsEase()}</th> <th class="hidden-xs">{tr2.cardStatsEase()}</th>
<th>{tr2.cardStatsReviewLogTimeTaken()}</th> <th>{tr2.cardStatsReviewLogTimeTaken()}</th>
</tr> </tr>
{#each revlogRows as row, _index} {#each revlogRows as row, _index}
<tr> <tr>
<td class="left"><b>{row.date}</b> @ {row.time}</td> <td class="left"><b>{row.date}</b> @ {row.time}</td>
<td class="center {row.reviewKindClass}"> <td class="center hidden-xs {row.reviewKindClass}">
{row.reviewKind} {row.reviewKind}
</td> </td>
<td class="center {row.ratingClass}">{row.rating}</td> <td class="center {row.ratingClass}">{row.rating}</td>
<td class="center">{row.interval}</td> <td class="center">{row.interval}</td>
<td class="center">{row.ease}</td> <td class="center hidden-xs">{row.ease}</td>
<td class="right">{row.takenSecs}</td> <td class="right">{row.takenSecs}</td>
</tr> </tr>
{/each} {/each}
@ -118,12 +118,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
} }
.revlog-container { .revlog-container {
margin: 4em -2em 0 -2em; margin-top: 2em;
} }
.revlog-table { .revlog-table {
width: 100%; width: 100%;
border-spacing: 2em 0em; border-spacing: 1em 0;
border-collapse: collapse;
} }
.revlog-learn { .revlog-learn {
@ -138,4 +139,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
.revlog-ease1 { .revlog-ease1 {
color: var(--learn-count); color: var(--learn-count);
} }
@media only screen and (max-device-width: 480px) and (orientation: portrait) {
.hidden-xs {
display: none;
}
}
</style> </style>