Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add initial layout and components #36

Merged
merged 24 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
50a068c
feat: update base layout
chosww Nov 11, 2024
5696f35
feat: add card component
chosww Nov 11, 2024
4cb6a45
feat: add css styles for the main page and mock example cards
chosww Nov 14, 2024
35d8353
feat: add navigation and About and Projects page
chosww Nov 20, 2024
2a880a5
feat: add banner for about and projects page and update type scales
chosww Nov 21, 2024
e938dfd
feat: implement header with UIO and tweak some styles
chosww Dec 3, 2024
ad5a488
fix: uio contrast issues and rendering of the about page
chosww Dec 4, 2024
888d737
Merge remote-tracking branch 'upstream/main' into feat/layout-and-cards
chosww Dec 4, 2024
a275d04
fix: update based on PR feedback
chosww Dec 6, 2024
958b0f4
fix: use parser to render about page content
chosww Jan 6, 2025
93d1030
fix: remove conditional parse script load
chosww Jan 6, 2025
b2390bc
fix: simplify base template
chosww Jan 6, 2025
1f8d710
fix: use home template for pages collections
chosww Jan 6, 2025
dd8c85f
fix: improvements to localization, rebase conflicting changes
greatislander Jan 6, 2025
f2d7413
fix: resolve a couple of issues
greatislander Jan 6, 2025
3996533
fix: resolve issues with parse transform
greatislander Jan 6, 2025
8888a65
fix: remove default content from home page
greatislander Jan 6, 2025
59ab3b1
feat: add fields and render contact information
greatislander Jan 7, 2025
1ff575a
fix: render markdown in banner text
greatislander Jan 7, 2025
844fcad
fix: clean up app.css
greatislander Jan 7, 2025
cf9e6a4
feat: adjust some variables and base styles
greatislander Jan 7, 2025
76f806c
fix: remove locale_url for now
greatislander Jan 7, 2025
65ee5c7
fix: parser should ignore h2 elements with a class
greatislander Jan 7, 2025
5792597
fix: adjustments to footer
greatislander Jan 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions eleventy.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { EleventyRenderPlugin } from "@11ty/eleventy";
import eleventyNavigationPlugin from "@11ty/eleventy-navigation";
import fluidPlugin from "eleventy-plugin-fluid";
import footnotesPlugin from "eleventy-plugin-footnotes";
import parse from "./src/assets/scripts/parse.js";

export default function eleventy(eleventyConfig) {
eleventyConfig.addPlugin(eleventyNavigationPlugin);
Expand Down Expand Up @@ -29,6 +30,8 @@ export default function eleventy(eleventyConfig) {
});
});

eleventyConfig.addTransform("parse", parse);

eleventyConfig.addPassthroughCopy({
"src/admin/config.yml": "admin/config.yml"
});
Expand Down
207 changes: 207 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"cross-env": "^7.0.3",
"debug": "^4.3.5",
"husky": "^9.0.11",
"linkedom": "^0.18.6",
"lint-staged": "^15.2.7",
"markdownlint-cli2": "^0.15.0",
"markdownlint-config-fluid": "^0.1.5",
Expand Down
7 changes: 1 addition & 6 deletions src/_includes/layouts/about.njk
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
{% extends "layouts/base.njk" %}

{% block content %}
{% for key, value in sections %}
<section>
<h2>{{ key }}</h2>
<p>{{ value }}</p>
</section>
{% endfor %}
{{ content | safe }}
{% endblock %}
9 changes: 4 additions & 5 deletions src/_includes/layouts/base.njk
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@
{% include "partials/global/scripts.njk" %}
</head>
<body>
<main>
greatislander marked this conversation as resolved.
Show resolved Hide resolved
{% include "partials/global/header.njk" %}
{% include "partials/components/navigation.njk" %}
{% from "partials/components/card.macro.njk" import card %}
{% if hasBanner %}
<div class="banner bg-{{ bannerBgColor }}">
<div class="banner__text">
<div class="banner__title">
{{ bannerTitle | safe }}
</div>
<h1>{{ bannerTitle | safe }}</h1>
{{ bannerBody }}
</div>
{% if bannerImage %}
Expand All @@ -28,7 +27,6 @@
{% endif %}
{% block content %}{% endblock %}
{% if collections['projects_' + lang] %}
{% set cardImage = "yes" %}
<section class="display">
<div class="display__title">
<h2>Projects</h2>
Expand Down Expand Up @@ -88,6 +86,7 @@
</div>
</section>
{% endif %}
{% include "partials/global/footer.njk" %}
</main>
{% include "partials/global/footer.njk" %}
</body>
</html>
3 changes: 3 additions & 0 deletions src/_includes/partials/global/scripts.njk
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
{% uioScripts %}
<script type="text/javascript" src="/assets/scripts/app.js" defer></script>
{% if page.fileSlug === "about" %}
<script type="text/javascript" src="/assets/scripts/parse.js" defer></script>
{% endif %}
36 changes: 36 additions & 0 deletions src/assets/scripts/parse.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { parseHTML } from "linkedom";

export default (value, outputPath) => {
if (outputPath && outputPath.includes(".html")) {
const { document } = parseHTML(value);
if (document) {
const main = document.getElementsByTagName("main");
const updatedMain = document.createElement("main");
let section = document.createElement("section");

if (main[0]?.children) {
for (const element of main[0].children) {
if (element.tagName === "H2" && element.classList?.length === 0) {
if (section.children.length > 0) {
updatedMain.append(section);
section = document.createElement("section");
}
section.append(element);
} else if (element.tagName === "P" && element.classList?.length === 0) {
section.append(element);
} else {
if (section.children.length > 0) {
updatedMain.append(section);
}
updatedMain.append(element);
}
}
main[0].replaceWith(updatedMain);
}

return "<!DOCTYPE html>\r\n" + document.documentElement?.outerHTML;
}
}

return value;
};
Loading
Loading