From c38ffe8db2967e28704c083116856bf553be3e3e Mon Sep 17 00:00:00 2001
From: Chris P ${content.description} hi ${content.description} ${content.description} ${content.description} ${content.description} ${content.description}End Of Days
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/news.js b/news.js
new file mode 100644
index 0000000..418f7bc
--- /dev/null
+++ b/news.js
@@ -0,0 +1,78 @@
+function displayErrorToUser(message){
+ return console.log(message)
+}
+
+const parentNode = document.getElementById("newz"); // find the {
+ const spanNode = document.createElement("li"); // make fresh
${content.title}
+ `;
+ parentNode.appendChild(spanNode); // pushing to the
+ });
+}
+
+// Buttons event listener/value to fetch
+
+const buttonSelector = document.querySelector('.buttons');
+buttonSelector.addEventListener("click", function(event){
+ event.preventDefault();
+ let url;
+ if (event.target.value === 'all-button') {
+ url = 'https://newsapi.org/v2/top-headlines?country=gb&apiKey=534d9b30f7bd4185b60cba8d406e11ec'
+ }
+ else {
+ url = `https://newsapi.org/v2/everything?q=${event.target.value}&apiKey=534d9b30f7bd4185b60cba8d406e11ec`
+ }
+
+ getData(url);
+});
+
+//search event listener
+
+const searchFunc = document.querySelector('.searchB');
+const inputInfo = document.querySelector('.searchB') //INPUT? NECESSARY????
+
+
+searchFunc.addEventListener("click", function(event){ //COMBINE SEARCH AND INPUT??
+ event.preventDefault();
+ //WHAT IS VALUE??? GOOGLE IT
+ let url = `https://newsapi.org/v2/everything?q=${event.target.value}&apiKey=534d9b30f7bd4185b60cba8d406e11ec`
+ getData(url);
+})
+
+
+//button function
+
+function fetchingButtons(url, selector) { //button fetch addresses
+ const buttonall = document.querySelector(selector);
+
+}
+
+
+//Fetch
+
+function getData(url){
+ // main news body fetch - button changeable
+ fetch(url) // by default fetch makes a GET request
+ .then(function(response) {
+
+ return response.json();
+ })
+ .then(function(body){
+ parentNode.innerHTML = "";
+ displayDataOnPage(body);
+ })
+ .catch(function(error) {
+ displayErrorToUser(`${error} ahhhh server problem`);
+ });
+}
+
+getData('https://newsapi.org/v2/top-headlines?country=gb&apiKey=534d9b30f7bd4185b60cba8d406e11ec')
\ No newline at end of file
diff --git a/style.css b/style.css
new file mode 100644
index 0000000..47ff4c3
--- /dev/null
+++ b/style.css
@@ -0,0 +1,18 @@
+* {
+ box-sizing: border-box;
+
+}
+
+body{
+
+ }
+
+.app {
+
+
+}
+
+h2 {
+font-size: 20px;
+
+}
\ No newline at end of file
From ab94ccd0614ffd92608de598799b034708b5d36f Mon Sep 17 00:00:00 2001
From: chrisphillers
-
+
diff --git a/news.js b/news.js
index 0fa811b..f35e063 100644
--- a/news.js
+++ b/news.js
@@ -9,9 +9,9 @@ const parentNode = document.getElementById("newz"); // find the End Of Days
End Of Days
-
-
+
+
+ {
const spanNode = document.createElement("li"); // make fresh
${content.title}
- `;
+ `
+
${content.title}
+
});
}
@@ -42,8 +42,6 @@ const inputInfo = document.querySelector('.searchClass') //INPUT? NECESSARY????
-
-
//button function
function fetchingButtons(url, selector) { //button fetch addresses
const buttonall = document.querySelector(selector);
@@ -81,9 +79,9 @@ function displayDataOnHead(topNews){
topNews.articles.forEach(content => {
const spanNode2 = document.createElement("li"); // make fresh
${content.title}
- `;
+ `
+
${content.title}
`;
+
parentNode2.appendChild(spanNode2); // pushing to the
});
}
diff --git a/style.css b/style.css
index 2c483f6..23723b1 100644
--- a/style.css
+++ b/style.css
@@ -1,47 +1,249 @@
* {
box-sizing: border-box;
-
+
}
body{
display: flex;
+ /* justify-content: flex-start; */
flex-direction: column;
+ justify-content: center;
font-family: 'Encode Sans', sans-serif;
- margin: 0;
background: white;
color:black;
- max-width: 2000px;
+ max-width: 1500px;
+ margin: 0;
+
}
+ul{
+ list-style-type: none;
+
+ }
+
+
+
+h1 {
+ font-size: 30px;
+ display: flex;
+ justify-content: center;
+
+}
+
+.heading {
+ display: flex;
+ justify-content: center;
+ flex-direction: row;
+
+}
+
+.searchClass{
+ display: flex;
+ flex:1;
+ justify-content: center;
+}
+
+.infoG{
+ display:none;
+}
+
+
+
+ #headline {
+ display:flex;
+ flex: 1;
+ position: relative;
+ margin-right: 7vw;
+
+
+
+ }
+ #headline h2 {
+ position: absolute;
+ bottom: 0;
+ /* width: 93.5%; */
+ background: rgb(0, 0, 0); /* fallback color */
+ background: rgba(0, 0, 0, 0.7);
+ padding: 2vw;
+ color: white;
+ max-width: 1000px;
+ }
-h2 {
- font-size: 20px;
+ #headline img{
+ width:100%;
+ max-width: 1000px;
+ max-height: 500px;
+ /* object-fit: cover; */
+ /* position: relative; */
}
+
+ .buttons{
+ display:flex;
+ flex: 1;
+ justify-content: space-around;
+ margin-left: 20px;
+ margin-right: 20px;
+
+ }
+
+
+ .all-button{
+ display: inline-block;
+ border: none;
+ padding: 1rem 2rem;
+ margin: 0;
+ text-decoration: none;
+ background: #0069ed;
+ color: #ffffff;
+ font-family: sans-serif;
+ font-size: 1rem;
+ cursor: pointer;
+ text-align: center;
+ transition: background 250ms ease-in-out,
+ transform 150ms ease;
+ -webkit-appearance: none;
+ -moz-appearance: none;
+ }
+
+ .all-button:hover {
+ background: #2079b0;
+ background-image: -webkit-linear-gradient(top, #2079b0, #eb94d0);
+ background-image: -moz-linear-gradient(top, #2079b0, #eb94d0);
+ background-image: -ms-linear-gradient(top, #2079b0, #eb94d0);
+ background-image: -o-linear-gradient(top, #2079b0, #eb94d0);
+ background-image: linear-gradient(to bottom, #2079b0, #eb94d0);
+ text-decoration: none;
+ }
+
+
.graphic {
display:none;
border-left:black;
border-left-width: 3px;
}
+.hero {
+ display:flex;
+ flex: 1;
+
+
+}
+
+#newz {
+ display:flex;
+ flex: 1;
+ flex-direction: column;
+ justify-content: center;
+ margin-right: 7vw;
+}
+
+#newz h2 {
+background-color: antiquewhite;
+top: 0;
+position: float;
+}
+
+
+
+#newz img {
+
+ width:100%;
+ object-fit: cover;
+ height: 50vw;
+ background-image: url("https://chrisphillers.000webhostapp.com/placeholder1.jpg")
+ /* -webkit-box-shadow: -34px 53px 196px -30px rgba(0,0,0,0.49);
+ -moz-box-shadow: -34px 53px 196px -30px rgba(0,0,0,0.49);
+ box-shadow: -34px 53px 196px -30px rgba(0,0,0,0.49); */
+}
/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
+ .hero {
+
+
+ }
+
+ #headline {
+ display:flex;
+ flex: 1;
+
+
+ }
+
+ #headline img{
+ width:90vw;
+ object-fit: cover;
+ position: relative;
+
+ }
+
+ /* #newz {
+ width: 400px;
+
+ }
+
+ #newz ul {
+ display:flex;
+ flex: 1;
+ flex-wrap: wrap;
+ }
+
+ #newz img{
+
+ height: 250px;
+
+ } */
+
+ #newz {
+ display: flex;
+ flex-flow: row wrap;
+}
+
+#newz li {
+ flex-grow: 1;
+ width:300px;
+
+ margin: 0.2vw;
+ padding: 2vw;
+
+
+}
+#newz img {
+
+ height: 15vw;
+ background-color:lightblue;
+
+}
+
+
+.buttons{
+ margin-left: 30px;
+ margin-right: 50px;
+
+
+
+}
+
+
+
+
+
}
/* Large devices (desktops, 960px and up) */
@media (min-width: 960px) {
- header {
+ .heading {
display:flex;
flex-direction: row;
justify-content: space-between;
@@ -67,32 +269,118 @@ h2 {
-.hero {
+ .hero {
display:flex;
flex-direction: row;
}
-.headline {
+#headline {
+ display:flex;
+ flex: 1;
+ /* flex-basis: 70%; */
+}
+
+#headline h2 {
display:flex;
flex: 1;
- flex-basis: 50%;
+ width:65vw;
+ /* flex-basis: 70%; */
+}
+
+
+
+
+
+#headline img{
+ width:65vw;
+ height: 30vw;
+ object-fit: cover;
+ position: relative;
+
}
-.infoG{
+ .buttons{
+ margin-left: 0px;
+ margin-right: 50px;
+
+ }
+
+
+
+.infoG {
display:flex;
+
flex: 1;
- flex-basis: 50%;
+ flex-basis: 30%;
+ justify-content: flex-start;
+ flex-direction: column;
+
+
}
+#newz {
+
+
+}
- .graphic {
+ .graphic {
display:flex;
flex: 1;
- border-left:black;
- border-left-width: 3px;
+ justify-content: flex-start;
+ flex-direction: column;
+
+
+ /* border-left-width: 30px;
+ border-left-color: black;
+ margin: 20px;
+ width: 100% */
+
+
+
}
+
+
+ .graphic ul {
+ display:flex;
+ flex: 1;
+
+ }
+
+ #one {
+ display:flex;
+
+
+ height: 10px;
+ background-color: red;
+ width: 100px;
+ margin-bottom:10px;
+
+
+ }
+
+ #two{
+ display:flex;
+
+
+ height: 10px;
+ background-color: yellow;
+ width: 30px;
+ margin-bottom:10px;
+
+ }
+
+ #three {
+ display:flex;
+
+
+ height: 10px;
+ background-color: red;
+ width: 30px;
+ margin-bottom:10px;
+
+ }
From e663ba67f37b8d768be3805648cac21e07410e1e Mon Sep 17 00:00:00 2001
From: chrisphillers
{
const spanNode = document.createElement("li"); // make fresh
+ `
+
+
${content.source.name}
${content.title}
-
});
}
@@ -63,7 +65,7 @@ const inputInfo = document.querySelector('.searchClass') //INPUT? NECESSARY????
displayErrorToUser(`${error} ahhhh server problem`);
});
}
- getData('https://newsapi.org/v2/top-headlines?country=gb&apiKey=534d9b30f7bd4185b60cba8d406e11ec')
+ getData('https://newsapi.org/v2/top-headlines?country=gb&pageSize=100&apiKey=534d9b30f7bd4185b60cba8d406e11ec')
@@ -79,9 +81,15 @@ function displayDataOnHead(topNews){
topNews.articles.forEach(content => {
const spanNode2 = document.createElement("li"); // make fresh
-
${content.title}
`;
+ `
+
+
${content.title}
`;
+
+
+
+
+
parentNode2.appendChild(spanNode2); // pushing to the
});
}
diff --git a/style.css b/style.css
index 23723b1..80ddbae 100644
--- a/style.css
+++ b/style.css
@@ -10,10 +10,10 @@ body{
flex-direction: column;
justify-content: center;
font-family: 'Encode Sans', sans-serif;
- background: white;
+ background: antiquewhite;
color:black;
max-width: 1500px;
- margin: 0;
+ margin-left: 0;
}
@@ -23,12 +23,34 @@ ul{
}
+a{
+ text-decoration: none;
+ color: black;
+}
+
+img:hover {
+ background-color:#000;
+ opacity:0.8;
+}
+
+a:active {
+ color: black;
+}
+
+a:visited {
+ color: black;
+}
+
h1 {
- font-size: 30px;
display: flex;
- justify-content: center;
+ flex:1;
+ justify-content: flex-start;
+ font-size: 30px;
+ margin-left: 4.5vw;
+
+
}
@@ -36,16 +58,53 @@ h1 {
display: flex;
justify-content: center;
flex-direction: row;
-
+ align-items: center;
}
.searchClass{
display: flex;
flex:1;
- justify-content: center;
+ justify-content: flex-end;
+ margin-right: 3vw;
}
+
+.searchB{
+ display: flex;
+ flex:1;
+ justify-content: flex-end;
+
+ /* display: inline-block; */
+ border: none;
+ padding-top: 0.5em;
+ padding-bottom: 0.5em;
+ margin: 0;
+ text-decoration: none;
+ background: black;
+ color: #ffffff;
+ font-family: sans-serif;
+ font-size: 1rem;
+ cursor: pointer;
+ text-align: center;
+ transition: background 250ms ease-in-out,
+ transform 150ms ease;
+ -webkit-appearance: none;
+ -moz-appearance: none;
+}
+
+.searchB:hover {
+ background: antiquewhite;
+ background-image: antiquewhite;
+ background-image: antiquewhite;
+ background-image: antiquewhite;
+ background-image: antiquewhite;
+ color:black;
+ font:bold;
+ text-decoration: none;
+}
+
+
.infoG{
display:none;
}
@@ -56,7 +115,7 @@ h1 {
display:flex;
flex: 1;
position: relative;
- margin-right: 7vw;
+
@@ -68,17 +127,21 @@ h1 {
/* width: 93.5%; */
background: rgb(0, 0, 0); /* fallback color */
background: rgba(0, 0, 0, 0.7);
- padding: 2vw;
+ padding-top: 2vw;
+ padding-left: 2vw;
color: white;
max-width: 1000px;
+ margin-right: 7vw;
+ width: 90vw;
+
}
#headline img{
- width:100%;
+
max-width: 1000px;
max-height: 500px;
- /* object-fit: cover; */
- /* position: relative; */
+ margin-right: 7vw;
+ width: 90vw;
}
@@ -86,9 +149,13 @@ h1 {
.buttons{
display:flex;
flex: 1;
- justify-content: space-around;
- margin-left: 20px;
- margin-right: 20px;
+ justify-content: space-between;
+ /* margin-left: 20px; */
+ /* margin-right: 20px; */
+ font-size: 5px;
+ background: black;
+ width: 100%;
+
}
@@ -96,10 +163,11 @@ h1 {
.all-button{
display: inline-block;
border: none;
- padding: 1rem 2rem;
+ padding-top: 0.5em;
+ padding-bottom: 0.5em;
margin: 0;
text-decoration: none;
- background: #0069ed;
+ background: black;
color: #ffffff;
font-family: sans-serif;
font-size: 1rem;
@@ -112,12 +180,13 @@ h1 {
}
.all-button:hover {
- background: #2079b0;
- background-image: -webkit-linear-gradient(top, #2079b0, #eb94d0);
- background-image: -moz-linear-gradient(top, #2079b0, #eb94d0);
- background-image: -ms-linear-gradient(top, #2079b0, #eb94d0);
- background-image: -o-linear-gradient(top, #2079b0, #eb94d0);
- background-image: linear-gradient(to bottom, #2079b0, #eb94d0);
+ background: antiquewhite;
+ background-image: antiquewhite;
+ background-image: antiquewhite;
+ background-image: antiquewhite;
+ background-image: antiquewhite;
+ color:black;
+ font:bold;
text-decoration: none;
}
@@ -141,16 +210,18 @@ h1 {
flex-direction: column;
justify-content: center;
margin-right: 7vw;
+
}
#newz h2 {
-background-color: antiquewhite;
-top: 0;
-position: float;
-}
+margin: 0;
+}
+#newz li {
+background-color: antiquewhite;
+}
#newz img {
@@ -163,7 +234,12 @@ position: float;
box-shadow: -34px 53px 196px -30px rgba(0,0,0,0.49); */
}
-
+#newz h3 {
+font-size: 15px;
+margin:0;
+padding-bottom: 10px;
+padding-top:5px;
+}
/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
@@ -187,6 +263,11 @@ position: float;
}
+ #headline h2{
+ width:90vw;
+
+ }
+
/* #newz {
width: 400px;
@@ -213,8 +294,9 @@ position: float;
flex-grow: 1;
width:300px;
- margin: 0.2vw;
- padding: 2vw;
+ /* margin: 0.2vw; */
+ padding-right: 1vw;
+ padding-left:1vw;
}
@@ -227,10 +309,9 @@ position: float;
.buttons{
- margin-left: 30px;
- margin-right: 50px;
+ justify-content: space-around;
+ margin:0;
-
}
@@ -243,7 +324,31 @@ position: float;
/* Large devices (desktops, 960px and up) */
@media (min-width: 960px) {
+
+
.heading {
+ display: flex;
+ justify-content: center;
+ flex-direction: row;
+ align-items: center;
+ }
+
+ .searchClass{
+
+ display: flex;
+ flex:1;
+ justify-content: flex-end;
+ margin-right: 3vw;
+ }
+
+
+ .searchB{
+ display: flex;
+ flex:1;
+ justify-content: flex-end;
+
+
+ /* .heading {
display:flex;
flex-direction: row;
justify-content: space-between;
@@ -259,7 +364,7 @@ position: float;
.searchClass {
background-color: yellow;
- }
+ } */
}
@@ -268,7 +373,6 @@ position: float;
@media (min-width: 1200px) {
-
.hero {
display:flex;
flex-direction: row;
From 09ac27a15ab8202f965646556fb33cf17929b532 Mon Sep 17 00:00:00 2001
From: chrisphillers
End Of Days
+ THE END IS NIGH