Adding Code snippet.

This commit is contained in:
charles-gauthereau
2024-11-11 20:19:42 +01:00
parent d24433b3c2
commit 95f6af33ae
4 changed files with 17 additions and 15 deletions
@@ -0,0 +1,17 @@
import {PropsWithChildren} from "react";
export type CodeSnippetProps = PropsWithChildren<{}>;
export const CodeSnippet = (props: CodeSnippetProps) => {
return (
<div className="prose prose-invert">
<pre className="bg-[#1e1e1e] rounded-md p-4">
<code className="language-javascript text-[#d4d4d4]">{`
${props.children}
`}</code>
</pre>
</div>
)
}
@@ -23,9 +23,6 @@ export const LoggedInDropdown = (props: LoggedInDropdownProps) => {
}}>
<span>Account</span>
</DropdownMenuItem>
<DropdownMenuItem>
<span>Billing</span>
</DropdownMenuItem>
<DropdownMenuItem onClick={() => {
signOutAction()
}}>
-7
View File
@@ -18,20 +18,14 @@ export const uploadImageAction = userAction
const fileName = uuid + "." + fileFormat
const arrayBuffer = await file.arrayBuffer()
const buffer = Buffer.from(arrayBuffer)
const localDir = "public/uploads/"
try {
await mkdir(path.join(process.cwd(), localDir), { recursive: true });
const result = await writeFile(
path.join(process.cwd(), localDir + fileName),
buffer
);
let url: string = "";
if (env.NODE_ENV === "production") {
// url = `https://${env.S3_ENDPOINT}/${bucketName}/${fileName}`
} else {
@@ -40,7 +34,6 @@ export const uploadImageAction = userAction
return {
data: {result: result, url: url},
}
} catch (error) {
console.log("Error occured ", error);
throw new Error('An error occured while importing image');