diff --git a/src/content/authors/-index.md b/src/content/authors/-index.md
new file mode 100644
index 0000000..799f730
--- /dev/null
+++ b/src/content/authors/-index.md
@@ -0,0 +1,5 @@
+---
+title: "Authors"
+meta_title: ""
+description: "this is meta description"
+---
diff --git a/src/content/authors/index.md b/src/content/authors/index.md
deleted file mode 100644
index 62eae44..0000000
--- a/src/content/authors/index.md
+++ /dev/null
@@ -1,3 +0,0 @@
----
-title: "Authors"
----
diff --git a/src/content/config.ts b/src/content/config.ts
index 55ea265..dba4975 100755
--- a/src/content/config.ts
+++ b/src/content/config.ts
@@ -48,6 +48,6 @@ const pagesCollection = defineCollection({
// Export collections
export const collections = {
posts: postsCollection,
- pages: pagesCollection,
authors: authorsCollection,
+ pages: pagesCollection,
};
diff --git a/src/content/posts/index.md b/src/content/posts/-index.md
similarity index 100%
rename from src/content/posts/index.md
rename to src/content/posts/-index.md
diff --git a/src/layouts/shortcodes/Accordion.tsx b/src/layouts/shortcodes/Accordion.tsx
index 48ae362..5389ae1 100644
--- a/src/layouts/shortcodes/Accordion.tsx
+++ b/src/layouts/shortcodes/Accordion.tsx
@@ -13,7 +13,7 @@ const Accordion = ({
return (
-
setShow(!show)}>
+
+
{children}
);
diff --git a/src/layouts/shortcodes/Tabs.tsx b/src/layouts/shortcodes/Tabs.tsx
index a1894cd..6129ce5 100644
--- a/src/layouts/shortcodes/Tabs.tsx
+++ b/src/layouts/shortcodes/Tabs.tsx
@@ -1,44 +1,63 @@
import { marked } from "marked";
-import React, { useState } from "react";
+import React, { useEffect, useRef, useState } from "react";
-function Tabs({ children }: { children: any }) {
- const [active, setAvtive] = useState(0);
+const Tabs = ({ children }: any) => {
+ const [active, setActive] = useState(0);
+ const [defaultFocus, setDefaultFocus] = useState(false);
- const tabItems = Array.from(
+ const tabRefs: any = useRef([]);
+ useEffect(() => {
+ if (defaultFocus) {
+ tabRefs.current[active]?.focus();
+ } else {
+ setDefaultFocus(true);
+ }
+ }, [active]);
+
+ const tabLinks = Array.from(
children.props.value.matchAll(
/]*>(.*?)<\/div>/gs
),
(match: RegExpMatchArray) => ({ name: match[1], children: match[0] })
);
+ const handleKeyDown = (event: any, index: number) => {
+ if (event.key === "Enter" || event.key === " ") {
+ setActive(index);
+ } else if (event.key === "ArrowRight") {
+ setActive((active + 1) % tabLinks.length);
+ } else if (event.key === "ArrowLeft") {
+ setActive((active - 1 + tabLinks.length) % tabLinks.length);
+ }
+ };
+
return (
- {tabItems.map((item: any, index: number) => (
+ {tabLinks.map((item: any, index: number) => (
- setAvtive(index)}
+ role="tab"
+ tabIndex={index === active ? 0 : -1}
+ onKeyDown={(event) => handleKeyDown(event, index)}
+ onClick={() => setActive(index)}
+ ref={(ref) => (tabRefs.current[index] = ref)}
>
{item.name}
))}
-
-
- {tabItems.map((item, i) => (
-
- ))}
-
+ {tabLinks.map((item, i) => (
+
+ ))}
);
-}
+};
export default Tabs;
diff --git a/src/lib/contentParser.astro b/src/lib/contentParser.astro
index a0969dd..1b59cc3 100644
--- a/src/lib/contentParser.astro
+++ b/src/lib/contentParser.astro
@@ -3,7 +3,7 @@ import { getCollection } from "astro:content";
export const getSinglePage = async (collection: any) => {
const allPage = await getCollection(collection);
- const removeIndex = allPage.filter((data) => data.id !== "index.md");
+ const removeIndex = allPage.filter((data) => data.id.match(/^(?!-)/));
const removeDrafts = removeIndex.filter((data) => !data.data.draft);
return removeDrafts;
};
diff --git a/src/pages/authors/index.astro b/src/pages/authors/index.astro
index 6df2d17..a1f11da 100755
--- a/src/pages/authors/index.astro
+++ b/src/pages/authors/index.astro
@@ -5,7 +5,7 @@ import { getSinglePage } from "@/lib/contentParser.astro";
import PageHeader from "@/partials/PageHeader.astro";
import { getEntryBySlug } from "astro:content";
-const authorIndex = await getEntryBySlug
("authors", "index");
+const authorIndex = await getEntryBySlug("authors", "-index");
const authors = await getSinglePage("authors");
---
diff --git a/src/pages/posts/index.astro b/src/pages/posts/index.astro
index 42c628e..552b1ff 100755
--- a/src/pages/posts/index.astro
+++ b/src/pages/posts/index.astro
@@ -11,7 +11,7 @@ import PostSidebar from "@/partials/PostSidebar.astro";
import { getEntryBySlug } from "astro:content";
const { blog_folder } = config.settings;
-const postIndex = await getEntryBySlug(blog_folder, "index");
+const postIndex = await getEntryBySlug(blog_folder, "-index");
const posts = await getSinglePage(blog_folder);
const allCategories = await getAllTaxonomy(blog_folder, "categories");
const categories = await getTaxonomy(blog_folder, "categories");
diff --git a/src/pages/posts/page/[slug].astro b/src/pages/posts/page/[slug].astro
index 4e5137c..b1ba33b 100755
--- a/src/pages/posts/page/[slug].astro
+++ b/src/pages/posts/page/[slug].astro
@@ -12,7 +12,7 @@ import { getEntryBySlug } from "astro:content";
const { blog_folder } = config.settings;
const { slug } = Astro.params;
-const postIndex = await getEntryBySlug(blog_folder, "index");
+const postIndex = await getEntryBySlug(blog_folder, "-index");
const posts = await getSinglePage(blog_folder);
const allCategories = await getAllTaxonomy(blog_folder, "categories");
const categories = await getTaxonomy(blog_folder, "categories");
diff --git a/src/styles/components.scss b/src/styles/components.scss
index 57cfb7f..7b83f91 100755
--- a/src/styles/components.scss
+++ b/src/styles/components.scss
@@ -118,10 +118,10 @@
.accordion {
@apply mb-6 overflow-hidden rounded-lg border border-border bg-theme-light dark:border-darkmode-border dark:bg-darkmode-theme-light;
&-header {
- @apply flex cursor-pointer items-center justify-between px-8 py-4 text-lg text-dark dark:bg-darkmode-theme-light dark:text-darkmode-light;
+ @apply flex w-full cursor-pointer items-center justify-between px-8 py-4 text-lg text-dark dark:bg-darkmode-theme-light dark:text-darkmode-light;
}
&-icon {
- @apply h-[.8em] w-[.8em] rotate-[-90deg] transition-transform duration-200;
+ @apply ml-auto h-[.8em] w-[.8em] rotate-[-90deg] transition-transform duration-200;
}
&-content {
@apply max-h-0 overflow-hidden px-8 py-0;