File tree 3 files changed +12
-7
lines changed
packages/docs/src/app/(pages)/_landing
3 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ export function Demo() {
24
24
onChange = { e => setHello ( e . target . value || null ) }
25
25
data-interacted = { Boolean ( hello ) }
26
26
/>
27
- < p > Hello, { hello || 'anonymous visitor' } !</ p >
27
+ < p className = "break-all" > Hello, { hello || 'anonymous visitor' } !</ p >
28
28
</ >
29
29
)
30
30
}
Original file line number Diff line number Diff line change @@ -25,7 +25,9 @@ export function Demo() {
25
25
onChange = { e => setHello ( e . target . value || null ) }
26
26
data-interacted = { Boolean ( hello ) }
27
27
/>
28
- < p > Hello, { hello || 'anonymous visitor' } !</ p >
28
+ < p className = "sm:overflow-x-auto sm:text-ellipsis sm:text-nowrap" >
29
+ Hello, { hello || 'anonymous visitor' } !
30
+ </ p >
29
31
</ >
30
32
)
31
33
}
Original file line number Diff line number Diff line change 1
1
import { CodeBlock } from '@/src/components/code-block'
2
2
import fs from 'node:fs/promises'
3
+ import { format } from 'prettier'
3
4
import { Suspense } from 'react'
4
5
import { Demo } from './demo.client'
5
6
6
7
export async function LandingDemo ( ) {
7
8
const demoFilePath =
8
9
process . cwd ( ) + '/src/app/(pages)/_landing/demo.client.tsx'
9
10
const demoFile = await fs . readFile ( demoFilePath , 'utf8' )
11
+ // Poor man's AST manipulation
10
12
const demoCode = demoFile
13
+ . replace ( / c l a s s N a m e = " .+ " / g, '' ) // Strip styling
11
14
. split ( '\n' )
12
- . filter (
13
- line =>
14
- ! line . includes ( 'className="' ) && ! line . includes ( 'data-interacted=' )
15
- )
15
+ . filter ( line => ! line . includes ( 'data-interacted=' ) )
16
16
. join ( '\n' )
17
+ const formattedCode = await format ( demoCode , {
18
+ parser : 'typescript'
19
+ } )
17
20
return (
18
21
< >
19
22
< Suspense
@@ -26,7 +29,7 @@ export async function LandingDemo() {
26
29
< LookAtTheURL />
27
30
</ div >
28
31
</ Suspense >
29
- < CodeBlock code = { demoCode } />
32
+ < CodeBlock code = { formattedCode } />
30
33
</ >
31
34
)
32
35
}
You can’t perform that action at this time.
0 commit comments