Last active
March 1, 2018 19:47
-
-
Save IagoLast/a1baf33d892cab12d8abcdfceffee482 to your computer and use it in GitHub Desktop.
Custom manfred client for sauce-jobs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Manfred - API</title> | |
<style> | |
* { | |
box-sizing: border-box; | |
} | |
body { | |
margin: 0; | |
padding: 0; | |
font-family: sans-serif; | |
background: #f2f6f9; | |
} | |
nav { | |
text-align: center; | |
font-weight: bolder; | |
padding: 30px; | |
font-size: 1.2em; | |
} | |
article { | |
font-weight: 100; | |
display: block; | |
background: white; | |
padding: 30px; | |
border-bottom: 1px solid #ccc; | |
} | |
</style> | |
</head> | |
<body> | |
<nav> | |
Sauce Jobs 💕 Manfred | |
</nav> | |
<script> | |
fetch('https://sauce-jobs-staging.herokuapp.com/jobs') | |
.then(data => data.json()) | |
.then(offers => { | |
offers | |
.filter(offer => offer.description.includes('@') && offer.description.includes('€')) | |
.sort((a, b) => a.createdAt <= b.createdAt) | |
.forEach(addOffer) | |
}) | |
function addOffer(offer) { | |
const offerElement = document.createElement('article'); | |
offerElement.innerHTML = ` | |
<div> ${offer.description} </div> | |
<a href="${offer.link}" > ${offer.link}</a> | |
`; | |
document.body.appendChild(offerElement); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment