Skip to content

Commit 7096d9e

Browse files
refactor: move title to main file
1 parent 7aa05a5 commit 7096d9e

2 files changed

Lines changed: 22 additions & 19 deletions

File tree

source/app.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { Box } from 'ink'
2+
import BigText from 'ink-big-text'
3+
import Gradient from 'ink-gradient'
24
import React, { useState } from 'react'
35
import Step1 from './import/Step1.js'
46
import Step2 from './import/Step2.js'
@@ -11,11 +13,22 @@ const App = () => {
1113

1214
const finishStep = () => setCurrentStep(currentStep + 1)
1315

16+
const onSelect = (value: string) => {
17+
console.log(value)
18+
}
19+
1420
return (
1521
<Box
1622
flexDirection={'column'}
1723
rowGap={1}
1824
>
25+
<Gradient colors={['#ff438c', '#bb1d79', '#8b46a4', '#6a2581']}>
26+
<BigText
27+
lineHeight={1}
28+
font={'chrome'}
29+
text="dAppBooster"
30+
/>
31+
</Gradient>
1932
<Step1
2033
onSubmit={setProjectName}
2134
onCompletion={finishStep}
@@ -29,8 +42,9 @@ const App = () => {
2942
)}
3043
{canShowStep(currentStep, 3) && (
3144
<Step3
32-
projectName={projectName}
3345
onCompletion={finishStep}
46+
onSelect={onSelect}
47+
projectName={projectName}
3448
/>
3549
)}
3650
</Box>

source/import/Step1.tsx

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import BigText from 'ink-big-text'
2-
import Gradient from 'ink-gradient'
31
import React, { type FC, useMemo, useCallback } from 'react'
42
import Ask from './Ask.js'
53
import { isValidName } from './utils.js'
@@ -31,22 +29,13 @@ const Step1: FC<Props> = ({ projectName, onSubmit, onCompletion }) => {
3129
)
3230

3331
return (
34-
<>
35-
<Gradient colors={['#ff438c', '#bb1d79', '#8b46a4', '#6a2581']}>
36-
<BigText
37-
lineHeight={1}
38-
font={'chrome'}
39-
text="dAppBooster"
40-
/>
41-
</Gradient>
42-
<Ask
43-
answer={projectName}
44-
errorMessage={errorMessage}
45-
onSubmit={handleSubmit}
46-
question={'Project name?'}
47-
tip={'Letters (a–z, A–Z), numbers (0–9), and underscores (_) are allowed.'}
48-
/>
49-
</>
32+
<Ask
33+
answer={projectName}
34+
errorMessage={errorMessage}
35+
onSubmit={handleSubmit}
36+
question={'Project name?'}
37+
tip={'Letters (a–z, A–Z), numbers (0–9), and underscores (_) are allowed.'}
38+
/>
5039
)
5140
}
5241

0 commit comments

Comments
 (0)