Skip to content

Commit 9e97672

Browse files
authored
Merge pull request #117 from ibrahimcesar/claude/fix-layout-height-01LJMWBZkN4xPDunSJBnwP5R
Fix layout height and display issues
2 parents 5b88732 + 42457a6 commit 9e97672

1 file changed

Lines changed: 25 additions & 3 deletions

File tree

src/components/CodePlayground.js

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { useEffect } from 'react';
22
import { Sandpack } from "@codesandbox/sandpack-react";
33
import { useColorMode } from '@docusaurus/theme-common';
44

@@ -16,7 +16,7 @@ import { useColorMode } from '@docusaurus/theme-common';
1616
* @param {boolean} props.showLineNumbers - Mostrar números de linha (padrão: true)
1717
* @param {boolean} props.showConsole - Mostrar console (padrão: true)
1818
* @param {boolean} props.autorun - Executar automaticamente (padrão: true)
19-
* @param {number} props.height - Altura do editor (padrão: 400)
19+
* @param {number} props.height - Altura do editor (padrão: 300)
2020
*/
2121
export default function CodePlayground({
2222
code,
@@ -26,11 +26,33 @@ export default function CodePlayground({
2626
showLineNumbers = true,
2727
showConsole = true,
2828
autorun = true,
29-
height = 400,
29+
height = 300,
3030
}) {
3131
const { colorMode } = useColorMode();
3232
const theme = colorMode === 'dark' ? 'dark' : 'light';
3333

34+
// Suprimir mensagens de debug do Sandpack
35+
useEffect(() => {
36+
const originalLog = console.log;
37+
const suppressedMessages = [
38+
'Injecting file system access api patch',
39+
'Injecting element creation patch',
40+
'First element creation parent found'
41+
];
42+
43+
console.log = function(...args) {
44+
const message = args[0];
45+
if (typeof message === 'string' && suppressedMessages.some(msg => message.includes(msg))) {
46+
return; // Suprimir essas mensagens
47+
}
48+
originalLog.apply(console, args);
49+
};
50+
51+
return () => {
52+
console.log = originalLog; // Restaurar console.log original na limpeza
53+
};
54+
}, []);
55+
3456
// Construir estrutura de arquivos baseado nas props
3557
let sandpackFiles;
3658

0 commit comments

Comments
 (0)