Skip to content

Commit 652f396

Browse files
authored
Fix: correct vertical alignment issue in schema example (#1297)
* fix[docs/learn]: correct vertical alignment issue in schema example * fix[docs/learn]: remove unused replace and restore font sizes post testing * fix[json-editor]: add horizontal scroll to json-editor
1 parent 6bec791 commit 652f396

File tree

2 files changed

+15
-24
lines changed

2 files changed

+15
-24
lines changed

components/JsonEditor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ export default function JsonEditor({ initialCode }: { initialCode: string }) {
333333
</div>
334334
</div>
335335
<Editable
336+
className='overflow-x-auto'
336337
data-test='json-editor'
337338
onCopy={(e) => {
338339
e.preventDefault();
@@ -377,7 +378,6 @@ export default function JsonEditor({ initialCode }: { initialCode: string }) {
377378
(jsonPathsWithJsonScope) => jsonPathsWithJsonScope.jsonPath,
378379
)
379380
.includes(leaf.syntaxPart?.parentJsonPath);
380-
// console.log('jsonPathsWithJsonScope', jsonPathsWithJsonScope, leaf, leaf.syntaxPart?.parentJsonPath)
381381
if (
382382
isJsonScope &&
383383
jsonSchemaReferences.objectProperty[leaf.text]
@@ -424,7 +424,7 @@ export default function JsonEditor({ initialCode }: { initialCode: string }) {
424424
if (!link) return;
425425
router.push(link);
426426
}}
427-
className={classnames('pb-2', textStyles)}
427+
className={classnames('pb-2', textStyles, 'whitespace-pre')}
428428
title={leaf.syntaxPart?.type}
429429
{...attributes}
430430
>

components/StyledMarkdown.tsx

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -307,34 +307,25 @@ const StyledMarkdownBlock = ({ markdown }: { markdown: string }) => {
307307
}
308308

309309
return (
310-
<div className='overflow-x-auto flex-basis-0 max-w-full min-w-0 shrink lg:max-w-[800px] xl:max-w-[900px]'>
311-
{/* definitely not the best way to prevent overflowing. found no better way that worked */}
310+
<div className='overflow-x-auto rounded-lg bg-gray-800 text-white'>
312311
<Highlight
313312
language={language}
314-
wrapLines={true}
315-
wrapLongLines={true}
316-
customStyle={{
317-
borderRadius: 10,
318-
paddingTop: 15,
319-
paddingBottom: 10,
320-
paddingLeft: 10,
321-
marginBottom: 20,
322-
maxWidth: '100%',
323-
}}
324-
lineNumberStyle={{
325-
marginRight: 10,
326-
}}
327313
style={atomOneDark}
328314
showLineNumbers
329-
startingLineNumber={1}
330-
lineProps={() => {
331-
const isHighlighted = false;
332-
return {
333-
className: `${isHighlighted ? 'bg-code-editor-dark-highlight block ml-10 w-full' : ''} pr-8`,
334-
};
315+
lineNumberStyle={{
316+
color: '#64748B',
317+
fontSize: '16px',
318+
paddingRight: '10px',
319+
}}
320+
customStyle={{
321+
padding: '12px',
322+
fontFamily: 'monospace',
323+
fontSize: '16px',
335324
}}
336325
codeTagProps={{
337-
className: 'mr-8',
326+
style: {
327+
fontFamily: 'monospace',
328+
},
338329
}}
339330
>
340331
{code}

0 commit comments

Comments
 (0)