diff --git a/src/components/Playground/CodeEditor/FileSelector/index.tsx b/src/components/Playground/CodeEditor/FileSelector/index.tsx index aa2cb62..b86cb55 100644 --- a/src/components/Playground/CodeEditor/FileSelector/index.tsx +++ b/src/components/Playground/CodeEditor/FileSelector/index.tsx @@ -110,6 +110,10 @@ const FileSelector = ({ } const handleOnValidateTab = (newFileName: string, oldFileName: string) => { + if (newFileName.length > 40) { + onError?.('File name is too long, maximum 40 characters.') + } + if (!/\.(jsx|tsx|js|ts|css|json)$/.test(newFileName)) { onError?.('Playground only supports *.jsx, *.tsx, *.js, *.ts, *.css, *.json files.') @@ -219,4 +223,6 @@ const FileSelector = ({ ) } +FileSelector.Item = Item + export default FileSelector diff --git a/src/components/Playground/CodeEditor/index.tsx b/src/components/Playground/CodeEditor/index.tsx index 938aa66..b2d70d6 100644 --- a/src/components/Playground/CodeEditor/index.tsx +++ b/src/components/Playground/CodeEditor/index.tsx @@ -160,4 +160,7 @@ const CodeEditor = ({ ) } +CodeEditor.Editor = Editor +CodeEditor.FileSelector = FileSelector + export default CodeEditor diff --git a/src/components/Playground/Output/Preview/Render.tsx b/src/components/Playground/Output/Preview/Render.tsx index 940a80f..62464d2 100644 --- a/src/components/Playground/Output/Preview/Render.tsx +++ b/src/components/Playground/Output/Preview/Render.tsx @@ -1,3 +1,4 @@ +import '@/components/Playground/Output/Preview/render.scss' import iframeRaw from '@/components/Playground/Output/Preview/iframe.html?raw' interface RenderProps { @@ -66,6 +67,7 @@ const Render = ({ iframeKey, compiledCode, onError }: RenderProps) => { return (