Skip to content

Commit

Permalink
fix: fix overflow style in preview
Browse files Browse the repository at this point in the history
  • Loading branch information
ambar committed Apr 26, 2024
1 parent 691d998 commit 055676d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 13 deletions.
3 changes: 3 additions & 0 deletions example/console-only.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
console.info(1)
}
22 changes: 22 additions & 0 deletions example/values.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Circular
let obj: Record<any, any> = {a: 1, obj: null}
obj.obj = obj
obj

// Date
new Date()

// RegExp
;/r/gi

// BigInt
3n

// Symbol
Symbol('foo')

// overflow test
'xy'.repeat(200)

// overflow test
console.info('xy'.repeat(200))
19 changes: 6 additions & 13 deletions src/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,10 @@ const App = () => {
<div
css={{
display: 'grid',
gridTemplateColumns: '1fr 1fr',
gridTemplateColumns: 'auto',
'&:has(>[data-console])': {
gridTemplateColumns: '1fr 1fr',
},
height: '100%',
fontFamily: 'var(--vscode-editor-font-family)',
fontSize: 'var(--vscode-editor-font-size)',
Expand All @@ -297,17 +300,6 @@ const App = () => {
background: inherit;
}
`}</style>
{/* <div>
<vscode-radio-group>
<label slot="label">Build Target</label>
<vscode-radio value="web" checked>
web
</vscode-radio>
<vscode-radio value="node">
node
</vscode-radio>
</vscode-radio-group>
</div> */}
<pre
css={{
width: '100%',
Expand All @@ -319,13 +311,14 @@ const App = () => {
boxSizing: 'border-box',
fontFamily: 'inherit',
fontSize: 'inherit',
overflowX: 'auto',
}}
>
{content}
</pre>
{/* TODO: filter console calls in preview, which returns `undefined` */}
{logs?.length > 0 && (
<StyledConsole logs={logs} shouldDecode={!isBrowser} />
<StyledConsole data-console logs={logs} shouldDecode={!isBrowser} />
)}
</div>
)
Expand Down

0 comments on commit 055676d

Please sign in to comment.