diff --git a/Html-Files/Css-Files/style.css b/Html-Files/Css-Files/style.css new file mode 100644 index 00000000..a856acd5 --- /dev/null +++ b/Html-Files/Css-Files/style.css @@ -0,0 +1,384 @@ + + @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300&display=swap'); + +/* Default (Light) Mode */ +:root { + --background-color: #ffffff; /* Light background color */ + --text-color: #333333; /* Dark text color */ + --card-background: rgba(128, 128, 128, 0.204); /* Card background color */ + } + + /* Dark Mode */ + body.dark-mode { + --background-color: #333333; /* Dark background color */ + --text-color: #ffffff; /* Light text color */ + --card-background: rgba(0, 0, 0, 0.24); /* Dark card background color */ + } + body { + background-color: var(--background-color); + color: var(--text-color); + } + .head { + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + padding: 12px; + margin: 12px auto; +} + + +.card-body{ + padding: 1rem; +} + +.card-title{ + color: rgb(248, 65, 14); + letter-spacing: 1px; + font-size: 16px; + font-weight: bold; + font-family: 'Poppins', sans-serif; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + max-height: 80px; /* 4 lines at 20px per line */ + white-space: normal; + overflow: hidden; + + +} +.card-text{ + max-height: 100px; /* 4 lines at 20px per line */ + overflow: hidden; + text-overflow: ellipsis; + letter-spacing: 1px; + font-family: 'Poppins', sans-serif; + white-space: normal; + font-size: 13px; + display: -webkit-box; + -webkit-line-clamp: 4; + -webkit-box-orient: vertical; +} + + +.card-author{ + font-weight: bold; + font-family: 'Poppins', sans-serif; + letter-spacing: 1px; + padding-top: 12px; + font-size: 12px; +} +.card-date{ + font-family: 'Poppins', sans-serif; + letter-spacing: 1px; + font-size: 10px; +} + +#newsBox { + display: flex; + justify-content: center; +align-items: center; + gap: 2rem; + flex-wrap: wrap; + +} + +.newsCard { + display: flex; + flex-direction: column; + background-color: var(--card-background); + height: 450px; + width: 360px; + border-radius: 9px; + overflow: hidden; + box-sizing: border-box; +} +.thumnail{ + width: 100%; + height: 100%; +} + +.imageWrapper{ + width: 100%; + height: 180px; + object-fit: cover; +} + +#img { + height: 406px; + width: 721px; +} + +.line { + width: 30vw; + border: 1px solid black; + margin: 7px; + background-color: black; + height: 4px; + border-radius: 24px; +} + +footer { + position: fixed; + left: 0; + bottom: 0; + width: 100%; +} + +.mySpin { + margin: 50px auto; + display: block; + height: 10vh; + ; + width: 10vh; + ; + visibility: visible; +} + +.card-header{ + border: none; +} + +/* Media Quries */ + +@media only screen and (min-width:844px) and (max-width:1142px){ + + .newsCard { + display: flex; + flex-direction: column; + background-color: rgba(128, 128, 128, 0.204); + height: 380px; + width: 250px; + border-radius: 9px; + overflow: hidden; + box-sizing: border-box; + } + .card-title{ + color: rgb(248, 65, 14); + letter-spacing: 1px; + font-size: 14px; + font-weight: bold; + font-family: 'Poppins', sans-serif; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + max-height: 80px; /* 4 lines at 20px per line */ + white-space: normal; + overflow: hidden; + + + } + .card-author{ + font-weight: bold; + font-family: 'Poppins', sans-serif; + letter-spacing: 1px; + padding-top: 12px; + font-size: 8px; + } + .card-text{ + max-height: 100px; /* 4 lines at 20px per line */ + overflow: hidden; + text-overflow: ellipsis; + letter-spacing: 1px; + font-family: 'Poppins', sans-serif; + white-space: normal; + font-size: 11px; + display: -webkit-box; + -webkit-line-clamp: 4; + -webkit-box-orient: vertical; + } + .imageWrapper{ + width: 100%; + height: 150px; + object-fit: cover; + } + .card-body{ + padding: 0.5rem; + } + +} +label { + width:50px; + height:25px; + position: relative; + display: block; + background: #fffdf3; + border-radius: 50px; + box-shadow: inset 0px 5px 15px rgba(0,0,0,0.4), inset 0px -5px 15px rgba(255,255,255,0.4); + cursor: pointer; + } + label:after { + content: ""; + width:23px; + height: 23px; + position: absolute; + top:1px; + left:1px; + background: linear-gradient(180deg,#ffcc89,#d8860b); + border-radius: 50px; + box-shadow: 0px 5px 10px rgba(0,0,0,0.2); + } + input { + width: 0; + height: 0; + visibility: hidden; + } + input:checked + label { + background: #242424; + } + input:checked + label:after { + left: 49px; + transform: translateX(-100%); + background: linear-gradient(180deg, #777, #3a3a3a); +} + label, label:after { + transition: 0.3s + } + label:active:after{ + width: 30px; + } + label svg { + position: absolute; + width: 20px; + top: 4.5px; + left:2px; + z-index: 100; + } + label svg.sun { + opacity: 1; + transition: 0.3s; + } + label svg.moon { + opacity: 0.5; + left:28px; + transition: 0.3s; + } + input:checked + label svg.sun { + opacity: 0.2; + } + input:checked + label svg.moon { + opacity: 1; + } + .form-switch{ + padding-left: 0; + } + .form-check{ + padding-left: 0; + } +@media only screen and (min-width:492px) and (max-width:842px){ + + + .newsCard { + display: flex; + flex-direction: column; + background-color: rgba(128, 128, 128, 0.204); + height: 360px; + width: 230px; + border-radius: 9px; + overflow: hidden; + box-sizing: border-box; + } + .imageWrapper{ + width: 100%; + height: 130px; + object-fit: cover; + } + .card-title{ + color: rgb(248, 65, 14); + letter-spacing: 1px; + font-size: 13px; + font-weight: bold; + font-family: 'Poppins', sans-serif; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + max-height: 80px; /* 4 lines at 20px per line */ + white-space: normal; + overflow: hidden; + + + } + .card-text{ + max-height: 100px; /* 4 lines at 20px per line */ + overflow: hidden; + text-overflow: ellipsis; + letter-spacing: 1px; + font-family: 'Poppins', sans-serif; + white-space: normal; + font-size: 10px; + display: -webkit-box; + -webkit-line-clamp: 4; + -webkit-box-orient: vertical; + } + .card-author{ + font-weight: bold; + font-family: 'Poppins', sans-serif; + letter-spacing: 1px; + padding-top: 12px; + font-size: 8px; + } +} +@media (prefers-color-scheme: dark) { + body { + background-color: var(--background-color); + color: var(--text-color); + } + /* Add dark mode specific styles here */ +} +@media only screen and (min-width:400px) and (max-width:490px){ + + + .newsCard { + display: flex; + flex-direction: column; + background-color: rgba(128, 128, 128, 0.204); + height: 360px; + width: 80%; + border-radius: 9px; + overflow: hidden; + box-sizing: border-box; + } + .imageWrapper{ + width: 100%; + height: 130px; + object-fit: cover; + } + .card-title{ + color: rgb(248, 65, 14); + letter-spacing: 1px; + font-size: 13px; + font-weight: bold; + font-family: 'Poppins', sans-serif; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + max-height: 80px; /* 4 lines at 20px per line */ + white-space: normal; + overflow: hidden; + + + } + .card-text{ + max-height: 100px; /* 4 lines at 20px per line */ + overflow: hidden; + text-overflow: ellipsis; + letter-spacing: 1px; + font-family: 'Poppins', sans-serif; + white-space: normal; + font-size: 10px; + display: -webkit-box; + -webkit-line-clamp: 4; + -webkit-box-orient: vertical; + } + .card-author{ + font-weight: bold; + font-family: 'Poppins', sans-serif; + letter-spacing: 1px; + padding-top: 12px; + font-size: 8px; + } +} diff --git a/Html-Files/Css-Files/styles.css b/Html-Files/Css-Files/styles.css new file mode 100644 index 00000000..df2680be --- /dev/null +++ b/Html-Files/Css-Files/styles.css @@ -0,0 +1,340 @@ +/* @import url('http://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700;800;900&display=swap'); */ + +* +{ + margin: 0; + padding: 0; + box-sizing: border-box; + font-family: 'Poppins',sans-serif; +} + +section +{ + display: flex; + justify-content: center; + align-items: center; + min-height: 100vh; + background-color: #095a55; + +} +section::before +{ + content: ''; + position: absolute; + top: 0; + left: 0; + width: 50%; + height: 100%; + background: #fff38e; +} + +.container +{ + position: relative; + min-width: 1100px; + min-height: 550px; + display: flex; + z-index: 1000; + /* border-radius: 22px; */ + /* background-color: #fff; */ + +} + +.container .contactInfo +{ + position: absolute; + top: 40px; + width: 350px; + height: calc(100% - 80px); + background: #095a55; + z-index: 1; + padding: 40px; + display: flex; + justify-content: center; + flex-direction: column; + justify-content: space-between; + box-shadow: 0 20px 25px rgba(0,0,0,0.15); + border-radius: 22px; +} + +.container .contactInfo h2 +{ + color: #fff; + font-size:24px; + font-weight: 500; +} + +.container .contactInfo ul.info +{ + position: relative; + margin: 20px 0; +} + +.container .contactInfo ul.info li +{ + position: relative; + list-style: none; + display: flex; + margin: 20px 0; + cursor: pointer; + align-items: flex-start; +} + +.container .contactInfo ul.info li span:nth-child(1) +{ + width: 30px; + min-width: 30px; +} + +/* for gmail */ +.container .contactInfo ul.info li span a +{ + color: #fff; + text-decoration: none; + width: 30px; + min-width: 30px; + +} + +.container .contactInfo ul.info li span:nth-child(1) img +{ + max-width: 100%; + filter: invert(1); +} + +.container .contactInfo ul.info li span:nth-child(2) +{ + color: #fff; + margin-left: 10px; + font-weight: 300; +} + +.container .contactInfo ul.sci +{ + position: relative; + display: flex; +} + +.container .contactInfo ul.sci li +{ + list-style: none; + margin-right: 15px; +} + +.container .contactInfo ul.sci li a +{ + text-decoration: none; +} + +.container .contactInfo ul.sci li a img +{ + filter: invert(1); +} + +.container .contactForm +{ + position: absolute; + padding: 70px 50px; + padding-left: 250px; + margin-left: 150px; + width: calc(100% - 150px); + height: 100%; + background: #fff; + box-shadow: 0 50px 50px rgba(0,0,0,0.25); + border-radius: 22px; +} + +.container .contactForm h2 +{ + color: #0f3959; + font-size: 24px; + font-weight: 500; +} + +.container .contactForm .formBox +{ + position: relative; + display: flex; + justify-content: space-between; + flex-wrap: wrap; + padding-top: 30px; +} + +.container .contactForm .formBox .inputBox +{ + position: relative; + margin-bottom: 35px; +} + +.container .contactForm .formBox .inputBox.w50 +{ + width: 47%; +} + +.container .contactForm .formBox .inputBox.w100 +{ + width: 100%; +} + +.container .contactForm .formBox .inputBox input, +.container .contactForm .formBox .inputBox textarea +{ + width: 100%; + resize: none; + padding: 5px 0; + font-size: 18px; + font-weight: 300; + color: #333; + border: none; + outline: none; + border-bottom: 1px solid #777; +} + +.container .contactForm .formBox .inputBox textarea +{ + height: 120px; +} + +.container .contactForm .formBox .inputBox span +{ + position: absolute; + left: 0; + padding: 5px 0; + pointer-events: none; + font-size: 18px; + font-weight: 300; + transition: 0.3s; +} + +.container .contactForm .formBox .inputBox input:focus ~ span, +.container .contactForm .formBox .inputBox input:valid ~ span, +.container .contactForm .formBox .inputBox textarea:focus ~ span, +.container .contactForm .formBox .inputBox textarea:valid ~ span +{ + transform: translateY(-20px); + font-size: 12px; + font-weight: 400; + letter-spacing: 1px; + color: #095a55; + font-weight: 500; +} + +/* Css for the submit button */ +.container .contactForm .formBox .inputBox input[type="submit"] +{ + position: relative; + cursor: pointer; + background: #095a55; + border-radius: 20px; + color: #fff; + border: none; + max-width: 150px; + padding: 12px; + +} + +.container .contactForm .formBox .inputBox input[type="submit"]:hover{ + background: #0d9480; +} + +/* make the form responsive */ +@media (max-width: 1200px) +{ + .container + { + width: 90%; + min-width: auto; + margin: 20px; + box-shadow: 0 20px 50px rgba(0,0,0,0.2); + } + + .container .contactInfo + { + top: 0; + height: 550px; + position: relative; + box-shadow: none; + border-radius: 0px; + } + + .container .contactForm + { + position: relative; + width: calc(100% - 350px); + padding-left: 0; + margin-left: 0; + padding: 40px; + height: 550px; + box-shadow: none; + border-radius: 0px; + } +} + +@media (max-width: 991px) +{ + section + { + display: flex; + justify-content: center; + align-items: center; + min-height: 100vh; + background: #fff38e; + } + + section::before + { + display: none; + } + + .container + { + display: flex; + flex-direction: column-reverse; + } + + .container .contactForm + { + width: 100%; + height: auto; + border-radius: 0px; + } + + .container .contactInfo + { + width: 100%; + height: auto; + flex-direction: row; + border-radius: 0px; + } + .container .contactInfo ul.sci + { + position: relative; + display: flex; + justify-content: center; + align-items: center; + } +} + +@media (max-width: 600px) +{ + .container .contactForm + { + padding: 25px; + } + + .container .contactInfo{ + padding: 25px; + flex-direction: column; + align-items: flex-start; + } + + .container .contactInfo ul.sci + { + margin-top: 40px; + } + + .container .contactForm .formBox .inputBox.w50 + { + width: 100%; + } +} diff --git a/Html-Files/app.js b/Html-Files/app.js new file mode 100644 index 00000000..d96b5160 --- /dev/null +++ b/Html-Files/app.js @@ -0,0 +1,85 @@ +const darkModeToggle = document.getElementById("darkModeToggle"); +const body = document.body; + +// Function to toggle dark mode based on user preference +function toggleDarkMode() { + if (darkModeToggle.checked) { + body.classList.add("dark-mode"); + } else { + body.classList.remove("dark-mode"); + } +} + +// Event listener for dark mode toggle button +darkModeToggle.addEventListener("change", toggleDarkMode); + +// Function to check and set initial dark mode state based on user preferences +function setInitialDarkMode() { + const prefersDarkMode = window.matchMedia("(prefers-color-scheme: dark)").matches; + + if (prefersDarkMode) { + body.classList.add("dark-mode"); + darkModeToggle.checked = true; + } +} + +// Call the function to set initial dark mode state +//setInitialDarkMode(); + +// Create XMLHttpRequest Object +const xhr = new XMLHttpRequest(); + +function sendCategory(index) { + getNews(newsCategory[index]); +} +getNews("all"); + +function getNews(newsCategoryName) { + xhr.open( + "GET", + `hhttps://newsapi.org/s/india-health-news-api`, + true + ); + + xhr.getResponseHeader("Content-type", "application/json"); + + xhr.onload = function () { + if (this.status === 200) { + let json = JSON.parse(this.responseText); + let data = json.data; + + let newsHTML = ""; + + function showSpinner() { + spinner.style.visibility = "hidden"; + newsBox.style.visibility = "visible"; + } + + xhr.onprogress = showSpinner; + + for (key in data) { + let news = `
${data[key].content}
+ Read more.. +