diff --git a/components/CodeBlock/CodeBlock.module.css b/components/CodeBlock/CodeBlock.module.css
index aadcb7de..c4b711b7 100644
--- a/components/CodeBlock/CodeBlock.module.css
+++ b/components/CodeBlock/CodeBlock.module.css
@@ -1,6 +1,7 @@
/* all code */
.code {
font-size: 0.925em;
+ tab-size: 2;
page-break-inside: avoid;
border: 1px solid var(--kinda-light);
}
@@ -16,13 +17,26 @@
margin: 1em auto;
}
+.block .copy_btn {
+ position: absolute;
+ top: 0;
+ right: 0;
+ padding: 0.65em;
+ color: var(--medium-dark);
+ background-color: var(--background-inner);
+ border: 1px solid var(--kinda-light);
+}
+
+.block .copy_btn:hover {
+ color: var(--link);
+}
+
/* the following sub-classes MUST be global -- the highlight rehype plugin isn't aware of this file */
.block :global(.code-highlight) {
display: block;
overflow-x: auto;
padding: 1em;
- tab-size: 2;
color: var(--code-text);
background-color: var(--code-background);
}
diff --git a/components/CodeBlock/CodeBlock.tsx b/components/CodeBlock/CodeBlock.tsx
index ea86f1f7..ea441578 100644
--- a/components/CodeBlock/CodeBlock.tsx
+++ b/components/CodeBlock/CodeBlock.tsx
@@ -1,3 +1,4 @@
+import classNames from "classnames";
import CopyButton from "../CopyButton/CopyButton";
import type { ReactNode } from "react";
@@ -13,15 +14,15 @@ const CodeBlock = (props: Props) => {
// full multi-line code blocks with prism highlighting and copy-to-clipboard button
return (
-
-
+
+
{props.children}
);
} else {
// inline code in paragraphs, headings, etc. (not highlighted)
- return {props.children}
;
+ return {props.children}
;
}
};
diff --git a/components/ContactForm/ContactForm.tsx b/components/ContactForm/ContactForm.tsx
index 990eba4b..8c68c59a 100644
--- a/components/ContactForm/ContactForm.tsx
+++ b/components/ContactForm/ContactForm.tsx
@@ -160,7 +160,7 @@ const ContactForm = () => {
Sending...
) : (
<>
- Send
+ Send
>
)}
diff --git a/components/CopyButton/CopyButton.module.css b/components/CopyButton/CopyButton.module.css
index a0617595..56a420fe 100644
--- a/components/CopyButton/CopyButton.module.css
+++ b/components/CopyButton/CopyButton.module.css
@@ -1,19 +1,8 @@
.copy {
- position: absolute;
- top: 0;
- right: 0;
- padding: 0.65em;
line-height: 1;
- color: var(--medium-dark);
- background-color: var(--background-inner);
- border: 1px solid var(--kinda-light);
cursor: pointer;
}
-.copy:hover {
- color: var(--link);
-}
-
.success {
color: var(--success) !important;
}
diff --git a/components/CopyButton/CopyButton.tsx b/components/CopyButton/CopyButton.tsx
index 600e37c4..749d36ec 100644
--- a/components/CopyButton/CopyButton.tsx
+++ b/components/CopyButton/CopyButton.tsx
@@ -11,9 +11,10 @@ const cx = classNames.bind(styles);
type Props = {
source: ReactNode;
timeout?: number;
+ className?: string;
};
-const CopyButton = ({ source, timeout = 2000 }: Props) => {
+const CopyButton = ({ source, timeout = 2000, className }: Props) => {
const [copied, setCopied] = useState(false);
const handleCopy = (e) => {
@@ -43,7 +44,7 @@ const CopyButton = ({ source, timeout = 2000 }: Props) => {
return (