Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
b219cf0
cleared css
caseywar Feb 1, 2021
eec5792
removing css
caseywar Feb 1, 2021
38ff309
stand in card designs for six cards and the back
sorayamajdolashrafi Feb 1, 2021
d4821cf
create basic utility functions
Feb 1, 2021
66b20b9
cardDeck array created for a deck of 12
sorayamajdolashrafi Feb 1, 2021
824d4b9
add createUser() and updateSavedUser()
Feb 1, 2021
495f581
added html pages and nav bar
caseywar Feb 1, 2021
5b8c07e
Merge pull request #5 from KatrinaCloyd/data
sorayamajdolashrafi Feb 1, 2021
aa98234
nav bar fix
caseywar Feb 1, 2021
df40449
event listener for home page to set initial user to local storage
Feb 1, 2021
b916974
Merge branch 'dev' of https://github.com/KatrinaCloyd/MemoryCardGame …
caseywar Feb 1, 2021
84b10e0
Merge pull request #7 from KatrinaCloyd/utilFunctions
KatrinaCloyd Feb 1, 2021
a928721
added form to home page
caseywar Feb 1, 2021
168fe14
Merge branch 'dev' of https://github.com/KatrinaCloyd/MemoryCardGame …
caseywar Feb 1, 2021
38aa410
very very very basic css
sorayamajdolashrafi Feb 1, 2021
66c2e70
Merge pull request #8 from KatrinaCloyd/css
sorayamajdolashrafi Feb 1, 2021
05ce9bb
added html to game page. fixed relative paths
caseywar Feb 1, 2021
f2047b5
user saves to local storage
Feb 1, 2021
6fca183
Merge pull request #10 from KatrinaCloyd/utilFunctions
KatrinaCloyd Feb 1, 2021
1c3bebc
add makeGameBoard()
Feb 1, 2021
d135492
function fixed to create user in storage
Feb 1, 2021
aba9bbf
basic style css, and home page css
sorayamajdolashrafi Feb 1, 2021
dfb44f4
Merge pull request #11 from KatrinaCloyd/utilFunctions
KatrinaCloyd Feb 1, 2021
61d309e
Merge pull request #12 from KatrinaCloyd/css
sorayamajdolashrafi Feb 1, 2021
7dae582
Merge branch 'dev' into game_functions
bperard Feb 1, 2021
dd5533d
Merge pull request #13 from KatrinaCloyd/game_functions
bperard Feb 1, 2021
c052ec9
fix button redirect
Feb 1, 2021
cadeb3b
Merge pull request #15 from KatrinaCloyd/utilFunctions
KatrinaCloyd Feb 1, 2021
4faee2a
added game board div
caseywar Feb 1, 2021
e68a175
fixed nav bar
caseywar Feb 1, 2021
7e57c8c
update makeGameArray() and add makeGameBoard()
Feb 1, 2021
bbed805
Merge pull request #16 from KatrinaCloyd/game_functions
bperard Feb 1, 2021
98cdf9b
home page update with header in nav and paragraph for game instructions
sorayamajdolashrafi Feb 1, 2021
c09a814
hard coding result table
caseywar Feb 1, 2021
1de199a
update makeGameBoard() for proper functionality
Feb 1, 2021
4011f89
Merge branch 'dev' of https://github.com/KatrinaCloyd/MemoryCardGame …
caseywar Feb 1, 2021
9343d24
Merge pull request #17 from KatrinaCloyd/game_functions
bperard Feb 1, 2021
56a67fc
css files connected to html
sorayamajdolashrafi Feb 1, 2021
178bf30
Merge pull request #19 from KatrinaCloyd/css
sorayamajdolashrafi Feb 1, 2021
1cb9c1d
table fix
caseywar Feb 1, 2021
3b91b9d
fully updated file tree
sorayamajdolashrafi Feb 1, 2021
baef5e6
Merge branch 'dev' of https://github.com/KatrinaCloyd/MemoryCardGame …
caseywar Feb 1, 2021
fd5022d
Merge pull request #21 from KatrinaCloyd/css
sorayamajdolashrafi Feb 1, 2021
47271d2
fixed the table formatting
caseywar Feb 1, 2021
2955ddb
Merge branch 'dev' of https://github.com/KatrinaCloyd/MemoryCardGame …
caseywar Feb 1, 2021
e2a0946
add click handler functions to card img elements and update game.css …
Feb 1, 2021
7272690
Merge pull request #22 from KatrinaCloyd/game_functions
bperard Feb 1, 2021
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
41 changes: 41 additions & 0 deletions about-us/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!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="../styles/style.css">
<link rel="stylesheet" href="./results.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link
href="https://fonts.googleapis.com/css2?family=Chonburi&family=Prompt:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,900&display=swap"
rel="stylesheet">

