File tree 2 files changed +15
-1
lines changed
2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 41
41
42
42
}
43
43
44
+ .output-formmating {
45
+ white-space : pre-wrap;
46
+
47
+ }
Original file line number Diff line number Diff line change @@ -12,12 +12,20 @@ import RunCode from './run.png'
12
12
import ResetCode from './reset.png'
13
13
import InputBox from './InputBox' ;
14
14
15
+
16
+ function NewlineText ( props ) {
17
+ const text = props . text ;
18
+ return < div className = 'output-formmating' > { text } </ div > ;
19
+ }
20
+
21
+
15
22
function App ( ) {
16
23
const [ text , setText ] = useState ( '' ) //State to store editor code
17
24
const [ output , setOutput ] = useState ( '' ) //State to store output
18
25
const [ isLoading , setIsLoading ] = useState ( false ) ; //Loading animations
19
26
const [ input , setInput ] = useState ( '' )
20
27
28
+
21
29
const handleInputChange = ( e ) => {
22
30
e . preventDefault ( ) ; // prevent the default action
23
31
setInput ( e . target . value ) ; // set name to e.target.value (event)
@@ -78,12 +86,14 @@ function App() {
78
86
< Card . Body >
79
87
80
88
< Card . Text >
89
+ { /* Spinning Animation While Request is processed */ }
81
90
{ isLoading ? < p className = 'loading' > < Spinner animation = "border" size = "sm" /> </ p > : null }
82
- { output }
91
+ < NewlineText text = { output } />
83
92
</ Card . Text >
84
93
85
94
</ Card . Body >
86
95
</ Card >
96
+ { /* Input Box to provide input for program */ }
87
97
< InputBox value = { input } onChange = { handleInputChange } />
88
98
</ div >
89
99
You can’t perform that action at this time.
0 commit comments