From 463ebe6bfea303817a05ed1835a38657398edf1a Mon Sep 17 00:00:00 2001 From: Colton Padden Date: Sat, 10 Aug 2024 13:22:32 -0400 Subject: [PATCH] feat: move github to top level nav, use 3-bars icon; formatting --- components/Header.vue | 227 +++++++++++++++++++++--------------- package.json | 2 +- pages/articles/index.vue | 216 ++++++++++++++++++---------------- pages/playground/conway.vue | 6 +- pages/talks.vue | 111 +++++++++--------- 5 files changed, 312 insertions(+), 250 deletions(-) diff --git a/components/Header.vue b/components/Header.vue index bc2efb1e..06d927f4 100644 --- a/components/Header.vue +++ b/components/Header.vue @@ -1,105 +1,142 @@ diff --git a/package.json b/package.json index 8e49bfbc..43fdb679 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "generate": "nuxt generate", "preview": "nuxt preview", "postinstall": "nuxt prepare", - "format": "prettier --parser vue components/ pages/ plugins/ --write" + "format": "prettier --parser vue components/ pages/ --write" }, "devDependencies": { "@heroicons/vue": "^2.1.3", diff --git a/pages/articles/index.vue b/pages/articles/index.vue index 57a90e50..43a7e344 100644 --- a/pages/articles/index.vue +++ b/pages/articles/index.vue @@ -10,138 +10,152 @@ const route = useRoute(); const selectedCategories = ref([]); if (route.query.category) { - selectedCategories.value = [route.query.category]; + selectedCategories.value = [route.query.category]; } const selectedTags = ref([]); if (route.query.tag) { - selectedTags.value = [route.query.tag]; + selectedTags.value = [route.query.tag]; } const showTags = ref(true); const { data: articles } = await useAsyncData("articles", () => - queryContent() - .only([ - "_id", - "_path", - "title", - "description", - "date", - "img", - "author", - "tags", - "categories", - "img", - "excerpt", - "summary", - ]) - .sort({ date: -1 }) - .find(), + queryContent() + .only([ + "_id", + "_path", + "title", + "description", + "date", + "img", + "author", + "tags", + "categories", + "img", + "excerpt", + "summary", + ]) + .sort({ date: -1 }) + .find(), ); const categories = computed(() => { - return [ - ...new Set( - articles.value - .map((article) => article.categories) - .flat() - .sort(), - ), - ]; + return [ + ...new Set( + articles.value + .map((article) => article.categories) + .flat() + .sort(), + ), + ]; }); const tags = computed(() => { - return [ - ...new Set( - articles.value - .map((article) => article.tags) - .flat() - .sort(), - ), - ]; + return [ + ...new Set( + articles.value + .map((article) => article.tags) + .flat() + .sort(), + ), + ]; }); const visibleArticles = computed(() => { - return articles.value.filter((article) => { - if (selectedCategories.value.length > 0) { - if ( - !selectedCategories.value.every((c) => article.categories.includes(c)) - ) { - return false; - } - } + return articles.value.filter((article) => { + if (selectedCategories.value.length > 0) { + if ( + !selectedCategories.value.every((c) => article.categories.includes(c)) + ) { + return false; + } + } - if (selectedTags.value.length > 0) { - if (!selectedTags.value.every((t) => article.tags.includes(t))) { - return false; - } - } + if (selectedTags.value.length > 0) { + if (!selectedTags.value.every((t) => article.tags.includes(t))) { + return false; + } + } - return true; - }); + return true; + }); }); function toggleTag(tag) { - if (selectedTags.value.includes(tag)) { - selectedTags.value = selectedTags.value.filter((el) => el !== tag); - } else { - selectedTags.value.push(tag); - } + if (selectedTags.value.includes(tag)) { + selectedTags.value = selectedTags.value.filter((el) => el !== tag); + } else { + selectedTags.value.push(tag); + } } function toggleCategory(cat) { - if (selectedCategories.value.includes(cat)) { - selectedCategories.value = selectedCategories.value.filter( - (el) => el !== cat, - ); - } else { - selectedCategories.value.push(cat); - } + if (selectedCategories.value.includes(cat)) { + selectedCategories.value = selectedCategories.value.filter( + (el) => el !== cat, + ); + } else { + selectedCategories.value.push(cat); + } } diff --git a/pages/playground/conway.vue b/pages/playground/conway.vue index 5b69e01f..ba004843 100644 --- a/pages/playground/conway.vue +++ b/pages/playground/conway.vue @@ -4,6 +4,10 @@ definePageMeta({ layout: "light" }); diff --git a/pages/talks.vue b/pages/talks.vue index 3252032e..911a3674 100644 --- a/pages/talks.vue +++ b/pages/talks.vue @@ -1,65 +1,72 @@