Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
af8a713
Hand-off
josephmccomas Jan 10, 2023
ff778b8
220110-1035-j-takeover
jeremymwood Jan 10, 2023
9c3450f
220110-1050-lets-try-codespace
jeremymwood Jan 10, 2023
d0176e8
220110-1054
jeremymwood Jan 10, 2023
d2285a0
220110-1059
jeremymwood Jan 10, 2023
a009dc0
230110-1116
jeremymwood Jan 10, 2023
db807b0
Test push
josephmccomas Jan 10, 2023
7aa94ba
230110-1118 Test push
josephmccomas Jan 10, 2023
bf907ce
Merge branch 'master' of https://github.com/Coffee-Project-Jeremy-Jos…
josephmccomas Jan 10, 2023
e9ac0eb
220110-1130
jeremymwood Jan 10, 2023
1e8cc84
Hand-off
josephmccomas Jan 10, 2023
a611a99
Merge remote-tracking branch 'origin/master'
josephmccomas Jan 10, 2023
1ab4aba
220110-1203
jeremymwood Jan 10, 2023
a0fe7ee
220110-1205
jeremymwood Jan 10, 2023
6d07e21
220110-1233
jeremymwood Jan 10, 2023
6561e2e
Hand-off
josephmccomas Jan 10, 2023
588de9c
Merge remote-tracking branch 'origin/master'
josephmccomas Jan 10, 2023
31154a5
220110-1353
jeremymwood Jan 10, 2023
74ba13a
220110-1411
jeremymwood Jan 10, 2023
12ebd7f
Hand-off
josephmccomas Jan 10, 2023
736d91b
Merge remote-tracking branch 'origin/master'
josephmccomas Jan 10, 2023
2a45580
220110-1435
jeremymwood Jan 10, 2023
156c76f
Hand-off
josephmccomas Jan 10, 2023
a02b0e7
Merge remote-tracking branch 'origin/master'
josephmccomas Jan 10, 2023
93a871d
Hand-off
josephmccomas Jan 10, 2023
720c215
Farm image
josephmccomas Jan 10, 2023
8dfaebd
220110-2256-stop-work
jeremymwood Jan 11, 2023
c17cfc5
220111-0838-working-on-grid
jeremymwood Jan 11, 2023
8c5aaa1
220111-0840-all-selector-woring
jeremymwood Jan 11, 2023
2e950c6
220111-0858-working-on-flex
jeremymwood Jan 11, 2023
a1c2633
220111-0906-coffees-side-by-side
jeremymwood Jan 11, 2023
612fc37
220111-0913
jeremymwood Jan 11, 2023
22a018b
220111-0914
jeremymwood Jan 11, 2023
6b594bd
220111-0928
jeremymwood Jan 11, 2023
ac686f2
220111-1214
jeremymwood Jan 11, 2023
85909f0
220111-1219
jeremymwood Jan 11, 2023
70c91d6
220111-1237
jeremymwood Jan 11, 2023
e74a20c
220111-1342
jeremymwood Jan 11, 2023
2670313
220111-1411-add-coffee-complete
jeremymwood Jan 11, 2023
8539d6a
220111-1444
jeremymwood Jan 11, 2023
d6a363d
220111-1513
jeremymwood Jan 11, 2023
ba258b8
1542
jeremymwood Jan 11, 2023
c713b69
1612
jeremymwood Jan 11, 2023
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
.idea
*.iml
23 changes: 23 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@import url('https://fonts.googleapis.com/css2?family=Abel&family=Anton&family=Lato:wght@300&family=Montserrat:wght@400;600&family=Roboto&family=Source+Code+Pro&family=Work+Sans&display=swap');
* {
font-family: 'Montserrat', sans-serif;
;
}
h1, h3 {
padding-top: .5em;
display: flex;
justify-content: center;
}
select, input {
width: 100%;
}
h1, h3, label {
font-weight: bold;
}
.coffeeName {
font-size: 1.5em;
font-weight: bolder;
}
.light, .medium, .dark {
color: gray;
}
Binary file added img/DarkBeans.jpg
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 img/LightBeans.jpg
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 img/MeduimBeans.jpg
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 img/farm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 40 additions & 27 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,46 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="style.css">
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>jwood-r1 Coffee Project</title>
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link href="https://fonts.googleapis.com/css2?family=Abel&family=Anton&family=Lato:wght@300&family=Montserrat&family=Roboto&family=Source+Code+Pro&family=Work+Sans&display=swap" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link rel="stylesheet" href="css/style.css">
<script src="https://kit.fontawesome.com/4d0b40d330.js" crossorigin="anonymous"></script>
</head>
<body>
<h1>Coffee!</h1>

<form>
<label for="roast-selection"></label>
<select id="roast-selection">
<option>light</option>
<option>medium</option>
<option>dark</option>
</select>
<input id="submit" type="submit" />
</form>

<table>
<thead>
<tr>
<th>ID</th>
<th>NAME</th>
<th>ROAST</th>
</tr>
</thead>
<tbody id="coffees"></tbody>
</table>

