Skip to content

Commit df58e2a

Browse files
committed
first project using React Js
1 parent 7bab6b6 commit df58e2a

File tree

3 files changed

+31
-5
lines changed

3 files changed

+31
-5
lines changed

src/App.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import './App.css';
22
import Navbar from './components/Navbar';
33
import Textform from './components/TextForm';
4+
import Textform2 from './components/Textform2' ;
45

56
let name = "vishwajit vm" ;
67
function App() {
78
return (
89
<>
910
<Navbar title="Bloging Page" aboutTitle="About Us"></Navbar>
1011
<div className="container">
11-
<Textform heading="Enter Text To View Transform"></Textform>
12+
{/* <Textform heading="Enter Text To View Transform"></Textform> */}
13+
<Textform2 Headings="EXPERIMENT ZONE"></Textform2>
1214
</div>
1315
</>
1416
);

src/components/TextForm.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ export default function Textform(props) {
8383
const color = ['red', 'blue', 'yellow', 'orange', 'green', 'black', 'pink', 'salmon', 'teal' , 'gold' , 'greenyellow'];
8484
document.getElementById('Messagearea').style.color = color[number];
8585
}
86+
87+
//Change font size
88+
const changFontSize = (number) => {
89+
const fontsize = [100 , 200 , 300 , 400 , 500 , 600 , 700 , 800 , 900];
90+
document.getElementById("Messagearea").style.fontWeight = fontsize[number]
91+
92+
}
93+
8694
//
8795
const handleOnChangeData = (event) => {
8896
setText(event.target.value)
@@ -91,7 +99,7 @@ export default function Textform(props) {
9199
<>
92100
<div className='contaner'>
93101
<div className="form-group text-light">
94-
<label htmlFor="exampleFormControlTextarea1"> <h4> {props.heading} </h4> </label>
102+
<label htmlFor="exampleFormControlTextarea1" className='mt-5 mb-2'> <h2> {props.heading} </h2> </label>
95103
<textarea className="form-control" id="Messagearea" value={text} onChange={handleOnChangeData} rows="12"></textarea>
96104
</div>
97105

@@ -105,16 +113,18 @@ export default function Textform(props) {
105113
<button className="btn btn-primary btn-block my-4 text-uppercase mx-3" onClick={handleTitleCasingEvent}>TitleCase</button>
106114
<button className="btn btn-primary btn-block my-4 text-uppercase mx-3" onClick={handleReverseCasingEvent}>Reversecase</button>
107115
<button className="btn btn-primary btn-block my-4 text-uppercase mx-3" onClick={handleCopyEvent}>Click to Copy</button>
108-
<button className="btn btn-primary mx-1" type="button" onClick={() => changeColor(Math.floor(Math.random() * 5))}>Change Color</button>
116+
<button className="btn btn-primary mx-3 my-4" onClick={() => changeColor(Math.floor(Math.random() * 5))}>Change Color</button>
117+
<button className="btn btn-primary mx-1" onClick={() => changFontSize(Math.floor(Math.random() * 9))}>Change Font size</button>
118+
109119

110120
</div>
111121

112122
<div className="container text-light my-3">
113123
<h1 className='text-danger'> Your Text Summery </h1>
114124
<p>
115-
{text.split(" ").length} Words and {text.length} Characters <br />
125+
<span className='text-danger'> {text.split(" ").length} </span> Words and <span className='text-danger'> {text.length} </span> Characters <br />
116126
<span className='text-danger'>{0.008* text.split(" ").length}</span> Minutes Time to Read this by Words <br />
117-
<span className='text-danger'> {0.002* text.length} Minutes time to read by characters. </span>
127+
<span className='text-danger'> {0.002* text.length} </span> Minutes time to read by characters.
118128
</p>
119129
<h2>Preview</h2>
120130
<p>

src/components/Textform2.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from 'react'
2+
3+
export default function TextForm2(props) {
4+
return (
5+
<>
6+
<div class="form-group">
7+
<label for="exampleFormControlTextarea1" className='text-light'><h2> {props.Headings} </h2></label>
8+
<textarea class="form-control" id="exampleFormControlTextarea1" rows="12"></textarea>
9+
</div>
10+
11+
<button className="btn btn-block btn-primary my-4 mx-3">UpperCase</button>
12+
</>
13+
)
14+
}

0 commit comments

Comments
 (0)