Break words in the inlineCode component
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Aditya Thakral 2021-08-24 11:51:15 -04:00
parent 9f547ab299
commit 96fa48f356
4 changed files with 24 additions and 2 deletions

View File

@ -0,0 +1,6 @@
.code {
padding: 0 calc(4rem / 16);
background: var(--code-background);
border-radius: calc(5rem / 16);
word-wrap: break-word;
}

9
components/Code.tsx Normal file
View File

@ -0,0 +1,9 @@
import React, { HTMLAttributes } from "react";
import styles from "./Code.module.css";
export function Code(props: HTMLAttributes<HTMLElement>) {
const classes = [styles.code, props.className ?? ""];
return <code {...props} className={classes.join(" ")} />;
}

View File

@ -1,6 +1,6 @@
.pre {
padding: calc(10rem / 16);
background: var(--input-background);
background: var(--code-background);
overflow-x: auto;
border-radius: calc(5rem / 16);
}

View File

@ -4,6 +4,7 @@ import { AppProps as DefaultAppProps } from "next/app";
import React, { ComponentType, ReactNode } from "react";
import { Button } from "@/components/Button";
import { Code } from "@/components/Code";
import { DefaultLayout } from "@/components/DefaultLayout";
import { Footer } from "@/components/Footer";
import { HorizontalLine } from "@/components/HorizontalLine";
@ -23,7 +24,13 @@ export default function App({ Component, pageProps }: AppProps): JSX.Element {
return (
<ThemeProvider>
<MDXProvider
components={{ a: Link, hr: HorizontalLine, button: Button, pre: Pre }}
components={{
a: Link,
hr: HorizontalLine,
button: Button,
pre: Pre,
inlineCode: Code,
}}
>
<div className={styles.appContainer}>
<Navbar />