<title>about us</title>
</head>

<body>
<header>
<header>
<h1>vampire match</h1>
<div class="topnav">
<a href="../">Home</a>
<a href="../results">Score Board</a>
<a href="../about-us">About Us</a>
</div>

</header>
</header>
<main>
<section class="main-section">
ABOUT US
</section>
</main>
<footer>
</footer>

<script type="module" src="./results.js"></script>
</body>

</html>
Empty file added about-us/results.css
Empty file.
Empty file added about-us/results.js
Empty file.
32 changes: 31 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
// import functions and grab DOM elements
import { saveUsers, getUsers, setCurrentUser, findById } from './utils.js';

// initialize state

// set event listeners to update state and DOM
// set event listeners to update state and DOM

const form = document.querySelector('form');

form.addEventListener('submit', (e) => {
e.preventDefault();

const formData = new FormData(form);
const currentUser = formData.get('name');
const existingUsers = getUsers();
const userInArray = findById(formData.get('name'), existingUsers);

if (!existingUsers) {
const user = [{
name: formData.get('name'),
scores: [],
}];
saveUsers(user);
setCurrentUser(currentUser);
//console.log(currentUser);
} else if (userInArray) {
setCurrentUser(currentUser);
} else {
const user = { name: formData.get('name'), scores: [], };
existingUsers.push(user);
saveUsers(existingUsers);
setCurrentUser(currentUser);
}
window.location = './game/index.html';
});
Binary file added assets/cards/mock-up-back.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 assets/cards/mock-up-five.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 assets/cards/mock-up-four.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 assets/cards/mock-up-one.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 assets/cards/mock-up-six.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 assets/cards/mock-up-three.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 assets/cards/mock-up-two.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const cardDeck = [
{
id: 1,
name: 'one',
img: 'mock-up-one.png',
},
{
id: 2,
name: 'two',
img: 'mock-up-two.png',
},
{
id: 3,
name: 'three',
img: 'mock-up-three.png',
},
{
id: 4,
name: 'four',
img: 'mock-up-four.png',
},
{
id: 5,
name: 'five',
img: 'mock-up-five.png',
},
{
id: 6,
name: 'six',
img: 'mock-up-six.png',
},
];

export default cardDeck;
7 changes: 7 additions & 0 deletions game/game.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.hidden {
display: none;
}

#game-board img {
padding: .25rem;
}
91 changes: 91 additions & 0 deletions game/game.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
// switch to cardDeck import

export function createUser(name, difficulty) {
const user = {};
user.name = name;
user.difficulty = difficulty;
user.clicks = 0;

return activeUser;
}

export function updateSavedUser(savedUser, activeUser) {
const difficulty = activeUser.difficulty;
savedUser[difficulty].push(activeUser.clicks);
}

export function makeGameArray(deck, gameBoardSize) {
const halfDeck = deck.splice(0, gameBoardSize / 2);
const fullDeck = halfDeck.concat(halfDeck);

const gameboardArray = [];

for (let i = gameBoardSize; i > 0; i--) {
const cardIndex = Math.floor(Math.random() * i);
gameboardArray.push(...fullDeck.splice(cardIndex, 1));
}

return gameboardArray;
}

export function makeGameBoard(gameBoardSize) {
const gameboardArray = makeGameArray(deck, gameBoardSize);
const gameBoard = document.querySelector('#game-board');

for (let card of gameboardArray) {
const img = document.createElement('img');
img.src = `../assets/cards/${card.img}`;
img.classList.add(card.name);
img.classList.toggle('hidden');

const imgBack = document.createElement('img');
imgBack.src = `../assets/cards/mock-up-back.png`;

imgBack.addEventListener('click', () => {
imgBack.classList.toggle('hidden');
img.classList.toggle('hidden');
});

img.addEventListener('click', () => {
imgBack.classList.toggle('hidden');
img.classList.toggle('hidden');
});

gameBoard.append(img, imgBack);
}
}

const deck = [
{
id: 1,
name: 'one',
img: 'mock-up-one.png',
},
{
id: 2,
name: 'two',
img: 'mock-up-two.png',
},
{
id: 3,
name: 'three',
img: 'mock-up-three.png',
},
{
id: 4,
name: 'four',
img: 'mock-up-four.png',
},
{
id: 5,
name: 'five',
img: 'mock-up-five.png',
},
{
id: 6,
name: 'six',
img: 'mock-up-six.png',
},
];

makeGameBoard(12);
43 changes: 43 additions & 0 deletions game/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!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="../styles/style.css">
<link rel="stylesheet" href="./game.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link
href="https://fonts.googleapis.com/css2?family=Chonburi&family=Prompt:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,900&display=swap"
rel="stylesheet">

<title>game board</title>
</head>

<body>

