Style diff

This commit is contained in:
Ondřej Nývlt 2023-08-17 17:28:19 +02:00
parent a70a0b464d
commit f8055c75b4
3 changed files with 68 additions and 28 deletions

View file

@ -347,6 +347,24 @@ details[open] summary::before {
margin-bottom: 1rem; margin-bottom: 1rem;
} }
/* Typography utils */
.text-caption {
font-size: var(--font-size-s);
color: var(--color-muted);
font-weight: 500;
}
.table-head {
font-size: var(--font-size-s);
font-weight: 500;
color: var(--color-muted);
vertical-align: top;
position: relative;
top: 0.3em;
padding-right: 0.75rem;
}
/* Index */ /* Index */
.filters { .filters {
@ -368,16 +386,16 @@ details[open] summary::before {
max-width: 20rem; max-width: 20rem;
} }
.changesets { .home-diff-list {
margin-bottom: 2rem; margin-bottom: 2rem;
} }
.changeset { .changeset-card {
padding: 1rem 1.5rem; padding: 1rem 1.5rem;
margin-bottom: 1rem; margin-bottom: 1rem;
} }
.changeset-actions { .changeset-card-actions {
display: flex; display: flex;
column-gap: 1rem; column-gap: 1rem;
row-gap: 0.5rem; row-gap: 0.5rem;
@ -385,15 +403,15 @@ details[open] summary::before {
flex-wrap: wrap; flex-wrap: wrap;
} }
.changeset-feed-name, .changeset-card-feed-name,
.changeset-time, .changeset-card-time,
.changeset-action { .changeset-card-action {
font-weight: 500; font-weight: 500;
font-size: var(--font-size-s); font-size: var(--font-size-s);
flex-shrink: 0; flex-shrink: 0;
} }
.changeset-action { .changeset-card-action {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
gap: 0.5em; gap: 0.5em;
@ -403,16 +421,26 @@ details[open] summary::before {
transition: color 200ms; transition: color 200ms;
} }
.changeset-title { .changeset-card-title {
font-size: var(--font-size-l); font-size: var(--font-size-l);
} }
.changeset table th { .changeset-card-diff-s > :not(:last-child) {
font-size: var(--font-size-s); margin-bottom: 0.5rem;
font-weight: 500; }
color: var(--color-muted);
padding-right: 1rem; .changeset-card-diff-m {
vertical-align: top; display: none;
}
@media screen and (min-width: 800px) {
.changeset-card-diff-s {
display: none;
}
.changeset-card-diff-m {
display: block;
}
} }
/* Article detail */ /* Article detail */

View file

@ -14,11 +14,11 @@
<td> <td>
<table> <table>
<tr> <tr>
<th>Before</th> <th class="text-caption table-head">Before</th>
<td class="diff-before">{{ diff.diff_html|safe }}</td> <td class="diff-before">{{ diff.diff_html|safe }}</td>
</tr> </tr>
<tr> <tr>
<th>After</th> <th class="text-caption table-head">After</th>
<td class="diff-after">{{ diff.diff_html|safe }}</td> <td class="diff-after">{{ diff.diff_html|safe }}</td>
</tr> </tr>
</table> </table>

View file

@ -25,29 +25,41 @@
</div> </div>
</div> </div>
<div class="container changesets"> <div class="container home-diff-list">
{% for diff in diffs %} {% for diff in diffs %}
<article class="card changeset"> <article class="card changeset-card">
<p class="changeset-actions"> <p class="changeset-card-actions">
<span class="changeset-feed-name">{{ diff.feed_name }}</span> <span class="changeset-card-feed-name">{{ diff.feed_name }}</span>
<time class="changeset-time">{{ diff.diff_time }}</time> <time class="changeset-card-time">{{ diff.diff_time }}</time>
<a class="changeset-action" href="{{ diff.article_url }}"> <a class="changeset-card-action" href="{{ diff.article_url }}">
<svg class="inline-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10 6V8H5V19H16V14H18V20C18 20.5523 17.5523 21 17 21H4C3.44772 21 3 20.5523 3 20V7C3 6.44772 3.44772 6 4 6H10ZM21 3V11H19L18.9999 6.413L11.2071 14.2071L9.79289 12.7929L17.5849 5H13V3H21Z"></path></svg> <svg class="inline-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10 6V8H5V19H16V14H18V20C18 20.5523 17.5523 21 17 21H4C3.44772 21 3 20.5523 3 20V7C3 6.44772 3.44772 6 4 6H10ZM21 3V11H19L18.9999 6.413L11.2071 14.2071L9.79289 12.7929L17.5849 5H13V3H21Z"></path></svg>
Display current article Display current article
</a> </a>
<a class="changeset-action" href="/article/{{ diff.article_id }}"> <a class="changeset-card-action" href="/article/{{ diff.article_id }}">
<svg class="inline-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM13 12H17V14H11V7H13V12Z"></path></svg> <svg class="inline-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM13 12H17V14H11V7H13V12Z"></path></svg>
Show change history Show change history
</a> </a>
</p> </p>
<table>
<div class="changeset-card-diff-s">
<div>
<div class="text-caption">Before</div>
<div class="diff-before changeset-card-title">{{ diff.diff_html|safe }}</div>
</div>
<div>
<div class="text-caption">After</div>
<div class="diff-after changeset-card-title">{{ diff.diff_html|safe }}</div>
</div>
</div>
<table class="changeset-card-diff-m">
<tr> <tr>
<th>Before</th> <th class="text-caption table-head">Before</th>
<td class="diff-before changeset-title">{{ diff.diff_html|safe }}</td> <td class="diff-before changeset-card-title">{{ diff.diff_html|safe }}</td>
</tr> </tr>
<tr> <tr>
<th>After</th> <th class="text-caption table-head">After</th>
<td class="diff-after changeset-title">{{ diff.diff_html|safe }}</td> <td class="diff-after changeset-card-title">{{ diff.diff_html|safe }}</td>
</tr> </tr>
</table> </table>
</article> </article>