From fb3a7853db9e7eb410b2fbb1624a7f4bb4c5e9d1 Mon Sep 17 00:00:00 2001 From: Daniel Cho Date: Wed, 8 Jan 2025 11:57:16 -0500 Subject: [PATCH 01/10] feat: add project panel component --- eleventy.config.js | 4 + src/_includes/layouts/about.njk | 4 +- src/_includes/layouts/home.njk | 16 +--- src/_includes/layouts/projects.njk | 20 ++--- .../components/projectPanel.macro.njk | 19 +++++ src/_transforms/parse.js | 2 +- src/assets/styles/app.css | 1 + src/assets/styles/components/projectPanel.css | 83 +++++++++++++++++++ src/collections/projects/en/project.md | 5 ++ src/collections/projects/fr/project.md | 5 ++ 10 files changed, 129 insertions(+), 30 deletions(-) create mode 100644 src/_includes/partials/components/projectPanel.macro.njk create mode 100644 src/assets/styles/components/projectPanel.css create mode 100644 src/collections/projects/en/project.md create mode 100644 src/collections/projects/fr/project.md diff --git a/eleventy.config.js b/eleventy.config.js index 3b8386f..c549462 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -28,6 +28,10 @@ export default function eleventy(eleventyConfig) { eleventyConfig.addCollection(`pages_${lang}`, (collection) => { return collection.getFilteredByGlob(`src/collections/pages/${lang}/*.md`); }); + + eleventyConfig.addCollection(`projects_${lang}`, (collection) => { + return collection.getFilteredByGlob(`src/collections/projects/${lang}/*.md`); + }); }); eleventyConfig.addTransform("parse", parse); diff --git a/src/_includes/layouts/about.njk b/src/_includes/layouts/about.njk index 1f621a3..1f577e6 100644 --- a/src/_includes/layouts/about.njk +++ b/src/_includes/layouts/about.njk @@ -5,9 +5,7 @@ {{ content | safe }} {% if collections['projects_' + lang] %}
-
-

Projects

-
+

Projects

{% set cardType = "project" %} {% for item in collections['projects_' + lang] %} diff --git a/src/_includes/layouts/home.njk b/src/_includes/layouts/home.njk index 241a8b6..bd721f3 100644 --- a/src/_includes/layouts/home.njk +++ b/src/_includes/layouts/home.njk @@ -4,9 +4,7 @@ {% block content %} {% if collections['projects_' + lang] %}
-
-

Projects

-
+

Projects

{% set cardType = "project" %} {% for item in collections['projects_' + lang] %} @@ -19,9 +17,7 @@ {% endif %} {% if collections.events %}
-
-

Events

-
+

{% set cardType = "event" %} {% for item in collections.events %} @@ -34,9 +30,7 @@ {% endif %} {% if collections.resources %}
-
-

Resources

-
+

{% set cardType = "resource" %} {% for item in collections.resources %} @@ -49,9 +43,7 @@ {% endif %} {% if collections.news %}
-
-

Announcements

-
+

{% set cardType = "news" %} {% for item in collections.news %} diff --git a/src/_includes/layouts/projects.njk b/src/_includes/layouts/projects.njk index 741b1e5..18aee68 100644 --- a/src/_includes/layouts/projects.njk +++ b/src/_includes/layouts/projects.njk @@ -1,20 +1,12 @@ {% extends "layouts/base.njk" %} +{% from "partials/components/projectPanel.macro.njk" import projectPanel %} {% block content %}
-
-

All Standards With Us

-

- Lorem ipsum dolor sit amet. Ea galisum quisquam aut galisum aperiam eum dolores consequuntur et fugit rerum ut necessitatibus eligendi aut corrupti nisi quo voluptatum impedit. Nam dolor delectus non sapiente vero sit sint esse cum libero provident est Quis voluptatem non ipsa ullam vel iure autem. - Quo facilis reprehenderit in atque deleniti qui facilis vitae sit officia galisum. Quo laboriosam consequatur sed fugit voluptas id quibusdam galisum sit explicabo modi sit mollitia placeat hic laboriosam omnis. -

-
-
-

Review of the Review

-

- Lorem ipsum dolor sit amet. Ea galisum quisquam aut galisum aperiam eum dolores consequuntur et fugit rerum ut necessitatibus eligendi aut corrupti nisi quo voluptatum impedit. Nam dolor delectus non sapiente vero sit sint esse cum libero provident est Quis voluptatem non ipsa ullam vel iure autem. - Quo facilis reprehenderit in atque deleniti qui facilis vitae sit officia galisum. Quo laboriosam consequatur sed fugit voluptas id quibusdam galisum sit explicabo modi sit mollitia placeat hic laboriosam omnis. -

-
+ {% if collections['projects_' + lang] %} + {% for item in collections['projects_' + lang] %} + {{ projectPanel({image: item.data.image, title: item.data.title, body: item.data.body }) }} + {% endfor %} + {% endif %}
{% endblock %} \ No newline at end of file diff --git a/src/_includes/partials/components/projectPanel.macro.njk b/src/_includes/partials/components/projectPanel.macro.njk new file mode 100644 index 0000000..30e5d3a --- /dev/null +++ b/src/_includes/partials/components/projectPanel.macro.njk @@ -0,0 +1,19 @@ +{%- macro projectPanel(params) -%} +
+
+
+ {% if params.image %} +
+ {{ params.image }} +
+ {% endif %} +
+ + {{ params.title | safe }} + +
+

