-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
78 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import env from '@/env'; | ||
import path from 'path'; | ||
|
||
interface CodeLinkProps { | ||
filePath: string; | ||
lineNumber?: number; | ||
} | ||
|
||
const CodeLink = ({ filePath, lineNumber = 1 }: CodeLinkProps) => { | ||
// Check if running on server | ||
if (typeof window !== 'undefined') { | ||
console.error('CodeLink component is only supported on server'); | ||
return null; | ||
} | ||
|
||
let url = ''; | ||
const isDev = env.NODE_ENV === 'development'; | ||
if (isDev) { | ||
const projectRoot = process.cwd(); | ||
const absolutePath = path.join(projectRoot, filePath); | ||
url = `vscode://file/${absolutePath}:${lineNumber}`; | ||
} else { | ||
url = `https://github.com/zerodays/nextjs-template/tree/master/${filePath}`; | ||
} | ||
const fileName = filePath.split('/').pop(); | ||
|
||
return ( | ||
<span className="mx-1 rounded-lg bg-foreground px-2 text-sm font-semibold text-background transition-colors hover:bg-foreground/70"> | ||
<a | ||
target={!isDev ? '_blank' : undefined} | ||
href={url} | ||
rel="noopener noreferrer"> | ||
{fileName} | ||
</a> | ||
</span> | ||
); | ||
}; | ||
|
||
export default CodeLink; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import Markdown from 'react-markdown'; | ||
import remarkGfm from 'remark-gfm'; | ||
|
||
interface MarkdownDisplayProps { | ||
content: string; | ||
} | ||
const MarkdownDisplay = ({ content }: MarkdownDisplayProps) => { | ||
return ( | ||
<Markdown | ||
className="prose prose-zinc dark:prose-invert min-w-full" | ||
remarkPlugins={[remarkGfm]}> | ||
{content} | ||
</Markdown> | ||
); | ||
}; | ||
|
||
export default MarkdownDisplay; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export { default as FormExample } from './form-example'; | ||
export { default as SentryExample } from './sentry-example'; | ||
export { default as ToastExample } from './toast-example'; | ||
export { default as ZodiosClientExample } from './zodios-client-example'; | ||
export { default as ZodiosServerExample } from './zodios-server-example'; |