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

[BER] André Sebastian #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"esversion": 6
}
20 changes: 20 additions & 0 deletions starter_code/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,26 @@ app.get('/', (req, res, next) => {
res.render('index');
});

app.get('/beers', (req, res, next) => {
punkAPI.getBeers()
.then(beers => {
res.render('beers', {beers: beers});
})
.catch(error => {
console.log(error);
});

});

app.get('/random-beers', (req, res, next) => {
punkAPI.getRandom()
.then(beers => {
res.render('random-beers', {beers: beers});
})
.catch(error => {
console.log(error);
});

});

app.listen(3000);
61 changes: 60 additions & 1 deletion starter_code/public/stylesheets/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,63 @@ dark-blue: #0A2C42;
grey: rgba(145, 145, 145, 0.481);
font-family: Arial, Helvetica, sans-serif
*/

body {
font-family: Arial, Helvetica, sans-serif;
}
nav {
color: white;
list-style-type: none;
}

footer {
background-color: #0A2C42;
color: white;
}

.index-container {
display: flex;
flex-direction: column;
align-items: center;
}

.index-container img {
margin: 30px 0 30px 10px;;
}

.card-img-top {
width: auto;
height: 200px;
margin: 2px auto;
}

.container {
display: flex;
flex-direction: row;
justify-content: center;
flex-wrap: wrap;
flex-shrink: 0.3;
}

.card {
max-height: 440px;
min-width: 300px;
margin: 20px;
overflow: auto;
}

.card-text {
font-size: 0.7em;
}

.random {
display: flex;
flex-direction: row;
align-items: center;
width: 600px;
margin: 50px auto;
}

.beer-image img{
max-width: 150px;
margin-right: 40px;
}
16 changes: 16 additions & 0 deletions starter_code/views/beers.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div class="container">

{{#each beers}}
<div class="card" style="width: 18rem;">
<img class="card-img-top" src="{{this.image_url}}" alt="Card image cap">
<div class="card-body">
<h5 class="card-title">{{this.name}}</h5>
<p class="card-text">{{this.description}}</p>
</div>
</div>
{{/each}}

</div>



8 changes: 7 additions & 1 deletion starter_code/views/index.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<div class="index-container">

<div>
<img src="/images/beer.png" alt="">
</div>
<div>
<a class="btn btn-lg btn-success" href="/beers">Beers</a>
<a class="btn btn-lg btn-success" href="/random-beers">Random Beers</a>
</div>
</div>
44 changes: 44 additions & 0 deletions starter_code/views/layout.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!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">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css">
<link rel="stylesheet" href="/stylesheets/styles.css">
<title>IronBeers</title>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<a class="navbar-brand" href="#">IronBeers</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="/">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="/beers">Beers</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/random-beers">Random Beers</a>
</li>

</ul>
</div>
</nav>

{{{ body }}}

<footer class="page-footer font-small blue fixed-bottom">

<div class="footer-copyright text-center py-3">© 2019 Copyright:
<a href="https://www.aseb-webdev.de"> André Sebastian - Aseb-WebDev</a>
</div>

</footer>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>
</body>
</html>
21 changes: 21 additions & 0 deletions starter_code/views/random-beers.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<div class="random">
{{#each beers}}

<div class="beer-image">
<img src="{{this.image_url}}" alt="">
</div>
<div class="content">
<h1>{{this.name}}</h1>
<h5 class="tagline">{{this.tagline}}</h5>
<p class="card-text">{{this.description}}</p>
<h3>Food pairing</h3>
<ul>
{{#each this.food_pairing}}
<li>{{this}}</li>
{{/each}}
</ul>
<p><strong>Brewers Tips:</strong> {{this.brewers_tips}}</p>
</div>

{{/each}}
</div>