Skip to content

Commit

Permalink
more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
thecristen committed Aug 14, 2024
1 parent 21c4dd6 commit 26d4073
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 894 deletions.
58 changes: 3 additions & 55 deletions documentation/.eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@ module.exports = function(eleventyConfig) {
return '<img class="icon" src="'+url+'" alt="'+title+'" />';
});

// Button shortcode -- experimental
// eleventyConfig.addLiquidShortcode("button", function(title,url) {
// return '<a class="button" href="'+url+'">'+title+'</a>';
// });


// Tailwind pass through and watch target
eleventyConfig.addWatchTarget("./_tmp/style.css");
eleventyConfig.addPassthroughCopy({ "./_tmp/style.css": "./style.css" });
Expand All @@ -82,45 +76,11 @@ module.exports = function(eleventyConfig) {
// https://www.11ty.dev/docs/data-deep-merge/
eleventyConfig.setDataDeepMerge(true);

// Add support for maintenance-free post authors
// Adds an authors collection using the author key in our post frontmatter
// Thanks to @pdehaan: https://github.com/pdehaan
// eleventyConfig.addCollection("authors", collection => {
// const blogs = collection.getFilteredByGlob("posts/*.md");
// return blogs.reduce((coll, post) => {
// const author = post.data.author;
// if (!author) {
// return coll;
// }
// if (!coll.hasOwnProperty(author)) {
// coll[author] = [];
// }
// coll[author].push(post.data);
// return coll;
// }, {});
// });

// Creates custom collection "pages"
eleventyConfig.addCollection("pages", function(collection) {
return collection.getFilteredByGlob("pages/*.md");
});

// Creates custom collection "posts"
// eleventyConfig.addCollection("posts", function(collection) {
// const coll = collection.getFilteredByGlob("posts/*.md");

// for(let i = 0; i < coll.length ; i++) {
// const prevPost = coll[i-1];
// const nextPost = coll[i + 1];

// coll[i].data["prevPost"] = prevPost;
// coll[i].data["nextPost"] = nextPost;
// }

// return coll;
// });


// Creates custom collection "results" for search
const searchFilter = require("./filters/searchFilter");
eleventyConfig.addFilter("search", searchFilter);
Expand All @@ -131,12 +91,9 @@ module.exports = function(eleventyConfig) {
// Creates custom collection "menuItems"
eleventyConfig.addCollection("menuItems", collection =>
collection
.getAll()
.filter(function(item) {
return "eleventyNavigation" in item.data;
})
.getFilteredByTag("pg")
.sort((a, b) => {
return (a.data.eleventyNavigation.order || 0) - (b.data.eleventyNavigation.order || 0);
return (a.data.pg_order || 0) - (b.data.pg_order || 0);
})
);

Expand Down Expand Up @@ -183,9 +140,7 @@ module.exports = function(eleventyConfig) {
eleventyConfig.addPassthroughCopy("favicon.ico");
eleventyConfig.addPassthroughCopy("images/")
eleventyConfig.addPassthroughCopy("content/images/")
eleventyConfig.addPassthroughCopy("admin");
eleventyConfig.addPassthroughCopy("_includes/assets/");
eleventyConfig.addPassthroughCopy("_includes/experimental/");

/* Markdown Plugins */
let markdownIt = require("markdown-it");
Expand All @@ -211,13 +166,6 @@ module.exports = function(eleventyConfig) {
};

eleventyConfig.setLibrary("md", markdownIt(options)
.use(mdIterator, 'url_new_win', 'link_open', function (tokens, idx) {
const [attrName, href] = tokens[idx].attrs.find(attr => attr[0] === 'href')
if (href && (!href.includes('franknoirot.co') && !href.startsWith('/') && !href.startsWith('#'))) {
tokens[idx].attrPush([ 'target', '_blank' ])
tokens[idx].attrPush([ 'rel', 'noopener noreferrer' ])
}
})
.use(markdownItAnchor, opts)
.use(markdownItEmoji)
.use(markdownItFootnote)
Expand All @@ -244,7 +192,7 @@ module.exports = function(eleventyConfig) {
// Leading or trailing slashes are all normalized away, so don’t worry about it.
// If you don’t have a subdirectory, use "" or "/" (they do the same thing)
// This is only used for URLs (it does not affect your file structure)
pathPrefix: "/rider-design-system/",
pathPrefix: "/rider-design-system",
markdownTemplateEngine: "liquid",
htmlTemplateEngine: "njk",
dataTemplateEngine: "njk",
Expand Down
14 changes: 3 additions & 11 deletions documentation/_includes/components/footer.njk
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
<div class="z-50 mt-12 h-12 flex dark:bg-gray-900 text-gray-500 dark:text-gray-400 justify-center p-2 border-t border-gray-100 dark:border-gray-800">
<div class="flex w-full items-center ">

<div class="w-6 h-6 flex-none">
{% if site.enableContact == 1 %}
<a aria-label="Contact" href="/contact" rel="noopener noreferrer">
<svg width="24" height="24" class="text-gray-500 dark:text-gray-400" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M1 3.5l.5-.5h13l.5.5v9l-.5.5h-13l-.5-.5v-9zm1 1.035V12h12V4.536L8.31 8.9H7.7L2 4.535zM13.03 4H2.97L8 7.869 13.03 4z"/></svg>
</a>
{% endif %}
</div>

<div class="flex w-full items-center ">
<div class="text-gray-500 flex flex-grow justify-center text-align-center">
<small>
{% if site.footer %}
Expand All @@ -18,7 +9,8 @@
</div>
{% if site.enableGithubLink == 1 %}
<div class="flex-none ml-2 float-right">
<a aria-label="github link" rel="noopener noreferrer" href="{{ site.githubUrl}}" target="_blank"><svg height="28" viewBox="0 0 24 24" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" class="text-gray-400 dark:text-gray-400" d="M12 3C7.0275 3 3 7.12937 3 12.2276C3 16.3109 5.57625 19.7597 9.15374 20.9824C9.60374 21.0631 9.77249 20.7863 9.77249 20.5441C9.77249 20.3249 9.76125 19.5982 9.76125 18.8254C7.5 19.2522 6.915 18.2602 6.735 17.7412C6.63375 17.4759 6.19499 16.6569 5.8125 16.4378C5.4975 16.2647 5.0475 15.838 5.80124 15.8264C6.51 15.8149 7.01625 16.4954 7.18499 16.7723C7.99499 18.1679 9.28875 17.7758 9.80625 17.5335C9.885 16.9337 10.1212 16.53 10.38 16.2993C8.3775 16.0687 6.285 15.2728 6.285 11.7432C6.285 10.7397 6.63375 9.9092 7.20749 9.26326C7.1175 9.03257 6.8025 8.08674 7.2975 6.81794C7.2975 6.81794 8.05125 6.57571 9.77249 7.76377C10.4925 7.55615 11.2575 7.45234 12.0225 7.45234C12.7875 7.45234 13.5525 7.55615 14.2725 7.76377C15.9937 6.56418 16.7475 6.81794 16.7475 6.81794C17.2424 8.08674 16.9275 9.03257 16.8375 9.26326C17.4113 9.9092 17.76 10.7281 17.76 11.7432C17.76 15.2843 15.6563 16.0687 13.6537 16.2993C13.98 16.5877 14.2613 17.1414 14.2613 18.0065C14.2613 19.2407 14.25 20.2326 14.25 20.5441C14.25 20.7863 14.4188 21.0746 14.8688 20.9824C16.6554 20.364 18.2079 19.1866 19.3078 17.6162C20.4077 16.0457 20.9995 14.1611 21 12.2276C21 7.12937 16.9725 3 12 3Z" fill="currentColor"></path></svg></a>
<a aria-label="github link" rel="noopener noreferrer" href="{{ site.githubUrl
}}" target="_blank"><svg height="28" viewBox="0 0 24 24" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" class="text-gray-400 dark:text-gray-400" d="M12 3C7.0275 3 3 7.12937 3 12.2276C3 16.3109 5.57625 19.7597 9.15374 20.9824C9.60374 21.0631 9.77249 20.7863 9.77249 20.5441C9.77249 20.3249 9.76125 19.5982 9.76125 18.8254C7.5 19.2522 6.915 18.2602 6.735 17.7412C6.63375 17.4759 6.19499 16.6569 5.8125 16.4378C5.4975 16.2647 5.0475 15.838 5.80124 15.8264C6.51 15.8149 7.01625 16.4954 7.18499 16.7723C7.99499 18.1679 9.28875 17.7758 9.80625 17.5335C9.885 16.9337 10.1212 16.53 10.38 16.2993C8.3775 16.0687 6.285 15.2728 6.285 11.7432C6.285 10.7397 6.63375 9.9092 7.20749 9.26326C7.1175 9.03257 6.8025 8.08674 7.2975 6.81794C7.2975 6.81794 8.05125 6.57571 9.77249 7.76377C10.4925 7.55615 11.2575 7.45234 12.0225 7.45234C12.7875 7.45234 13.5525 7.55615 14.2725 7.76377C15.9937 6.56418 16.7475 6.81794 16.7475 6.81794C17.2424 8.08674 16.9275 9.03257 16.8375 9.26326C17.4113 9.9092 17.76 10.7281 17.76 11.7432C17.76 15.2843 15.6563 16.0687 13.6537 16.2993C13.98 16.5877 14.2613 17.1414 14.2613 18.0065C14.2613 19.2407 14.25 20.2326 14.25 20.5441C14.25 20.7863 14.4188 21.0746 14.8688 20.9824C16.6554 20.364 18.2079 19.1866 19.3078 17.6162C20.4077 16.0457 20.9995 14.1611 21 12.2276C21 7.12937 16.9725 3 12 3Z" fill="currentColor"></path></svg></a>
</div>
{% endif %}
</div>
Expand Down
2 changes: 1 addition & 1 deletion documentation/_includes/components/head.njk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ renderData.title or title or site.name }}</title>
<meta name="description" content="{{ metaDescription or renderData.metaDescription or site.description }}">
<link rel="stylesheet" href="style.css?v={% version %}"/>
<link rel="stylesheet" href="/style.css?v={% version %}"/>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>{{ site.emoji }}</text></svg>">

{% set js %}
Expand Down
96 changes: 11 additions & 85 deletions documentation/_includes/components/nav.njk
Original file line number Diff line number Diff line change
@@ -1,43 +1,11 @@
{% set navPages = collections.all | eleventyNavigation %}

{% macro renderNavListItem(entry,rel) -%}

{% if entry.url == page.url or entry.title == eleventyNavigation.parent or entry.title == eleventyComputed.key%}
{% if rel == "child" %}
{% set highlight = 'border-gray-600 font-semibold text-gray-500 focus:border-gray-700' %}
{% else %}
{% set highlight = 'border-gray-600 font-semibold focus:border-gray-700' %}
{% endif %}
{% set current = 'aria-current="page"' %}
{% else %}
{% set highlight = 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-500 ' %}
{% set current = '' %}
{% endif %}

{%- if not entry.children.length -%}
{% if rel == "child" %}
<a class="w-max
rounded
px-4 py-2
block
focus:text-gray-900
text-sm bg-transparent
dark:bg-transparent
dark:hover:text-gray-400
md:mt-0
m-0
hover:font-bold
focus:text-gray-900
focus:outline-none focus:ring {{ highlight }}
text-gray-500
dark:text-gray-500"
href="{{ entry.url | url }}">{{ entry.title }}</a>
{% else %}
<a class="w-max
<ul>
{%- for page in collections.menuItems -%}
<li>
<a class="w-max
px-4 py-3
rounded
block
text-sm
text-xl
bg-transparent
rounded-lg
dark:bg-transparent
Expand All @@ -49,51 +17,9 @@
hover:text-gray-900
focus:text-gray-900
focus:outline-none
focus:ring {{ highlight }}
text-gray-500"
href="{{ entry.url | url }}">{{ entry.title }}</a>
{% endif %}

{%- else -%}

{%- if entry.children.length -%}

<div @click.away="open = false" class="relative" x-data="{ open: false }">
<button @click="open = !open"
class="whitespace-nowrap flex flex-row items-center w-full lg:mr-2 px-4 py-2 mt-2 text-sm text-left bg-transparent rounded-lg dark:bg-transparent dark:focus:text-white dark:hover:text-gray-400 md:w-auto md:inline md:mt-0 md:ml-4 hover:text-gray-900 hover:font-semibold focus:text-gray-900 focus:outline-none focus:ring {{ highlight }}">
<span>{{ entry.title }}</span>
<svg fill="currentColor" viewBox="0 0 20 20" :class="{'rotate-180': open, 'rotate-0': !open}" class="inline w-4 h-4 mt-1 ml-1 transition-transform duration-200 transform md:-mt-1"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
</button>
<div x-show="open" x-transition:enter="transition ease-out duration-100" x-transition:enter-start="transform opacity-0 scale-95" x-transition:enter-end="transform opacity-100 scale-100" x-transition:leave="transition ease-in duration-75" x-transition:leave-start="transform opacity-100 scale-100" x-transition:leave-end="transform opacity-0 scale-95" x-transition="bg-gray-100 bg-white" class="shadow bg-white absolute rounded-lg top-8 w-max ml-4 mt-2">
<div class="py-2 w-max pr-12 dark:bg-gray-800">
{%- for child in entry.children %}{{ renderNavListItem(child) }}{% endfor -%}
</div>
</div>
</div>
{%- endif -%}
{%- endif -%}
{%- endmacro %}

<div class="md:bg-white dark:bg-gray-900 p-0 mt-8 pb-8 mr-1 flex w-full justify-end">
<div x-data="{ open: false }" class="flex flex-col justify-start md:items-center md:flex-row ">

<nav x-ref="dropdown" :class=" {'flex': open, 'hidden': !open}" class="hidden md:block mt-4 mr-2 justify-end flex-col flex-grow pb-4 md:pb-0 hidden md:flex md:flex-row">
{%- for entry in navPages %}
{{ renderNavListItem(entry,'child') }}
{%- endfor -%}
</nav>

<nav id="navigation" class="md:hidden h-screen fixed inset-y-0 overflow-x-hidden overflow-y-auto hidden w:64 lg:w-72 mt-20 md:block dark:bg-gray-900 flex-none top-0 p-4 w-64 md:border-r border-b border-gray-100 dark:border-gray-800">
<button name="Close navigation" onclick="closeNavigation()" class="float-right justify-end block md:hidden -mr-4 p-6"> <svg xmlns="http://www.w3.org/2000/svg" class="dark:bg-gray-500" width="18" height="18" viewBox="0 0 18 18"><path class="text-gray-100" d="M14.53 4.53l-1.06-1.06L9 7.94 4.53 3.47 3.47 4.53 7.94 9l-4.47 4.47 1.06 1.06L9 10.06l4.47 4.47 1.06-1.06L10.06 9z"/></svg></button>
<div class=" clear-right">
<a href="/">
<div class="block md:hidden pt-4 font-semibold text-gray-500">{{ site.name }}</div>
<div class="block md:hidden text-sm text-gray-500 mb-4">{{ site.subtitle }}</div>
</a>
{{ collections.all | eleventyNavigation | eleventyNavigationToHtml({anchorClass: "item",activeAnchorClass: "active",activeListItemClass: "active",activeKey: eleventyNavigation.key, listClass: "nav", listItemClass: "item"}) | safe }}
</div>
</nav>
</div>
</div>


focus:ring
text-gray-500" href="{{ page.url }}">
{{ page.data.title }}</a>
</li>
{%- endfor -%}
</ul>
14 changes: 5 additions & 9 deletions documentation/_includes/layouts/base.njk
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,19 @@
<body>
<div id="app" class="h-screen bg-white dark:bg-gray-900">
{% include "components/header.njk" %}
{% if site.navigationStyle == "vertical" %}

<nav id="navigation" class="fixed inset-y-0 overflow-x-hidden overflow-y-auto hidden w:64 lg:w-72 mt-20 md:block dark:bg-gray-900 flex-none top-0 p-4 w-64 md:border-r border-b border-gray-100 dark:border-gray-800">
<button name="Close navigation" onclick="closeNavigation()" class="float-right justify-end block md:hidden -mr-4 p-6"> <svg xmlns="http://www.w3.org/2000/svg" class="dark:bg-gray-500" width="18" height="18" viewBox="0 0 18 18"><path class="text-gray-100" d="M14.53 4.53l-1.06-1.06L9 7.94 4.53 3.47 3.47 4.53 7.94 9l-4.47 4.47 1.06 1.06L9 10.06l4.47 4.47 1.06-1.06L10.06 9z"/></svg></button>
<div class=" clear-right">
<a href="/">
<div class="block md:hidden pt-4 font-semibold text-gray-500">{{ site.name }}</div>
<div class="block md:hidden text-sm text-gray-500 mb-4">{{ site.subtitle }}</div>
</a>
{{ collections.all | eleventyNavigation | eleventyNavigationToHtml({anchorClass: "item",activeAnchorClass: "active",activeListItemClass: "active",activeKey: eleventyNavigation.key, listClass: "nav", listItemClass: "item"}) | safe }}
</div>
{% include "components/nav.njk" %}
</nav>
{% endif %}
{% if site.navigationStyle == 'horizontal' %}
<main id="main" class="dark:bg-gray-900 pt-16 sm:pt-18 md:pt-48">
{% else %}
<main id="main" class="dark:bg-gray-900 pt-16 sm:pt-18 md:pt-20 md:pl-64 lg:pl-72">
{% endif %}
<main id="main" class="dark:bg-gray-900 pt-16 sm:pt-18 md:pt-20 md:pl-64 lg:pl-72">


{{ layoutContent | safe }}
{% include "components/footer.njk" %}
</main>
Expand Down
9 changes: 3 additions & 6 deletions documentation/_includes/layouts/page.njk
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ section: page
---

{% if site.navigationStyle == "vertical" %}
{% if site.enableEditButton == true or site.enableDatestamp == true %}
{% if site.enableDatestamp == true %}
<div class="flex mt-4 justify-end mr-1">
{% if site.enableDatestamp == true %}
<div class="inline-block w-auto text-xs text-gray-500 pt-1 pb-1 pl-3 mr-2 rounded ">Updated <time datetime="{{ page.date | machineDate }}">{{ page.date | readableDate }}</time></div>
{% endif %}
{% if site.enableEditButton == true %}
<div class="inline-block w-auto text-xs text-gray-500 hover:bg-gray-200 pt-1 pr-4 pb-1 pl-3 rounded "><a target="_blank" rel="noopener" rel="noreferrer" href="{{ site.githubUrl }}/edit/{{ site.githubBranch }}/{{ page.inputPath }}">Edit</a></div>
{% endif %}
</div>
{% endif %}
{% endif %}
Expand Down Expand Up @@ -47,11 +44,11 @@ section: page
{% if site.enablePageNavigation == true %}
<ul class="footer-nav pt-4 mb-8 ml-0 pl-0 flex flex-wrap flex-row-reverse justify-between mt-8 list-none">
{%- set nextPage = collections.menuItems | getNextCollectionItem(page) %}
{%- if nextPage %}<li class="ml-0 pl-0"><a class="font-semibold text-gray-500 hover:text-gray-900" href="{{ nextPage.url | url }}">{% if nextPage.data.eleventyNavigation.title %}{{ nextPage.data.eleventyNavigation.title }}{% else %}{{ nextPage.data.eleventyNavigation.key }}{% endif %}</a> <svg height="24" fill="none" viewBox="0 0 24 24" stroke="#6B7280" class="inline ml-1 flex-shrink-0"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path></svg></li>{% endif %}
{%- if nextPage %}<li class="ml-0 pl-0"><a class="font-semibold text-gray-500 hover:text-gray-900" href="{{ nextPage.url | htmlBaseUrl }}">{% if nextPage.data.eleventyNavigation.title %}{{ nextPage.data.eleventyNavigation.title }}{% else %}{{ nextPage.data.eleventyNavigation.key }}{% endif %}</a> <svg height="24" fill="none" viewBox="0 0 24 24" stroke="#6B7280" class="inline ml-1 flex-shrink-0"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path></svg></li>{% endif %}
{%- set previousPage = collections.menuItems | getPreviousCollectionItem(page) %}
{%- if previousPage %}<li class="ml-0 pl-0"><svg height="24" fill="none" viewBox="0 0 24 24" stroke="#6B7280" class="transform rotate-180 inline mr-1 flex-shrink-0">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path></svg>
<a class="font-semibold text-gray-500 hover:text-gray-900" href="{{ previousPage.url | url }}">
<a class="font-semibold text-gray-500 hover:text-gray-900" href="{{ previousPage.url | htmlBaseUrl }}">
{% if previousPage.data.eleventyNavigation.title %}{{ previousPage.data.eleventyNavigation.title }}{% else %}{{ previousPage.data.eleventyNavigation.key }}{% endif %} </a> </li>{% endif %}
</ul>
{% endif %}
Expand Down
Loading

0 comments on commit 26d4073

Please sign in to comment.