Skip to content

Commit

Permalink
Merge pull request #2 from Sustainer2020/ui_calc
Browse files Browse the repository at this point in the history
UI and calculater
  • Loading branch information
ph1ne4s authored Mar 4, 2024
2 parents 1425e4d + 83f12c4 commit 3787c63
Show file tree
Hide file tree
Showing 32 changed files with 8,321 additions and 6,032 deletions.
1,129 changes: 1,066 additions & 63 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"homepage": "",
"name": "water",
"version": "0.1.0",
"private": true,
Expand All @@ -21,12 +22,10 @@
"react-charts": "^3.0.0-beta.55",
"react-datamaps-india": "^0.6.0",
"react-dom": "^18.2.0",
"react-india-states-map": "^1.0.0",
"react-minimal-pie-chart": "^8.4.0",
"react-router-dom": "^6.14.2",
"react-scripts": "5.0.1",
"react-simple-maps": "^3.0.0",
"react-svg-map": "^2.2.0",
"recharts": "^2.7.2",
"water": "^0.0.1",
"web-vitals": "^2.1.4"
Expand Down Expand Up @@ -54,5 +53,8 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"gh-pages": "^6.1.1"
}
}
146 changes: 93 additions & 53 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,53 +1,93 @@
// App.js

import React, { useState } from "react";
import "bootstrap/dist/css/bootstrap.min.css";
import "./styles.css";
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
import AppNavbar from "./components/Navbar";
import HeroSection from "./components/HeroSection";
import Footer from "./components/Footer";
import StatePage from "./components/StatePage";
import IndiaMap from "./components/IndiaMap";
import Calculator from "./components/WaterCalculator.js";

const Home = ({ setSelectedState }) => {
function handleStateClick(stateName) {
setSelectedState(stateName);
}

return (
<div className="d-flex justify-content-between m-5">
<div className="col-md-6 mt-4">
<HeroSection />
</div>
<div className="right col-md-5">
<IndiaMap onStateClick={handleStateClick} />
</div>
</div>
);
};

const App = () => {
const [selectedState, setSelectedState] = useState("Uttarakhand");

return (
<Router>
<AppNavbar />
<Routes>
<Route
path="/"
element={<Home setSelectedState={setSelectedState} />}
/>
<Route path="/calculator" element={<Calculator />} />
<Route
path={`/${selectedState}`}
element={<StatePage selectedState={selectedState} />}
/>
</Routes>
<Footer />
</Router>
);
};

export default App;
// App.js

import React, { useState, useEffect } from "react";
import "bootstrap/dist/css/bootstrap.min.css";
import "./styles.css";
import { BrowserRouter as Router, Routes, Route, Navigate } from "react-router-dom";
import AppNavbar from "./components/Navbar";
import HeroSection from "./components/HeroSection";
import Footer from "./components/Footer";
import StatePage from "./components/StatePage";
import IndiaMap from "./components/IndiaMap";
import Calculator from "./components/WaterCalculator.js";
import StateComparison from "./components/stateComp.js";
import StateData from './data/StateData.json';
import AboutUsPage from "./components/aboutUs.js";
const Home = ({ setSelectedState }) => {
function handleStateClick(stateName) {
setSelectedState(stateName);
}

return (
<div className="d-flex justify-content-between m-5">
<div className="col-md-6 mt-4">
<HeroSection />
</div>
<div className="right col-md-5">
<IndiaMap onStateClick={handleStateClick} />
</div>
</div>
);
};

const App = () => {
const [selectedState, setSelectedState] = useState("Uttarakhand");
const [navbarFixed, setNavbarFixed] = useState(false);
const defaultState = 'Uttarakhand';

useEffect(() => {
const handleScroll = () => {
if (window.scrollY > 0) {
setNavbarFixed(true);
} else {
setNavbarFixed(false);
}
};

window.addEventListener("scroll", handleScroll);

return () => {
window.removeEventListener("scroll", handleScroll);
};
}, []);

return (

<>
<AppNavbar className={"fixed-navbar"} ></AppNavbar>

<Router>
<Routes>
<Route
path="/"
element={<Home setSelectedState={setSelectedState} />}
/>
<Route path="/calculator" element={<Calculator />} />
<Route
path="/"
element={<Navigate to={`/${defaultState}`} />}
/>
<Route
path="/:selectedState"
element={<StatePage selectedState={selectedState} />}
/>
<Route
path="/stateComparison"
element={<StateComparison stateData={StateData} />}
/>
<Route
path="/AboutUs"
element={<AboutUsPage/>}
/>
</Routes>
<br />
</Router>
{/* <Footer></Footer> */}
</>

);


};

