Skip to content

Commit

Permalink
✨ Pretty Printing HTML in console.logs.
Browse files Browse the repository at this point in the history
💄 Uses `pre` to prettify logs in `console-panel/index.tsx`
💄 Change Log fonts to monospace
🚨 Add index as a key to `map` function in `console-panel/index`
  • Loading branch information
rahulakrishna committed Oct 29, 2019
1 parent 0e97274 commit e71c849
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ui/test-file/console-panel/index.tsx
Expand Up @@ -19,12 +19,13 @@ const Header = styled.div`
margin-bottom: 5px;
`;

const Content = styled.div`
const Content = styled.pre`
display: flex;
margin-bottom: 3px;
font-size: 12px;
border-radius: 3px;
padding: 4px;
font-family: monospace;
`;

const Logs = styled.div`
Expand Down Expand Up @@ -65,7 +66,7 @@ export default function ConsolePanel({ consoleLogs }: Props) {
<Container>
<Header>Console logs from the file</Header>
<Logs>
{consoleLogs.map(log => {
{consoleLogs.map((log, index) => {
let result = log.message;
try {
result = eval("(" + log.message + ")");
Expand All @@ -75,7 +76,7 @@ export default function ConsolePanel({ consoleLogs }: Props) {

if (typeof result === "string") {
return (
<Content>
<Content key={index}>
{getIcon(log.type)}
{result}
</Content>
Expand Down

0 comments on commit e71c849

Please sign in to comment.