mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
21 lines
500 B
TypeScript
21 lines
500 B
TypeScript
import "highlight.js/styles/a11y-dark.css";
|
|
import React, { FunctionComponent, ReactElement } from "react";
|
|
import Highlight from "react-highlight";
|
|
|
|
export interface ComponentProps {
|
|
code: string | ReactElement;
|
|
language: string;
|
|
}
|
|
|
|
const CodeBlock: FunctionComponent<ComponentProps> = (
|
|
props: ComponentProps,
|
|
): ReactElement => {
|
|
return (
|
|
<Highlight className={`p-3 language-${props.language} rounded-md shadow`}>
|
|
{props.code}
|
|
</Highlight>
|
|
);
|
|
};
|
|
|
|
export default CodeBlock;
|