<script src="main.js"></script>
<body class="m-3">
<h1>Coffee!</h1>
<hr>
<div class="container-fluid mx-0">
<div class="row">
<div class="col-6 px-0" id="coffees"></div>
<form class="col-6 px-0">
<label class="pb-2" for="roast-selection">Reset</label>
<select id="roast-selection">
<option>all</option>
<option>light</option>
<option>medium</option>
<option>dark</option>
</select>
<label class="py-2" for="roast-selection">Coffee Name</label>
<input class="form-control" id="enterCoffee" type="text" placeholder="enter coffee name here" aria-label="default input example" onclick="searchCoffees">
<button type="button" class="btn btn-primary w-100 mt-2" id="submit1">Submit</button>
<hr>
<h3>Add A Coffee</h3>
<label class="pb-2" for="roast-selection">Roast</label>
<select id="add-roast-selection">
<option>light</option>
<option>medium</option>
<option>dark</option>
</select>
<label class="py-2 text-grey" for="roast-selection">Name</label>
<input class="form-control" id="enterNewCoffee"type="text" placeholder="enter coffee name here" aria-label="default input example">
<button type="button" class="btn btn-primary w-100 mt-2" id="submit2">Submit</button>
</form>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<script src="main.js"></script>
</body>
</html>
69 changes: 48 additions & 21 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,57 @@
"use strict"

function renderCoffee(coffee) {
var html = '<tr class="coffee">';
html += '<td>' + coffee.id + '</td>';
html += '<td>' + coffee.name + '</td>';
html += '<td>' + coffee.roast + '</td>';
html += '</tr>';
let html = '<div class="coffee col-12" id="' + coffee.id + '">';
// html += '<td>' + coffee.id + '</td>';
html += '<div class="row">';
// let coffeeItem =
html += '<div class="coffeeName col-6" id="' + coffee.name + '">' + coffee.name + '</div>';
html += '<div class="col-6 ' + coffee.roast + '">' + coffee.roast + '</div>';
html += '</div>';
html += '</div>';

return html;
}

function renderCoffees(coffees) {
var html = '';
for(var i = coffees.length - 1; i >= 0; i--) {
let html = '';
for(let i = 0; i <= coffees.length - 1; i++) {
html += renderCoffee(coffees[i]);
}
return html;
}

function updateCoffees(e) {
e.preventDefault(); // don't submit the form, we just want to update the data
var selectedRoast = roastSelection.value;
var filteredCoffees = [];
let selectedRoast = roastSelection.value;
let filteredCoffees = [];
coffees.forEach(function(coffee) {
if (coffee.roast === selectedRoast) {
filteredCoffees.push(coffee);
}
if ("all" === selectedRoast) {
filteredCoffees.push(coffee);
}
});
tbody.innerHTML = renderCoffees(filteredCoffees);
content.innerHTML = renderCoffees(filteredCoffees);
}

// from http://www.ncausa.org/About-Coffee/Coffee-Roasts-Guide
var coffees = [
function addCoffees(value) {
let filteredCoffees = coffees;
let newRoast = addRoastSelection.value;
let newName = addNewCoffee.value;
let newId = coffees.length + 1;
coffees.push({id: newId, name: newName, roast: newRoast});
content.innerHTML = renderCoffees(filteredCoffees);
// addRoastSelection.value = document.getElementById("add-roast-selection").value = "";
addNewCoffee.value = document.getElementById('enterNewCoffee').value = "";
}
function searchCoffees(value) {
let filteredCoffees = [];
for (let i = 0; i < coffees.length; i++) {
if(coffees[i].name.toLowerCase().indexOf(value.toLowerCase()) > -1) {
filteredCoffees.push(coffees[i]);
}
}
content.innerHTML = renderCoffees(searchCoffeesBar);
}
let coffees = [
{id: 1, name: 'Light City', roast: 'light'},
{id: 2, name: 'Half City', roast: 'light'},
{id: 3, name: 'Cinnamon', roast: 'light'},
Expand All @@ -47,11 +67,18 @@ var coffees = [
{id: 13, name: 'Italian', roast: 'dark'},
{id: 14, name: 'French', roast: 'dark'},
];
let content = document.querySelector('#coffees');
let submitButton = document.querySelector('#submit1');
let submitButton2 = document.querySelector('#submit2');
let roastSelection = document.querySelector('#roast-selection');
let addRoastSelection = document.querySelector('#add-roast-selection');
let addNewCoffee = document.querySelector('#enterNewCoffee');
let searchCoffeesBar = document.getElementById("#enterCoffee");

var tbody = document.querySelector('#coffees');
var submitButton = document.querySelector('#submit');
var roastSelection = document.querySelector('#roast-selection');
content.innerHTML = renderCoffees(coffees);

tbody.innerHTML = renderCoffees(coffees);
roastSelection.addEventListener('click', updateCoffees);
submitButton2.addEventListener('click', addCoffees);
submitButton.addEventListener('click', searchCoffees);

submitButton.addEventListener('click', updateCoffees);
// change
9 changes: 0 additions & 9 deletions style.css

This file was deleted.