Skip to content

Commit 0d10106

Browse files
committed
resolve TS errors in Snippet
1 parent 9a3b163 commit 0d10106

File tree

1 file changed

+1
-3
lines changed
  • packages/react-code-blocks/src/components/Snippet

1 file changed

+1
-3
lines changed

packages/react-code-blocks/src/components/Snippet/Snippet.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ const SnippetWrapper = styled.div<
1919
style: any;
2020
}
2121
>`
22-
{
2322
position: relative;
2423
width: ${({ width }) => width};
2524
max-width: 100%;
@@ -29,7 +28,6 @@ const SnippetWrapper = styled.div<
2928
background-color: ${({ style }) => style.bgColor};
3029
border: 1px solid ${({ style }) => style.border};
3130
border-radius: 5px;
32-
}
3331
pre {
3432
margin: 0;
3533
padding: 0;
@@ -97,7 +95,7 @@ const Snippet: React.FC<React.PropsWithChildren<SnippetProps>> = ({
9795
const ref = useRef<HTMLPreElement>(null);
9896
const isMultiLine = text && Array.isArray(text);
9997
const theme = useContext(ThemeContext);
100-
const style = useMemo(() => getStyles(theme), [theme]);
98+
const style = useMemo(() => !!theme && getStyles(theme), [theme]);
10199
const showCopyIcon = useMemo(() => copyType !== 'prevent', [copyType]);
102100
const childText = useMemo<string | undefined | null>(() => {
103101
if (isMultiLine) return textArrayToString(text as string[]);

0 commit comments

Comments
 (0)