{{ params.body | renderContent("md") }}

+
+
+
+{% endmacro %} \ No newline at end of file diff --git a/src/_transforms/parse.js b/src/_transforms/parse.js index 8b2533c..7af493d 100644 --- a/src/_transforms/parse.js +++ b/src/_transforms/parse.js @@ -9,7 +9,7 @@ export default (value, outputPath) => { for (const heading of sectionHeadings) { const getContent = (elem) => { let elems = []; - while (elem.nextElementSibling && elem.nextElementSibling.tagName !== "H2") { + while (elem.nextElementSibling && elem.nextElementSibling.tagName !== "H2" && elem.nextElementSibling.tagName !== "SECTION") { elems.push(elem.nextElementSibling); elem = elem.nextElementSibling; } diff --git a/src/assets/styles/app.css b/src/assets/styles/app.css index ba03c31..5953a01 100644 --- a/src/assets/styles/app.css +++ b/src/assets/styles/app.css @@ -15,3 +15,4 @@ /* Components */ @import "./components/card.css"; @import "./components/navigation.css"; +@import "./components/projectPanel.css"; diff --git a/src/assets/styles/components/projectPanel.css b/src/assets/styles/components/projectPanel.css new file mode 100644 index 0000000..f5fbef6 --- /dev/null +++ b/src/assets/styles/components/projectPanel.css @@ -0,0 +1,83 @@ +div:has(.projectPanel) { + background-color: var(--color-indigo-100); + display: flex; + flex-direction: column; + gap: 2rem; + padding-block: var(--common-block-padding); + padding-inline: var(--common-inline-padding); +} + +.projectPanel { + background-color: var(--fl-fgColor, var(--color-yellow)); + box-shadow: 0 0.625rem 1.25rem 0 #0B046C26; + border: 0.1875rem solid var(--fl-bgColor, var(--color-indigo-100)); + display: flex; + flex-direction: column; + position: relative; +} + +.projectPanel:has(a:focus) { + border: 0.1875rem solid transparent; + outline: 0.1875rem solid var(--fl-fgColor, transparent); + outline-offset: 0.1875rem; +} + +.projectPanel:hover { + box-shadow: 0px 10px 20px 0px #0B046C73; +} + +.projectPanel__color { + min-height: 2.5rem; + border-right: 0.125rem solid var(--fl-fgColor, var(--color-yellow)); +} + +.projectPanel__image { + min-width: 16.25rem; + min-height: 12.1875rem; + max-width: 31.0625rem; + max-height: 23.125rem; +} + +.projectPanel__title { + font-weight: var(--font-weight-semibold); + font-family: var(--family-sans-serif); + font-size: var(--step-4); + text-decoration: none; + color: black; +} + +.projectPanel__title:focus { + background: none; + box-shadow: none; + color: var(--fl-linkColor, var(--black)); + outline: none; +} + +.projectPanel__title::after { + bottom: 0; + content: ""; + display: block; + left: 0; + position: absolute; + right: 0; + top: 0; +} + +.projectPanel__content { + background-color: white; + display: flex; + flex-direction: column; + padding: 1.875rem; + width: 100%; +} + +@media (width >= 70.875rem) { + .projectPanel { + flex-direction: row; + } + + .projectPanel__color { + min-width: 4.625rem; + min-height: 23.125rem; + } +} \ No newline at end of file diff --git a/src/collections/projects/en/project.md b/src/collections/projects/en/project.md new file mode 100644 index 0000000..66b0c88 --- /dev/null +++ b/src/collections/projects/en/project.md @@ -0,0 +1,5 @@ +--- +title: Project +image: image +body: body +--- \ No newline at end of file diff --git a/src/collections/projects/fr/project.md b/src/collections/projects/fr/project.md new file mode 100644 index 0000000..8ac77d0 --- /dev/null +++ b/src/collections/projects/fr/project.md @@ -0,0 +1,5 @@ +--- +title: Project +image: image +body: body +--- \ No newline at end of file From 9d1be41941ab4718714306bea310277b3deccc63 Mon Sep 17 00:00:00 2001 From: Daniel Cho Date: Wed, 8 Jan 2025 13:52:57 -0500 Subject: [PATCH 02/10] fix: adjust card style in different states --- src/_includes/layouts/about.njk | 2 +- src/_includes/layouts/home.njk | 8 ++++---- src/_includes/layouts/projects.njk | 2 +- src/_includes/partials/components/projectPanel.macro.njk | 2 +- src/assets/styles/base/_base.css | 3 ++- src/assets/styles/components/projectPanel.css | 6 ++++-- src/collections/projects/en/project.md | 3 +-- src/collections/projects/fr/project.md | 5 ++--- 8 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/_includes/layouts/about.njk b/src/_includes/layouts/about.njk index 1f577e6..f4cc7a2 100644 --- a/src/_includes/layouts/about.njk +++ b/src/_includes/layouts/about.njk @@ -9,7 +9,7 @@
{% set cardType = "project" %} {% for item in collections['projects_' + lang] %} - {{ card({image: item.data.image, title: item.data.title, body: item.data.body }) }} + {{ card({image: item.data.image, title: item.data.title, body: item.data.desc }) }} {% endfor %}