1
1
import React from "react"
2
+ import { Code as Index1 } from "./twoslash/generated/IndexGetStarted1.js"
3
+ import { Code as Index2 } from "./twoslash/generated/IndexGetStarted2.js"
4
+ import { Code as Index3 } from "./twoslash/generated/IndexGetStarted3.js"
5
+ import { Code as Index4 } from "./twoslash/generated/IndexGetStarted4"
2
6
3
7
type StepProps = {
4
8
i : ( str : any ) => string
5
9
}
6
10
7
- const one = `
8
- function compact(arr) {
9
- if (orr.length > 10)
10
- return arr.trim(0, 10)
11
- return arr
12
- }` . trim ( )
13
-
14
- const two = `
15
- // @ts-check
16
-
17
- function compact(arr) {
18
- if (orr.length > 10)
19
- return arr.trim(0, 10)
20
- return arr
21
- }` . trim ( )
22
-
23
- const three = `
24
- // @ts-check
25
-
26
- /** @param {any[]} arr */
27
- function compact(arr) {
28
- if (arr.length > 10)
29
- return arr.trim(0, 10)
30
- return arr
31
- }` . trim ( )
32
-
33
- const four = `
34
- function compact(arr: string[]) {
35
- if (arr.length > 10)
36
- return arr.slice(0, 10)
37
- return arr
38
- }` . trim ( )
39
-
40
11
const Stepper = ( props : { index : number } ) => {
41
12
return < div className = "adopt-step-stepper" >
42
13
< div className = { "first" + ( props . index === 0 ? " yellow" : "" ) } > </ div >
@@ -50,7 +21,7 @@ const Stepper = (props: { index: number }) => {
50
21
export const StepOne = ( props : StepProps ) => {
51
22
return (
52
23
< div className = "adopt-step" >
53
- < pre > < code > { one } </ code > </ pre >
24
+ < Index1 / >
54
25
< p > JavaScript File</ p >
55
26
< Stepper index = { 0 } />
56
27
</ div >
@@ -60,7 +31,7 @@ export const StepOne = (props: StepProps) => {
60
31
export const StepTwo = ( props : StepProps ) => {
61
32
return (
62
33
< div className = "adopt-step" >
63
- < pre > < code > { one } </ code > </ pre >
34
+ < Index2 / >
64
35
< p > JavaScript with TS Check</ p >
65
36
< Stepper index = { 1 } />
66
37
</ div >
@@ -70,7 +41,7 @@ export const StepTwo = (props: StepProps) => {
70
41
export const StepThree = ( props : StepProps ) => {
71
42
return (
72
43
< div className = "adopt-step" >
73
- < pre > < code > { one } </ code > </ pre >
44
+ < Index3 / >
74
45
< p > JavaScript with JSDoc</ p >
75
46
< Stepper index = { 2 } />
76
47
</ div >
@@ -80,7 +51,7 @@ export const StepThree = (props: StepProps) => {
80
51
export const StepFour = ( props : StepProps ) => {
81
52
return (
82
53
< div className = "adopt-step" >
83
- < pre > < code > { one } </ code > </ pre >
54
+ < Index4 / >
84
55
< p > TypeScript File</ p >
85
56
< Stepper index = { 3 } />
86
57
</ div >
0 commit comments