Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>Bmi calculator</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand All @@ -40,4 +40,4 @@
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
</html>
Empty file removed src/App.css
Empty file.
11 changes: 0 additions & 11 deletions src/App.js

This file was deleted.

86 changes: 86 additions & 0 deletions src/Bmi.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
*{
/* background-color: rgb(245, 141, 207); */
background-image: url(/src/bgc2.jpg);
background-repeat: none;
background-position: center;
background-size: cover;
padding: 0;
margin: 0;
font-family: Verdana;
}

.header{
background-color: rgb(125, 189, 254);
height: 350px;
width: 400px;
margin: 40px auto;
display: flex;
flex-direction: column;
border-radius: 20px ;
justify-content: stretch;
background-image: none;
}
.header-tittle{
column-rule-color: blue;
background-color: rgb(125, 189, 254);
margin: 0 auto;
padding: 30px 10px;
background-image: none;

}
.header-bmi{
display: flex;
flex-direction: column ;
background-color: rgb(125, 189, 254);
background-image: none;

}
.header-bmi-label{
background-color: rgb(125, 189, 254);
margin: 0 auto;
background-image: none;
font-weight: 500;
}
.header-bmi-input{
background-color: rgb(125, 189, 254);
margin: 0 auto;
margin-bottom: 10px;
height: 25px;
width: 100px;
border-top: none;
border-left: none;
border-right: none;
background-image: none;
padding-left: 50px;
}
.header-bmi-input:focus{
outline: none;
}
.header-bmi-btn{
background-color: rgb(125, 189, 254);
margin: 0 auto;
margin-bottom: 20px;
margin-top: 20px;
height: 35px;
width: 100px;
border-radius: 20px;
background-color:rgb(239, 23, 160) ;
background-image: none;
color:white;
border: rgb(209, 177, 177) solid 2px;
font-family: Verdana;
}
.header-result{
background-color: rgb(125, 189, 254);
margin: 0 auto;
background-image: none;
margin-top: 10px;
font-size: larger;
font-weight: lighter;
}
.header-result-value{

font-weight: 700;
background-image: none;
background-color: rgb(125, 189, 254);
}
30 changes: 30 additions & 0 deletions src/Bmi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { useState } from "react";
import "./Bmi.css";

function Bmi() {
const [height,setHeight]=useState("");
const [mass,setMass]=useState("");
const [BMI ,setBMI]=useState("")
function calculate(){
let newBMI = mass/(height*height);
setBMI(newBMI)

}
return (
<div className="header">
<h1 className="header-tittle">BMI Calculator🧮</h1>
<div className="header-bmi">
<label className="header-bmi-label ">height</label>
<input className="header-bmi-input" onChange={(e)=>{ setHeight(e.target.value) }}></input>
<label className="header-bmi-label ">Mass</label>
<input className="header-bmi-input" onChange={(e)=>{ setMass(e.target.value) }}></input>

<button onClick={calculate} className="header-bmi-btn">calculate</button>

</div>
{BMI && <h4 className="header-result">Your BMI is <span className="header-result-value"> {BMI}</span> </h4> }
</div>
);
}

export default Bmi;
Binary file added src/bgc2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
import Bmi from "./Bmi";

const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
<React.StrictMode>
<App />
<Bmi />
</React.StrictMode>
);