Files
DefectingCat.github.io/components/rua/rua-sandpack.tsx
DefectingCat b19914b68a format code
remove end of line
2023-05-17 14:58:22 +08:00

26 lines
591 B
TypeScript

'use client';
import { Sandpack, SandpackProps } from '@codesandbox/sandpack-react';
import { useTheme } from 'next-themes';
import { memo } from 'react';
interface Props extends SandpackProps {}
const RUASandpack = ({ ...rest }: Props) => {
const { systemTheme, theme } = useTheme();
const currentTheme = theme === 'system' ? systemTheme : theme;
return (
<>
<div className="my-2 min-h-[402px]">
<Sandpack
{...rest}
theme={currentTheme === 'dark' ? 'dark' : 'light'}
/>
</div>
</>
);
};
export default memo(RUASandpack);