Skip to content

Commit edaa3aa

Browse files
viankakrisnaCompuIves
authored andcommitted
Improve formatting of string arguments in integrated console (codesandbox#298)
* Add `white-space: pre-wrap` to Messages style * Update my profile url * [console] concat all arguments with if all arguments is string
1 parent cbc45bd commit edaa3aa

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

.all-contributorsrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"login": "viankakrisna",
6868
"name": "Ade Viankakrisna Fadlil",
6969
"avatar_url": "https://avatars1.githubusercontent.com/u/9636410?v=4",
70-
"profile": "https://musify.id",
70+
"profile": "https://github.com/viankakrisna",
7171
"contributions": [
7272
"code"
7373
]

packages/app/src/app/components/sandbox/Preview/DevTools/Console/Message.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ function getMessage(message: IMessage) {
133133
);
134134
}
135135

136+
if (message.arguments.every(argument => typeof argument === 'string')) {
137+
return <InnerItem>{message.arguments.join(' ')}</InnerItem>;
138+
}
139+
136140
return message.arguments.map((m, i) => (
137141
// eslint-disable-next-line react/no-array-index-key
138142
<InnerItem key={i}>

packages/app/src/app/components/sandbox/Preview/DevTools/Console/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const Messages = styled.div`
2323
height: 100%;
2424
overflow-y: auto;
2525
overflow-x: hidden;
26+
white-space: pre-wrap;
2627
`;
2728

2829
export type IMessage = {

0 commit comments

Comments
 (0)