Files
js/apps/dashboard/src/@/components/ui/code/code.server.tsx
T
MananTank ff188fd49d Replace prism+chakra Code component with shiki+tailwind (#5393)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on refactoring code related to code blocks in the UI by replacing the `CodeBlock` component with a new `CodeClient` component and introducing a `PlainTextCodeBlock` for plain text display. It also updates styles and dependencies.

### Detailed summary
- Removed `CodeBlock` component from various files.
- Introduced `CodeClient` component for enhanced code rendering.
- Added `PlainTextCodeBlock` for displaying plain text.
- Updated styles in `globals.css` for dark mode support.
- Added new utility functions for code formatting.
- Updated dependencies in `package.json` and `pnpm-lock.yaml`.

> The following files were skipped due to too many changes: `pnpm-lock.yaml`

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
2024-11-12 21:58:05 +00:00

19 lines
469 B
TypeScript

import type { BundledLanguage } from "shiki";
import { RenderCode } from "./RenderCode";
import { getCodeHtml } from "./getCodeHtml";
export type CodeProps = {
code: string;
lang: BundledLanguage;
className?: string;
};
export const CodeServer: React.FC<CodeProps> = async ({
code,
lang,
className,
}) => {
const { html, formattedCode } = await getCodeHtml(code, lang);
return <RenderCode code={formattedCode} html={html} className={className} />;
};