File tree Expand file tree Collapse file tree 1 file changed +23
-4
lines changed Expand file tree Collapse file tree 1 file changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -9,10 +9,13 @@ export default function TextForm(props) {
99 setText ( e . target . value ) ;
1010 } ;
1111
12+ const handleLowClick = ( e ) => {
13+ setText ( text . toLowerCase ( ) ) ;
14+ } ;
1215 const [ text , setText ] = useState ( "" ) ;
1316 return (
1417 < >
15- < div className = "mb-3" >
18+ < div className = "mb-3 container " >
1619 < label htmlFor = "myBox" className = "form-label" >
1720 < h2 > { props . heading } :</ h2 >
1821 </ label >
@@ -23,10 +26,26 @@ export default function TextForm(props) {
2326 className = "form-control"
2427 id = "myBox"
2528 rows = "10" > </ textarea >
29+ < button
30+ onClick = { handleUpClick }
31+ className = "btn btn-primary my-2" >
32+ Convert to UPPER CASE
33+ </ button >
34+ < button
35+ onClick = { handleLowClick }
36+ className = "btn btn-primary my-2 mx-4" >
37+ Convert to lower case
38+ </ button >
39+ </ div >
40+ < div className = "container-fluid my-2" >
41+ < h1 > Your Text Summary</ h1 >
42+ < p >
43+ { text . split ( " " ) . length } words, { text . length } chars
44+ </ p >
45+ < p > { 0.008 * text . split ( " " ) . length } to read</ p >
46+ < h2 > preview text</ h2 >
47+ < p > { text } </ p >
2648 </ div >
27- < button onClick = { handleUpClick } className = "btn btn-primary" >
28- Convert to UPPER CASE
29- </ button >
3049 </ >
3150 ) ;
3251}
You can’t perform that action at this time.
0 commit comments