diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..897ad57a --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,13 @@ +{ + "recommendations": [ + "editorconfig.editorconfig", + "dbaeumer.vscode-eslint", + "github.vscode-github-actions", + "unifiedjs.vscode-mdx", + "esbenp.prettier-vscode", + "bradlc.vscode-tailwindcss", + "graphql.vscode-graphql-syntax", + "graphql.vscode-graphql", + "streetsidesoftware.code-spell-checker" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 9aa2a658..0356f6f0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -11,5 +11,23 @@ "stylesheet", "tailwindcss" ], - "eslint.useFlatConfig": true + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.fixAll.eslint": "explicit" + }, + "eslint.run": "onSave", + "eslint.useFlatConfig": true, + "eslint.codeActionsOnSave.mode": "problems", + "[javascript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[javascriptreact]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[mdx]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[json]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + } } diff --git a/mdx-components.jsx b/mdx-components.jsx index 0eaa56fe..49bb0b63 100644 --- a/mdx-components.jsx +++ b/mdx-components.jsx @@ -1,26 +1,8 @@ -import slugify from "@sindresorhus/slugify"; import Image from "next/image"; import DocsLayout from "@/components/docs-layout"; +import Heading from "@/components/heading"; import CustomLink from "@/components/link"; -// Custom heading component with clickable anchor links -const Heading = ({ level, children, ...props }) => { - const Tag = `h${level}`; - // Ensure children are treated as a single string for slug generation - const textContent = Array.isArray(children) - ? children.join("") // Join array items if children is an array - : children?.toString() || ""; // Convert children to string or fallback to empty - const id = slugify(textContent); // Generate slug from heading text - - return ( - - - {children} - - - ); -}; - export function useMDXComponents(components) { return { img: ({ src }, ...props) => ( diff --git a/src/components/heading.jsx b/src/components/heading.jsx new file mode 100644 index 00000000..c49e2b0b --- /dev/null +++ b/src/components/heading.jsx @@ -0,0 +1,24 @@ +import { LinkIcon } from "@heroicons/react/24/outline"; +import Link from "./link"; + +// Custom heading component with clickable anchor links +export default function Heading({ level, children, id, ...props }) { + const Tag = `h${level}`; + console.log("props", props); + return ( + + + {children} + + + + ); +} diff --git a/src/components/layout.jsx b/src/components/layout.jsx index c349d53b..e0f58765 100644 --- a/src/components/layout.jsx +++ b/src/components/layout.jsx @@ -10,7 +10,9 @@ const inter = localFont({ export default function Layout({ children }) { return ( -
+
{children}