export default App;
24 changes: 12 additions & 12 deletions src/components/Footer.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// src/components/Footer.js
import React from 'react';

const Footer = () => {
return (
<footer className='static-bottom'>
<p className='text-center'>&copy; {new Date().getFullYear()} Made with &#10084; </p>
</footer>
);
};

export default Footer;
// src/components/Footer.js
import React from 'react';

const Footer = () => {
return (
<footer className='static-bottom'>
<p className='text-center'>&copy; {new Date().getFullYear()} Made with &#10084; </p>
</footer>
);
};

export default Footer;
88 changes: 44 additions & 44 deletions src/components/HeroSection.css
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
/* src/components/HeroSection.css */
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}

.fade-in-up {
animation: fadeInUp 1s ease;
}

.jumbotron-custom {
padding: 2rem 1rem;
margin-bottom: 2rem;
background-color: rgba(255, 255, 255, 0.5); /* White background with transparency */
border-radius: 0.3rem;
backdrop-filter: blur(10px); /* Adds blur effect */
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);

/* Add the following CSS to move the whole section to the left */
margin-left: 0;
}

.jumbotron-custom h1,
.jumbotron-custom p {
color: #333; /* Text color for the heading and description */
}

.jumbotron-custom h1 {
font-family: var(--big-heading-font-family);
font-size: var(--big-heading-font-size);
font-weight: var(--big-heading-font-weight);
margin-bottom: 1rem;
}

.jumbotron-custom p {
font-family: var(--short-description-font-family);
font-size: var(--short-description-font-size);
}
/* src/components/HeroSection.css */
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}

.fade-in-up {
animation: fadeInUp 1s ease;
}

.jumbotron-custom {
padding: 2rem 1rem;
margin-bottom: 2rem;
background-color: rgba(255, 255, 255, 0.5); /* White background with transparency */
border-radius: 0.3rem;
backdrop-filter: blur(10px); /* Adds blur effect */
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);

/* Add the following CSS to move the whole section to the left */
margin-left: 0;
}

.jumbotron-custom h1,
.jumbotron-custom p {
color: #333; /* Text color for the heading and description */
}

.jumbotron-custom h1 {
font-family: var(--big-heading-font-family);
font-size: var(--big-heading-font-size);
font-weight: var(--big-heading-font-weight);
margin-bottom: 1rem;
}

.jumbotron-custom p {
font-family: var(--short-description-font-family);
font-size: var(--short-description-font-size);
}
54 changes: 29 additions & 25 deletions src/components/HeroSection.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
// src/components/HeroSection.js
import React from 'react';
import './HeroSection.css'; // Create a new file HeroSection.css
import Button from 'react-bootstrap/Button';

const HeroSection = () => {
return (

<div classname="d-flex justify-content-center">
<div className="jumbotron jumbotron-custom">
<div className="container fade-in-up">
<h1>Water Footprint of India</h1>
<p>

The water footprint measures water use and pollution for goods, services, and processes. It helps companies, governments, and individuals understand dependencies, resource protection, and food/energy security. It includes direct and indirect water use and consists of green, blue, and grey components. Managing water footprints is vital for sustainable water use and preservation.by identifying the source of water consumed, such as rainfall, soil moisture, surface water, or groundwater, and the volume of fresh water needed to assimilate pollutants.
</p>
</div>
</div>
<Button variant="dark" href="/calculator">Calculate Your Water Footprint</Button>
</div>

);
};

export default HeroSection;
// src/components/HeroSection.js
import React from 'react';
import './HeroSection.css'; // Create a new file HeroSection.css
import Button from 'react-bootstrap/Button';

const HeroSection = () => {
return (

<div classname="d-flex justify-content-center">
<div className="jumbotron jumbotron-custom">
<div className="container fade-in-up">
<h1>Water Footprint of India</h1>
<p>

The water footprint measures water use and pollution for goods, services, and processes. It helps companies, governments, and individuals understand dependencies, resource protection, and food/energy security. It includes direct and indirect water use and consists of green, blue, and grey components. Managing water footprints is vital for sustainable water use and preservation.by identifying the source of water consumed, such as rainfall, soil moisture, surface water, or groundwater, and the volume of fresh water needed to assimilate pollutants.
</p>
</div>
</div >
<>
<Button variant="dark" href="/calculator">Calculate Your Water Footprint</Button>{' '}
<Button variant="dark" href="/stateComparison">Compare States</Button>
</>

</div>

);
};

export default HeroSection;
Loading

0 comments on commit 3787c63

Please sign in to comment.