1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-21 05:21:17 -04:00

even more styled components

This commit is contained in:
2022-01-20 08:26:30 -05:00
parent 171bdd65b6
commit 0462428a54
20 changed files with 332 additions and 221 deletions

View File

@@ -3,7 +3,7 @@ import type { ReactNode } from "react";
import styles from "./CodeBlock.module.css";
export type Props = {
type Props = {
className?: string;
children: ReactNode;
};
@@ -12,14 +12,16 @@ const CodeBlock = (props: Props) => {
if (props.className?.split(" ").includes("code-highlight")) {
// full multi-line code blocks with prism highlighting and copy-to-clipboard button
return (
<div className={styles.code}>
<div className={styles.block}>
<CopyButton source={props.children} />
<code {...props}>{props.children}</code>
<code {...props} className={`${styles.code} ${props.className}`}>
{props.children}
</code>
</div>
);
} else {
// inline code in paragraphs, headings, etc. (not highlighted)
return <code {...props}>{props.children}</code>;
return <code className={`${styles.code} ${styles.inline}`}>{props.children}</code>;
}
};