1
0
mirror of https://github.com/kubeshark/kubeshark.git synced 2025-04-30 21:06:10 +00:00
kubeshark/ui/src/components/UI/SyntaxHighlighter/index.tsx
lirazyehezkel f74a52d4dc
UI Infra - Support multiple entry types + refactoring ()
* no message

* change local api path

* generic entry list item + rename files and vars

* entry detailed generic

* fix api file

* clean warnings

* switch

* empty lines

* fix scroll to end feature

Co-authored-by: Roee Gadot <roee.gadot@up9.com>
2021-08-15 12:09:56 +03:00

31 lines
1.1 KiB
TypeScript

import React from 'react';
import {Prism as SyntaxHighlighterContainer} from 'react-syntax-highlighter';
import {highlighterStyle} from './highlighterStyle'
import './index.scss';
interface Props {
code: string;
style?: any;
showLineNumbers?: boolean;
className?: string;
language?: string;
isWrapped?: boolean;
}
export const SyntaxHighlighter: React.FC<Props> = ({
code,
style = highlighterStyle,
showLineNumbers = true,
className,
language = 'python',
isWrapped = false,
}) => {
return <div className={`highlighterContainer ${className ? className : ''} ${isWrapped ? 'wrapped' : ''}`}>
<SyntaxHighlighterContainer language={language} style={style} showLineNumbers={showLineNumbers}>
{code ?? ""}
</SyntaxHighlighterContainer>
</div>;
};
export default SyntaxHighlighter;