Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redesign Homepage, by Misah - Fixed #6 #7

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
shotgun hihi
oops
  • Loading branch information
MisahSaid committed May 17, 2024
commit 1f7642ee73dc69939df8e4d5826699839ccc299d
20 changes: 20 additions & 0 deletions helpers/fetch-json.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* An asynchronous helper function that wraps the standard node.js fetch API.
* This function calls an API url passed as the first and mandatory parameter,
* there is an optional payload parameter to send a json object, eg. a filter.
* It then calls the API and returns the response body parsed as a json object.
* @example <caption>fetchJson as returning function using the await keyword</caption>
* const data = await fetchJson('https://api-url.com/endpoint/')
* @example <caption>fetchJson as oneliner using the then() structure.</caption>
* fetchJson('https://api-url.com/endpoint/').then((data)=>{
* // use data...
* })
* @param {string} url the api endpoint to address
* @param {object} [payload] the payload to send to the API
* @returns the response from the API endpoint parsed as a json object
*/
export default async function fetchJson(url, payload = {}) {
return await fetch(url, payload)
.then((response) => response.json())
.catch((error) => error)
}
Binary file added public/BG-homepage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/Placeholder-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/Placeholder-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added public/Poppins-BlackItalic.ttf
Binary file not shown.
Binary file not shown.
Binary file added public/Poppins-BoldItalic.ttf
Binary file not shown.
Binary file added public/Poppins-ExtraBold.ttf
Binary file not shown.
Binary file added public/Poppins-ExtraBoldItalic.ttf
Binary file not shown.
Binary file added public/Poppins-ExtraLight.ttf
Binary file not shown.
Binary file added public/Poppins-ExtraLightItalic.ttf
Binary file not shown.
Binary file added public/Poppins-Italic.ttf
Binary file not shown.
Binary file added public/Poppins-Light.ttf
Binary file not shown.
Binary file added public/Poppins-LightItalic.ttf
Binary file not shown.
Binary file added public/Poppins-Medium.ttf
Binary file not shown.
Binary file added public/Poppins-MediumItalic.ttf
Binary file not shown.
Binary file not shown.
Binary file added public/Poppins-SemiBold.ttf
Binary file not shown.
Binary file added public/Poppins-SemiBoldItalic.ttf
Binary file not shown.
Binary file added public/Poppins-Thin.ttf
Binary file not shown.
Binary file added public/Poppins-ThinItalic.ttf
Binary file not shown.
2 changes: 1 addition & 1 deletion public/assets/cloud.svg → public/cloud.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion public/assets/Menu.svg → public/menu.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/mesh-600.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion public/assets/moon.svg → public/moon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions public/moongg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 67 additions & 0 deletions public/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// elements selecteren
let hamburger = document.querySelector('.hamburger')
let navMenu = document.querySelector('.desktop')
let body = document.querySelector('body')
var likedCircle = document.querySelector('.liked-circle')
var sugCircle = document.querySelector('.sug-circle')
var hiddenHeader = document.querySelectorAll('.hidden-header')
var prevBTN = document.querySelector('.prevBTN')
var nextBTN = document.querySelector('.nextBTN')

// hamburger menu addeventlistener
hamburger.addEventListener('click', () => {
navMenu.classList.toggle('nav-active')
navMenu.classList.toggle('desktop')
hamburger.classList.toggle('active-bar')
})

// PE suggested + liked playlist section
// JS code added & removing styling without JS
body.classList.remove('liked-no-js', 'sug-no-js')
body.classList.add('has-js')
// hide content no function w/o JS
likedCircle.hidden = false
sugCircle.hidden = false
nextBTN.hidden = false
prevBTN.hidden = false

// Carousel liked + suggested playlist
// external JS file GSAP
document.addEventListener('DOMContentLoaded', (event) => {
gsap.registerPlugin(Draggable)
})

// GSAP draggable
Draggable.create('.slayrousel', {
type: 'rotation',
inertia: true,
})

// Clientside fetch
let forms = document.querySelectorAll('form.like-form')
// loop door forms
forms.forEach(function (form) {
form.addEventListener('submit', function (event) {
// leest data form + geeft extra eigenschap mee
let data = new FormData(this)
data.append('enhanced', true)

// client-side fetch
fetch(this.action, {
method: this.method,
body: new URLSearchParams(data),
})
// return html
.then(function (response) {
return response.text()
})
.then(function (responseHTML) {
document.querySelector('.art-slayrousel').innerHTML = responseHTML
console.log(responseHTML)
})

event.preventDefault()
})
})

// Allstories carousel
162 changes: 162 additions & 0 deletions public/styleM.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
.poppins-regular {
font-family: "Poppins", sans-serif;
font-weight: 400;
font-style: normal;
}

.poppins-medium {
font-family: "Poppins", sans-serif;
font-weight: 500;
font-style: normal;
}

:root {
--primary-font: "Poppins", sans-serif;
/* colourpalette */
/*--------b---w------ */
--white: #F5FAFF;
--black: hsla( 0, 0%, 0%,1);
}

/* generiek */
body{
background: rgb(255,255,255);
background: linear-gradient(4deg, rgba(255,255,255,1) 2%, rgba(34,74,136,1) 57%);
display: grid;
grid-template-columns: 1fr;
grid-template-rows: .5fr 1fr 3fr 1fr 2fr;


& p{
color: white;
text-align: center;
font-family: "Poppins", sans-serif;
}

& nav{
background-color: white;
border-radius: .5em;
}

& .first{
position: absolute;
bottom: 50vh;
left: 60vw;
}

& .second{
position: absolute;
bottom: 43vh;
right: 60vw;

}

& .maan{
position: absolute;
bottom: 45vh;
left: 25vw;
}

.time{
position: relative;
z-index: 1;

& p:nth-child(1){
font-size: 40px;
font-weight: 600;
margin-bottom: 0;
}
}
}



header{
font-family: "Poppins", sans-serif;

& h1{
color: white;
font-size: 48px;
margin: 0;
text-align: center;
}
}

body .first,
body .second,
body .maan {
position: absolute;
z-index: 0;
}


.message {
background-color: #F5FAFF;
border-radius: .5em;
margin: auto;
padding: .5em;
grid-area: 4/1/5/2;

& p{
color: black;
max-width: 60vw;
text-align: left;
margin-top: 0;
}

& a{
background-color: #954BE2;
color: white;
border: none;
border-radius: .5em;
padding: 1em;
text-decoration: none;
font-family: "Poppins", sans-serif;
width: 100%;
}
}


.time{
grid-area: 3/1/4/2;
}

.message{
grid-area: 4/1/5/2;
}

/* animations */

/* right to left */
@keyframes moveSideToSide {
0% {
transform: translateX(0);
}
50% {
transform: translateX(100px);
}
100% {
transform: translateX(0);
}
}

/* left to right + little delay */
@keyframes moveSideToSide2 {
0% {
transform: translateX(0);
}
40% {
transform: translateX(-100px);
}
100% {
transform: translateX(0);
}
}

#moving-svg {
animation: moveSideToSide 4s ease-in-out ;
}

#moving-svg2 {
animation: moveSideToSide2 4s ease-in-out ;
}
Loading