Skip to content

Commit

Permalink
style: file lists
Browse files Browse the repository at this point in the history
  • Loading branch information
paulrobertlloyd committed Aug 26, 2020
1 parent dbed056 commit c455c7d
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 11 deletions.
16 changes: 12 additions & 4 deletions packages/endpoint-media/views/files.njk
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
{%- from "file/macro.njk" import file -%}
{% extends "document.njk" %}

{% block content %}
{%- if files %}
<ul>
{%- for file in files %}
<li><a href="{{ parentUrl }}{{ file._id }}">{{ icon(file.properties["post-type"]) }} {{ file.properties.filename }}</a></li>
<ol class="no-bullets">
{%- for item in files %}
<li>
{{ file({
title: item.properties.filename,
href: parentUrl + item._id,
icon: item.properties["post-type"],
meta: item.properties.url
}) }}
</li>
{%- endfor %}
</ul>
</ol>
{%- endif %}
{% endblock %}
16 changes: 12 additions & 4 deletions packages/endpoint-micropub/views/posts.njk
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
{%- from "file/macro.njk" import file -%}
{% extends "document.njk" %}

{% block content %}
{%- if posts %}
<ul>
{%- for post in posts %}
<li><a href="{{ parentUrl }}{{ post._id }}">{{ icon(post.properties["post-type"]) }} {{ post.properties.name }}</a></li>
<ol class="no-bullets">
{%- for item in posts %}
<li>
{{ file({
title: item.properties.name or item.properties['post-type'] | capitalize,
href: parentUrl + item._id,
icon: item.properties["post-type"],
meta: item.properties.url
}) }}
</li>
{%- endfor %}
</ul>
</ol>
{%- endif %}
{% endblock %}
3 changes: 3 additions & 0 deletions packages/frontend/components/file/macro.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% macro file(opts) %}
{%- include "./template.njk" -%}
{% endmacro %}
17 changes: 17 additions & 0 deletions packages/frontend/components/file/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.file__title {
--flow-space: 0;
@extend %label;
}

.file__title svg {
inline-size: var(--step-0);
margin-inline-end: var(--space-inline);
}

.file__meta {
@extend %caption;

color: var(--color-neutral-dark);
margin-block-start: 0;
margin-inline-start: calc(var(--step-0) + var(--space-inline));
}
7 changes: 7 additions & 0 deletions packages/frontend/components/file/template.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{%- set classes = "file" + (" " + opts.classes if opts.classes) -%}
<article class="{{ classes }}">
<h2 class="file__title">
{{ icon(opts.icon) }}<a href="{{ opts.href }}">{{ opts.title }}</a>
</h2>
<p class="file__meta">{{ opts.meta }}</p>
</article>
11 changes: 8 additions & 3 deletions packages/frontend/styles/scopes/linear.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@
padding: 0;
}

.s-linear h2 {
.s-linear h2:not([class]) {
@extend %heading;

margin-block-start: calc(var(--flow-space) * 1.5);
}

.s-linear h2 + * {
.s-linear h2:not([class]) + * {
margin-block-start: calc(var(--flow-space) / 1.5);
}

.s-linear h3 {
.s-linear h3:not([class]) {
@extend %subhead;
}

Expand Down Expand Up @@ -97,6 +97,11 @@
line-height: var(--line-height-tight);
}

.s-linear .no-bullets {
list-style: none;
padding-inline-start: 0;
}

.s-linear > *:not([class]) {
max-inline-size: var(--line-measure);
word-break: break-word;
Expand Down

0 comments on commit c455c7d

Please sign in to comment.