Files
DefectingCat.github.io/components/rua/rua-sandpack.tsx
DefectingCat c8f7e65f80 add slug page
2023-05-16 16:45:28 +08:00

25 lines
590 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);