Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
cf32192
added hello world from Mohammad
Sharaf0 Oct 5, 2023
0f4f5c0
changing header
derya-aktas83 Oct 5, 2023
97c7e3f
adde hello
KazemMirzayi Oct 5, 2023
17be73d
add package.json
annventsel Oct 5, 2023
c0df4cb
Merge branch 'master' of github.com:annventsel/rock-paper-scissors
annventsel Oct 5, 2023
7d41af3
Merge branch 'master' of https://github.com/annventsel/rock-paper-sci…
derya-aktas83 Oct 5, 2023
b4c11c2
Merge branch 'master' of https://github.com/annventsel/rock-paper-sci…
derya-aktas83 Oct 5, 2023
a0f8b87
Helllo again
KazemMirzayi Oct 5, 2023
7af8a31
From ousssma
Oct 5, 2023
8ad216e
added rock
Sharaf0 Oct 5, 2023
b8cea90
Merge pull request #1 from annventsel/feature/add-rock-html
derya-aktas83 Oct 5, 2023
72d9e41
added bg and score-header
derya-aktas83 Oct 7, 2023
2ceecb9
adding changes in hands part
derya-aktas83 Oct 12, 2023
8183b17
Merge pull request #2 from annventsel/deryas-work
KazemMirzayi Oct 12, 2023
a9f1ac5
fixing images
KazemMirzayi Oct 17, 2023
14302a1
Add a hover
Oct 17, 2023
506e647
Add a rules button
Oct 17, 2023
5e9f23b
first commit
annventsel Oct 19, 2023
7f81775
Try to add rules image / take a look on my change and correct it , I …
Oct 24, 2023
6d8b56d
Fixing the rules button
Oct 26, 2023
f668792
Fixing Java Erorr
Oct 26, 2023
d15ddad
ds
Oct 26, 2023
062e621
fixing somthing
Oct 26, 2023
dc2c679
Merge branch 'master' of github.com:annventsel/rock-paper-scissors
annventsel Oct 26, 2023
f8f4ede
Merging Oussama's work with Master branch
KazemMirzayi Oct 26, 2023
0f664d4
fixing images
KazemMirzayi Nov 19, 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
47 changes: 47 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

document.addEventListener("DOMContentLoaded", function() {
const rulesButton = document.getElementById("rulesButton");
const rules = document.querySelector(".rules");
const rulesContainer = document.querySelector(".rules_container");
const closeButton = document.querySelector(".close_btn");
console.log(rules);
// Function to show the rules
function showRules() {
rules.style.display = "block";

}
// function isrulesshow (){
// if (rules.style.display !== "none")
// return true;
// else
// return false;
// }
function toggleShowRules() {
if (isRulesShown())
   hideRules();
else
   showRules();
}

function isRulesShown() {
return rules.style.display !== "none";
}

function showRules() {
rules.style.display= "block";
}

function hideRules() {
rules.display.style = "none";
}

// Function to hide the rules
function hideRules() {
rules.style.display = "none";
}
// Attach event listener to the "RULES" button
rulesButton.addEventListener("click", toggleShowRules);

// Attach event listener to the "close" button
closeButton.addEventListener("click", hideRules);
});
67 changes: 44 additions & 23 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,37 +1,58 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- displays site properly based on user's device -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- displays site properly based on user's device -->

<link rel="icon" type="image/png" sizes="32x32" href="./images/favicon-32x32.png">

<title>Frontend Mentor | Rock, Paper, Scissors</title>

Score
Rules

You Picked
The House Picked

You Win
You Lose
<title>Rock Paper Scissors</title>
<link rel="stylesheet" href="styles.css">
<script src="./app.js"></script>

Play Again

<!-- Feel free to remove these styles or customise in your own stylesheet 👍 -->
<style>
.attribution { font-size: 11px; text-align: center; }
.attribution a { color: hsl(228, 45%, 44%); }
</style>
</head>

<body>

<div class="container">
<div class="score-header">
<div class="logo">
<img src="images/logo.svg" alt="Logo">
</div>
<div class="score">
<p class="score-name">SCORE</p>
<h1 class="score-number">13</h1>
</div>
</div>
<div class="hands">
<div class="button hand-paper">
<img src="images/icon-paper.svg" alt="Hand paper" class="hand-image">
</div>
<div class="button hand-scissors">
<img src="images/icon-scissors.svg" alt="Hand scissors" class="hand-image">
</div>
<div class="button hand-rock">
<img src="images/icon-rock.svg" alt="Hand rock" class="hand-image">
</div>
</div>
<button class="rules-btn" tabindex="1" id="rulesButton">RULES</button>

