Skip to content

Commit

Permalink
changes background gradient
Browse files Browse the repository at this point in the history
  • Loading branch information
daryafurman committed Jan 23, 2024
1 parent 427512e commit 8125ad4
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 80 deletions.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Weather App</title>
<script></script>
</head>
<body>
<div id="root"></div>
Expand Down
37 changes: 37 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,40 @@
background-image: url("./assets/Images/rainforest.jpeg");
color: aliceblue;
}
/*
body,
.europe {
background: linear-gradient(
180deg,
rgba(176, 166, 53, 1) 0%,
rgba(2, 0, 36, 1) 100%
);
}
body,
.arctic {
background: rgb(40, 114, 209);
background: linear-gradient(
180deg,
rgba(40, 114, 209, 1) 0%,
rgba(20, 18, 56, 1) 100%
);
}
body,
.sahara {
background: linear-gradient(
180deg,
rgba(209, 134, 40, 1) 0%,
rgba(2, 0, 36, 1) 100%
);
}
body,
.rainforest {
background: linear-gradient(
180deg,
rgba(36, 71, 14, 1) 0%,
rgba(2, 0, 36, 1) 100%
);
} */
18 changes: 18 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,24 @@ function App() {
if (response.ok) {
const weatherData = await response.json();
setWeather(weatherData);

const body = document.body;
if (selectedLocation === "") {
body.style.background =
"linear-gradient(180deg,rgba(0, 212, 255, 1) 0%, rgba(1, 99, 138, 1) 29%, rgba(2, 28, 64, 1) 57%, rgba(2, 0, 36, 1) 100%);";
} else if (selectedLocation === "europe") {
body.style.background =
"linear-gradient(180deg, rgba(176, 166, 53, 1) 0%, rgba(2, 0, 36, 1) 100%)";
} else if (selectedLocation === "arctic") {
body.style.background =
"linear-gradient(180deg, rgba(40, 114, 209, 1) 0%, rgba(20, 18, 56, 1) 100%)";
} else if (selectedLocation === "sahara") {
body.style.background =
"linear-gradient(180deg, rgba(209, 134, 40, 1) 0%, rgba(2, 0, 36, 1) 100%)";
} else if (selectedLocation === "rainforest") {
body.style.background =
"linear-gradient(180deg, rgba(36, 71, 14, 1) 0%, rgba(2, 0, 36, 1) 100%)";
}
} else {
console.error("Failed to fetch weather data.");
}
Expand Down
83 changes: 7 additions & 76 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@

color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background: rgba(0, 212, 255, 1);
background: linear-gradient(
180deg,
rgba(0, 212, 255, 1) 0%,
rgba(1, 99, 138, 1) 29%,
rgba(2, 28, 64, 1) 57%,
rgba(2, 0, 36, 1) 100%
);

font-synthesis: none;
text-rendering: optimizeLegibility;
Expand All @@ -35,6 +27,13 @@ body {
place-items: center;
min-width: 320px;
min-height: 100vh;
background: linear-gradient(
180deg,
rgba(0, 212, 255, 1) 0%,
rgba(1, 99, 138, 1) 29%,
rgba(2, 28, 64, 1) 57%,
rgba(2, 0, 36, 1) 100%
);
}

h1 {
Expand Down Expand Up @@ -73,71 +72,3 @@ button:focus-visible {
background-color: #f9f9f9;
}
}

/* .app-container.europe {
--background: rgb(176, 166, 53);
--background: linear-gradient(
180deg,
rgba(176, 166, 53, 1) 0%,
rgba(2, 0, 36, 1) 100%
);
}
.app-container.arctic {
background: rgb(40, 114, 209);
background: linear-gradient(
180deg,
rgba(40, 114, 209, 1) 0%,
rgba(20, 18, 56, 1) 100%
);
}
.app-container.sahara {
background: rgb(209, 134, 40);
background: linear-gradient(
180deg,
rgba(209, 134, 40, 1) 0%,
rgba(2, 0, 36, 1) 100%
);
}
.app-container.rainforest {
background: rgb(36, 71, 14);
background: linear-gradient(
180deg,
rgba(36, 71, 14, 1) 0%,
rgba(2, 0, 36, 1) 100%
);
} */
:root.europe {
background: linear-gradient(
180deg,
rgba(176, 166, 53, 1) 0%,
rgba(2, 0, 36, 1) 100%
);
}

:root.arctic {
background: rgb(40, 114, 209);
background: linear-gradient(
180deg,
rgba(40, 114, 209, 1) 0%,
rgba(20, 18, 56, 1) 100%
);
}

:root.sahara {
background: linear-gradient(
180deg,
rgba(209, 134, 40, 1) 0%,
rgba(2, 0, 36, 1) 100%
);
}

:root.rainforest {
background: linear-gradient(
180deg,
rgba(36, 71, 14, 1) 0%,
rgba(2, 0, 36, 1) 100%
);
}
5 changes: 1 addition & 4 deletions src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App.jsx";
import "./index.css";
import selectedLocation from "./components/locations/Locations.jsx";

ReactDOM.createRoot(document.getElementById("root")).render(
<React.StrictMode>
<div className={`app-container ${selectedLocation}`}>
<App />
</div>
<App />
</React.StrictMode>
);

0 comments on commit 8125ad4

Please sign in to comment.