From ffe6e62ced986686667d5cf4b55bc8fee4f65623 Mon Sep 17 00:00:00 2001 From: Emil Miler Date: Sat, 15 Apr 2023 15:32:21 +0200 Subject: [PATCH] Add macros & project listing --- content/projekty/_index.md | 1 + content/projekty/project-0.md | 4 +++ content/projekty/project-1.md | 3 +++ sass/style.scss | 42 +++++++++++++++++++++++++++++ static/img/project_placeholder.png | Bin 0 -> 69 bytes templates/base.html | 2 ++ templates/macros.html | 25 +++++++++++++++++ templates/projects.html | 7 +++++ 8 files changed, 84 insertions(+) create mode 100644 content/projekty/project-0.md create mode 100644 content/projekty/project-1.md create mode 100644 static/img/project_placeholder.png create mode 100644 templates/macros.html create mode 100644 templates/projects.html diff --git a/content/projekty/_index.md b/content/projekty/_index.md index 2fea8ac..650a023 100644 --- a/content/projekty/_index.md +++ b/content/projekty/_index.md @@ -1,3 +1,4 @@ +++ title = "Projekty" +template = "projects.html" +++ diff --git a/content/projekty/project-0.md b/content/projekty/project-0.md new file mode 100644 index 0000000..6ec5d68 --- /dev/null +++ b/content/projekty/project-0.md @@ -0,0 +1,4 @@ ++++ +title = "Project 0" +description = "Lorem ipsum dolor sit amet, qui minim labore adipisicing minim sint cillum sint consectetur cupidatat." ++++ diff --git a/content/projekty/project-1.md b/content/projekty/project-1.md new file mode 100644 index 0000000..0b04070 --- /dev/null +++ b/content/projekty/project-1.md @@ -0,0 +1,3 @@ ++++ +title = "Project 1" ++++ diff --git a/sass/style.scss b/sass/style.scss index 7c536c0..95f42d6 100644 --- a/sass/style.scss +++ b/sass/style.scss @@ -155,3 +155,45 @@ body>footer { padding: 1rem 0; } } + +.project-list { + display: grid; + grid-template-columns: 1fr; + gap: 1rem; + background: none; + padding: 0; + + @media only screen and (min-width: $width-narrow) { + grid-template-columns: 1fr 1fr; + } + + &>a { + display: flex; + min-height: 10rem; + background: $col-dark; + color: inherit; + + .title { + font-weight: bold; + font-size: 1.5em; + margin-bottom: .5em; + line-height: 1; + } + + .description { + padding: 1.5em 1em; + width: 100%; + + p { + margin: 0; + line-height: 1.5; + } + } + + .image { + display: block; + height: 100%; + width: 12rem; + } + } +} diff --git a/static/img/project_placeholder.png b/static/img/project_placeholder.png new file mode 100644 index 0000000000000000000000000000000000000000..a041c6cece162a09da4b0368388b3f091c02c055 GIT binary patch literal 69 zcmeAS@N?(olHy`uVBq!ia0vp^j3CUx1SBVv2j2ryJf1F&Asp9}JG#4>8JH{>rRM}K RJP8zM@O1TaS?83{1OTdG4$}Yt literal 0 HcmV?d00001 diff --git a/templates/base.html b/templates/base.html index 422c897..7e71e47 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,3 +1,5 @@ +{% import "macros.html" as macros %} + diff --git a/templates/macros.html b/templates/macros.html new file mode 100644 index 0000000..a0604af --- /dev/null +++ b/templates/macros.html @@ -0,0 +1,25 @@ +{% macro project_list() %} + {% for project in section.pages %} + + {% set_global image = "/static/img/project_placeholder.png" %} + {% for asset in project.assets %} + {% if asset is matching("[img.](jpg|png)$") %} + {% set_global image = asset %} + {% break %} + {% endif %} + {% endfor %} + {% set image = resize_image(path=image, width=300, height=300, op="fill") %} +
+
+
{{ project.title }}
+

+ {% if project.description %} + {{ project.description }} + {% else %} + … + {% endif %} +

+
+
+ {% endfor %} +{% endmacro %} diff --git a/templates/projects.html b/templates/projects.html new file mode 100644 index 0000000..58a919e --- /dev/null +++ b/templates/projects.html @@ -0,0 +1,7 @@ +{% extends "base.html" %} + +{% block content %} +
+ {{ macros::project_list() }} +
+{% endblock content %}