Skip to content

Commit

Permalink
Add FntColor and Highlight modules
Browse files Browse the repository at this point in the history
  • Loading branch information
CloneWith committed Aug 13, 2024
1 parent ee3ba02 commit d76583b
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/components/FntColor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from "react";

export default function FntColor({ children, color }) {
return (
<span
style={{
color: color,
}}
>
{children}
</span>
);
}
16 changes: 16 additions & 0 deletions src/components/Highlight.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from "react";

export default function Highlight({ children, color }) {
return (
<span
style={{
backgroundColor: color,
borderRadius: "2px",
color: "#fff",
padding: "0.2rem",
}}
>
{children}
</span>
);
}
14 changes: 14 additions & 0 deletions src/theme/MDXComponents.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from "react";
// Import the original mapper
import MDXComponents from "@theme-original/MDXComponents";
import Highlight from "@site/src/components/Highlight";
import FntColor from "@site/src/components/FntColor";

export default {
// Re-use the default mapping
...MDXComponents,
// Map the "<Highlight>" tag to our Highlight component
// `Highlight` will receive all props that were passed to `<Highlight>` in MDX
Highlight,
FntColor,
};

0 comments on commit d76583b

Please sign in to comment.