Skip to content

Commit

Permalink
chore: remove passed theme to hook
Browse files Browse the repository at this point in the history
  • Loading branch information
AVGVSTVS96 committed Aug 19, 2024
1 parent ea96483 commit 6026d7f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/components/ChatUI/ShikiHihlighter.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
import type React from 'react';
import { useShikiHighlighter } from '@hooks/useShiki';
import type { BundledTheme, BundledLanguage } from 'shiki';
import type { BundledLanguage } from 'shiki';

interface ShikiHighlighterProps {
language: BundledLanguage;
children: string;
theme?: BundledTheme;
as?: React.ElementType;
}

export const ShikiHighlighter = ({
language,
theme,
children: code,
as: Element = 'pre',
}: ShikiHighlighterProps) => {
const highlightedCode = useShikiHighlighter(code, language, theme as BundledTheme);
const highlightedCode = useShikiHighlighter(code, language);

return highlightedCode && (
<Element className="shiki not-prose relative [&_pre]:overflow-auto [&_pre]:rounded-lg [&_pre]:px-6 [&_pre]:py-5">
Expand Down
1 change: 0 additions & 1 deletion src/lib/hooks/useShiki.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import customTheme from '@styles/rainglow-azure-constrast.mjs';
export const useShikiHighlighter = (
code: string,
lang: BundledLanguage | undefined,
theme: BundledTheme
) => {
const [highlightedCode, setHighlightedCode] = useState<ReactNode | null>(
null
Expand Down

0 comments on commit 6026d7f

Please sign in to comment.