<div class="rules">
<div class="rules_container">
<div class="rules_header">
<h2>RULES</h2>
<button class="close_btn">
<img src="./images/icon-close.svg" alt="close button">
</button>
</div>
<img src="./images/image-rules.svg" alt="" class="image-rules">
</div>
</div>


<div class="attribution">
Challenge by <a href="https://www.frontendmentor.io?ref=challenge" target="_blank">Frontend Mentor</a>.
Coded by <a href="#">Your Name Here</a>.
</div>
<script type="module" src="./ main.js"></script>

</body>

</html>
42 changes: 42 additions & 0 deletions modal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
export function showModal() {
var rulesBtn = document.querySelector('.rules-btn');
var imageDiv = document.getElementById('imageDiv');
var closeBtn = document.getElementById('closeBtn');

rulesBtn.addEventListener('click', function() {
imageDiv.style.display = 'block';
});

closeBtn.addEventListener('click', function() {
imageDiv.style.display = 'none';
});
}

// export function showModal() {
// var rulesBtn = document.querySelector('.rules-btn');
// var imageDiv = document.getElementById('imageDiv');

// rulesBtn.addEventListener('click', function() {
// imageDiv.classList.toggle('show');
// });
// }

// function toggleShowRules() {
// if (isRulesShown())
// hideRules();
// else
// showRules();
// }

// function isRulesShown() {
// return rules.display.style !== "none";
// }

// function showRules() {
// rules.display.style = "block";
// }

// function hideRules() {
// rules.display.style = "none";
// }

6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "rock-paper-scissors",
"version": "1.0.0",
"description": "![Design preview for the Rock, Paper, Scissors coding challenge](./design/desktop-preview.jpg)",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
142 changes: 142 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

.container {
display: flex;
justify-content: center;
align-items: flex-start;
height: 100vh;
background: linear-gradient(to top, #000428, #3f4567);
color: #ffffff;
}

.score-header {
width: 45%;
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 2%;
padding: 10px 20px;
background-color: transparent;
border-radius: 20px;
border: solid rgb(248, 244, 244, 0.3) 2px;
}

.logo {
margin-right: auto;
}

.score {
width: 24%;
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
background-color: white;
border-radius: 7px;
margin: 5px 0px;
padding: 13px 15px;
display: flex;
flex-direction: column;
}

.score-name {
font-size: larger;
display: flex;
justify-content: center;
color: #004e92;
}

.score-number {
display: flex;
justify-content: center;
font-size: 48px;
font-weight: bold;
color: rgb(0, 0, 0, 0.6);
}

.hands {
position: relative;
top: 55%;
right: 25%;
}

.button {
border-radius: 50%;
width: 120px;
height: 120px;
color: white;
background-color:azure;
border: 14px solid hsl(349, 71%, 52%);
text-align: center;
padding-top: 35px;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}

.hand-paper {
position: absolute;
right: 80%;
bottom: 150%;
border-color:rgb(75, 67, 238) ;
}

.hand-scissors {
position: absolute;
left: 80%;
bottom: 150%;
border-color: darkorange;
}

.hand-rock {
border-color:rgb(233, 42, 83)
}

.rules-btn {
position: absolute;
bottom: 2rem;
right: 2rem;
background: none;
border-radius: 0.6rem;
border-color: #fff;
color: white;
padding: 0.6rem 2.5rem;
font-family: inherit;
text-transform: inherit;
font-size: 23px;
letter-spacing: 5px;
cursor: pointer;
}

.rules{
position: relative;
/* margin-top: 100px; */
padding: 20px;
}
.rules_container{
background-color: #fff;
padding: 30px 30px;
align-items: center;
border-radius: 10px;
}
.rules_header{
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 2rem;

}
.close_btn{
border: none;
outline: none;
background: none;
font-size: 2rem;
cursor: pointer;
}
.image-rules{
padding: 1rem 2rem;
}
.rules_container .h2 {
color: hsl(229, 25%, 31%);
}
3 changes: 3 additions & 0 deletions  main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { showModal } from './modal.js';

showModal();