Skip to content

Commit

Permalink
Simplify by utilizing mdx component types
Browse files Browse the repository at this point in the history
  • Loading branch information
isoscelesxyz committed Sep 17, 2024
1 parent 31dd1c7 commit 777bb4a
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions content/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,34 @@
*/
import React from "react";

import { MDXProvider } from "@mdx-js/react";
import type { MDXComponents as MDXComponentsType } from "mdx/types";

type Components = Parameters<typeof MDXProvider>[0]["components"];

const MDXComponents: Components = {
h1: (props: React.HTMLAttributes<HTMLHeadingElement>) => (
const MDXComponents: MDXComponentsType = {
h1: (props) => (
<h1 className="mb-6 text-2xl text-gray-600 dark:text-gray-400" {...props} />
),
h2: (props: React.HTMLAttributes<HTMLHeadingElement>) => (
h2: (props) => (
<h2
className="mb-2 mt-6 text-xl text-gray-600 dark:text-gray-400"
{...props}
/>
),
h3: (props: React.HTMLAttributes<HTMLHeadingElement>) => (
h3: (props) => (
<h3
className="mb-2 mt-6 text-xl text-gray-600 dark:text-gray-400"
{...props}
/>
),
h4: (props: React.HTMLAttributes<HTMLHeadingElement>) => (
h4: (props) => (
<h4
className="mb-2 mt-6 text-xl text-gray-600 dark:text-gray-400"
{...props}
/>
),
p: (props: React.HTMLAttributes<HTMLParagraphElement>) => (
<p className="mb-4" {...props} />
),
ul: (props: React.HTMLAttributes<HTMLUListElement>) => (
<ul className="mb-8 list-inside list-disc" {...props} />
),
ol: (props: React.HTMLAttributes<HTMLOListElement>) => (
<ol className="mb-8 list-inside list-decimal" {...props} />
),
blockquote: (props: React.BlockquoteHTMLAttributes<HTMLQuoteElement>) => (
p: (props) => <p className="mb-4" {...props} />,
ul: (props) => <ul className="mb-8 list-inside list-disc" {...props} />,
ol: (props) => <ol className="mb-8 list-inside list-decimal" {...props} />,
blockquote: (props) => (
<blockquote
className="my-4 border-l italic opacity-70 pl-4 text-gray-600 dark:text-gray-400"
{...props}
Expand Down

0 comments on commit 777bb4a

Please sign in to comment.