<header>
<h1>vampire match</h1>
<div class="topnav">
<a href="../">Home</a>
<a href="../results">Score Board</a>
<a href="../about-us">About Us</a>
</div>

</header>
<main>
<section class="main-section">
ABOUT US
<div id="game-board">

</div>
</section>
</main>
<footer>
</footer>

<script type="module" src="./game.js"></script>
</body>

</html>
67 changes: 38 additions & 29 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,59 @@
<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 href="https://fonts.googleapis.com/css2?family=Titillium+Web:wght@300&display=swap" rel="stylesheet">
<link rel="stylesheet" href="styles/reset.css">
<link rel="stylesheet" href="styles/style.css">
<link rel="stylesheet" href="styles/home.css">
<title>Document</title>
<link rel="stylesheet" href="../styles/style.css">
<link rel="stylesheet" href="../styles/home.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link
href="https://fonts.googleapis.com/css2?family=Chonburi&family=Prompt:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,900&display=swap"
rel="stylesheet">
<title>start</title>
</head>

<body>
<header>
<div class="gutter-right logo">
<img src="assets/big-logo.png"/>
<h1>vampire match</h1>
<div class="topnav">
<a href="../">Home</a>
<a href="../results">Score Board</a>
<a href="../about-us">About Us</a>
</div>

</header>
<main>
<section class="main-section">
<img class="main-logo" src="assets/alchemy-logo.png"/>
<h2>
Welcome to Alchemy Bootstrap!
</h2>

<content>
<p>
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Aperiam repellendus similique consectetur voluptas facilis molestiae voluptates nobis error sapiente, ad, ipsa vero non, sint eligendi? Eos praesentium iusto magnam exercitationem.
Earum sunt voluptatibus molestias, sint voluptatum quos reiciendis. Id asperiores deleniti dolores provident, eius, nostrum aperiam vel, optio qui illo corrupti in. Eum quam, est nemo porro sapiente excepturi assumenda.
Rerum unde quidem maxime. Ullam, dolores labore molestias voluptatibus adipisci quod? Quaerat nihil inventore molestiae assumenda, voluptates vel necessitatibus eligendi? Accusamus ratione eligendi reprehenderit? Beatae incidunt molestias ea soluta nulla.
Fugiat quae soluta voluptate mollitia praesentium modi ex illo, autem assumenda, vel aliquam fugit possimus dolorem esse corporis ipsa! Voluptatem sapiente error non, ea optio suscipit quasi maxime nobis ex?
Et ipsa tenetur ullam ab nesciunt quas fugit velit impedit illum esse eligendi corporis culpa praesentium aspernatur ex sint veniam quidem, doloribus corrupti hic vitae. Eum neque ducimus omnis exercitationem?
</p>
<hr />
<p>
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Aperiam repellendus similique consectetur voluptas facilis molestiae voluptates nobis error sapiente, ad, ipsa vero non, sint eligendi? Eos praesentium iusto magnam exercitationem.
Earum sunt voluptatibus molestias, sint voluptatum quos reiciendis. Id asperiores deleniti dolores provident, eius, nostrum aperiam vel, optio qui illo corrupti in. Eum quam, est nemo porro sapiente excepturi assumenda.
Rerum unde quidem maxime. Ullam, dolores labore molestias voluptatibus adipisci quod? Quaerat nihil inventore molestiae assumenda, voluptates vel necessitatibus eligendi? Accusamus ratione eligendi reprehenderit? Beatae incidunt molestias ea soluta nulla.
Fugiat quae soluta voluptate mollitia praesentium modi ex illo, autem assumenda, vel aliquam fugit possimus dolorem esse corporis ipsa! Voluptatem sapiente error non, ea optio suscipit quasi maxime nobis ex?
Et ipsa tenetur ullam ab nesciunt quas fugit velit impedit illum esse eligendi corporis culpa praesentium aspernatur ex sint veniam quidem, doloribus corrupti hic vitae. Eum neque ducimus omnis exercitationem?
</p>
<p>It's matching time! Play your basic matching memory game, but vampire style!</p>
<section class="form">
<form>
<label>
<span>Name:</span>
<input class="name" name="name">
</label>
<br>
<span class="Difficulty Level">Choose your difficulty:</span>
<label>
<span class="card">12 Card</span>
<input type="radio" name="game" value="easy">
</label>
<label>
<span class="card">24 Card</span>
<input type="radio" name="game" value="medium">
</label>
<label>
<span class="card">48 Card</span>
<input type="radio" name="game" value="hard">
</label>
<button>Play</button>
</form>
</section>

</section>
</main>
<footer>
<div class="copy gutter-right">&copy; 2020 Alchemy Code Lab</div>
</footer>

<script type="module" src="app.js"></script>
<script type="module" src="./app.js"></script>
</body>

</html>
Loading