Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions app/package-lock.json

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

2 changes: 2 additions & 0 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"react": "^18.1.0",
"react-bootstrap": "^2.4.0",
"react-dom": "^18.1.0",
"react-helmet": "^6.1.0",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
Expand Down
41 changes: 41 additions & 0 deletions app/src/components/Hangman.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,44 @@ body {
background-attachment: fixed;
background-size: cover;
}

#image {
position: absolute;
left: 50px;
top: 100px;
width: 40%;
height: auto;
}


#keyboard {
padding-top: 16px;
}

#keyboard .line {
display: flex;
width: max-content;
margin: 0 auto;
}

#keyboard .key {
background-color: white;
padding: 16px;
margin: 6px 12px;
cursor: pointer;
border-radius: 5px;
}

#keyboard .key.locked {
background-color: darkgray !important;
cursor: default !important;
}

#keyboard .key.clicked {
background-color: rgb(1,87,155);
box-shadow: none;
}

#keyboard .key.clicked.locked {
background-color: rgb(92, 92, 92) !important;
}
40 changes: 7 additions & 33 deletions app/src/components/Hangman.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React, { useState, useEffect, useCallback } from "react";
import { randomWord } from "./Words";
import "./Hangman.css";
import { Helmet } from "react-helmet";
// import Keyboard from "./keyboard/createKeyboard.js"

// import hangman images here:
import initial_state from "../assets/initial_state.svg";
Expand All @@ -11,36 +13,6 @@ import state4 from "../assets/state4.svg";
import state5 from "../assets/state5.svg";
import state6 from "../assets/state6.svg";

// List of alphabets in the english language
const alphabetList = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
];

// List of images
const imageList = [
initial_state,
Expand Down Expand Up @@ -124,7 +96,7 @@ const Hangman = () => {
<h1> Hangman </h1>
</div>
<div className="hangman-image">
<img src={imageList[imageID]} alt="hangman" />
<img id="image" src={imageList[imageID]} alt="hangman" />
</div>
<div className="letters-container">
{[
Expand All @@ -138,8 +110,10 @@ const Hangman = () => {
))}
</div>
<br />
<div className="alphabets-container">
{/* TODO: Add alphabets here. Task is just to map the given alphabets */}
<div id="keyboard">
<Helmet>
<script src="/keyboard/script.js" type="text/javascript" />
</Helmet>
</div>
</div>
);
Expand Down
Loading