Skip to content

Commit 40ab2f2

Browse files
authored
Merge pull request #25 from apecloud/bugfix/copy_code
fix: copy code
2 parents b2c6902 + c85c6ad commit 40ab2f2

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

src/app/[locale]/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export default async function RootLayout({
114114
<GitHub />
115115
</IconButton>
116116
<ThemeSwitcher />
117-
<LocaleSwitcher />
117+
{/* <LocaleSwitcher /> */}
118118
</Box>
119119
</Toolbar>
120120
</AppBar>

src/components/CodeWithCopyButton.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { JSX, useRef } from "react";
77

88
const StyledCode = styled("code")(() => {
99
return {
10-
position: "relative",
1110
".copy-to-clipboard": {
1211
display: "none",
1312
},
@@ -39,12 +38,13 @@ export default function CodeWithCopyButton(
3938
className="copy-to-clipboard"
4039
sx={{
4140
position: "absolute",
42-
right: 12,
43-
top: 12,
44-
padding: 1,
41+
right: 8,
42+
top: 8,
43+
padding: 0.8,
4544
minWidth: "auto",
4645
color: "rgba(255, 255, 255, 0.5)",
4746
borderColor: "rgba(255, 255, 255, 0.3)",
47+
background: "#1A1E22",
4848
borderWidth: 1,
4949
"&:hover": {
5050
borderColor: theme.palette.primary.main,

src/mdx-components.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ export function useMDXComponents(components: MDXComponents): MDXComponents {
5858
th: (props: JSX.IntrinsicElements["th"]) => (
5959
<TableCell>{props.children}</TableCell>
6060
),
61+
pre: (props: JSX.IntrinsicElements["pre"]) => (
62+
<pre style={{ position: 'relative' }}>{props.children}</pre>
63+
),
6164
code: (props: JSX.IntrinsicElements["code"]) => {
6265
const match = /language-(\w+)/.exec(props.className || "");
6366
if (match?.length) {

src/middleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { createI18nMiddleware } from "next-international/middleware";
44
import { NextRequest } from "next/server";
55

66
const I18nMiddleware = createI18nMiddleware({
7-
locales: ["en", "zh"],
7+
locales: ["en"], // ["en", "zh"],
88
defaultLocale: "en",
99
urlMappingStrategy: "rewriteDefault", // redirect | rewrite | rewriteDefault
1010
});

0 commit comments

Comments
 (0)