diff --git a/src/components/global/Playground/index.tsx b/src/components/global/Playground/index.tsx index ac740322ebb..40875fde123 100644 --- a/src/components/global/Playground/index.tsx +++ b/src/components/global/Playground/index.tsx @@ -162,7 +162,7 @@ export default function Playground({ const codeRef = useRef(null); const frameiOS = useRef(null); const frameMD = useRef(null); - const consoleRef = useRef(null); + const consoleBodyRef = useRef(null); const defaultMode = typeof mode !== 'undefined' ? mode : Mode.iOS; @@ -269,14 +269,14 @@ export default function Playground({ if (frameiOS.current) { frameiOS.current.contentWindow.addEventListener('console', (ev: CustomEvent) => { setiOSConsoleItems((oldConsoleItems) => [...oldConsoleItems, ev.detail]); - consoleRef.current.scrollTo(0, consoleRef.current.scrollHeight); + consoleBodyRef.current.scrollTo(0, consoleBodyRef.current.scrollHeight); }); } if (frameMD.current) { frameMD.current.contentWindow.addEventListener('console', (ev: CustomEvent) => { setMDConsoleItems((oldConsoleItems) => [...oldConsoleItems, ev.detail]); - consoleRef.current.scrollTo(0, consoleRef.current.scrollHeight); + consoleBodyRef.current.scrollTo(0, consoleBodyRef.current.scrollHeight); }); } } @@ -470,15 +470,20 @@ export default function Playground({ function renderConsole() { return ( -
- {(ionicMode === Mode.iOS ? iosConsoleItems : mdConsoleItems).map((consoleItem, i) => ( -
- {consoleItem.type !== 'log' && ( -
{consoleItem.type === 'warning' ? '⚠' : '❌'}
- )} - {consoleItem.message} -
- ))} +
+
+ Console +
+
+ {(ionicMode === Mode.iOS ? iosConsoleItems : mdConsoleItems).map((consoleItem, i) => ( +
+ {consoleItem.type !== 'log' && ( +
{consoleItem.type === 'warning' ? '⚠' : '❌'}
+ )} + {consoleItem.message} +
+ ))} +
); } diff --git a/src/components/global/Playground/playground.css b/src/components/global/Playground/playground.css index 76e37db6954..2e424068652 100644 --- a/src/components/global/Playground/playground.css +++ b/src/components/global/Playground/playground.css @@ -247,6 +247,16 @@ border-top: 0; border-bottom-left-radius: var(--ifm-code-border-radius); border-bottom-right-radius: var(--ifm-code-border-radius); +} + +.playground__console-header { + background-color: var(--playground-separator-color); + font-weight: bold; + padding: 3px 3px 3px 28px; + text-transform: uppercase; +} + +.playground__console-body { overflow-y: auto; height: 120px; @@ -297,7 +307,7 @@ left: 3px; } -.playground__console-item code { +.playground__console code { background-color: transparent; padding: 0; padding-block-start: 0; /* prevents text getting cut off vertically */