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

Add all files #215

Open
wants to merge 3 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Wu-Tang Clan Name Generator</title>
<link rel="stylesheet" href="./style.css">
<script src="./index.js" defer></script>
</head>

<body>
<h1>Wu-Tang Clan-Ish Generator</h1>
<form action="">
<div class="question">
<label for="color">Pick a Color</label>
<select name="color" id="color" required>
<option value=""></option>
<option value="0">Red</option>
<option value="1">Green</option>
<option value="2">Blue</option>
<option value="3">Black</option>
<option value="4">Pink</option>
<option value="5">Purple</option>
<option value="6">Brown</option>
<option value="7">Mauve</option>
<option value="8">Lilac</option>
<option value="9">Crimson</option>
</select>
</div>
<div class="question">
<label for="age">How old are you?</label>
<select name="age" id="age" required>
<option value=""></option>
<option value="0">Under 18</option>
<option value="1">18-24</option>
<option value="2">25-34</option>
<option value="3">35-44</option>
<option value="3">45-100+</option>
</select>
</div>
<div class="question">
<label for="food">What's your favorite food?</label>
<select name="food" id="food" required>
<option value=""></option>
<option value="0">Pizza</option>
<option value="1">Burgers</option>
<option value="2">Tacos</option>
<option value="3">Sushi</option>
<option value="4">Pasta</option>
<option value="5">Salad</option>
</select>
</div>
<div class="question">
<label for="animal">Pick an animal</label>
<select name="animal" id="animal" required>
<option value=""></option>
<option value="0">Dog</option>
<option value="1">Cat</option>
<option value="2">Bird</option>
<option value="3">Fish</option>
<option value="4">Lion</option>
<option value="5">Elephant</option>
</select>
</div>
<div class="question">
<label for="music">What's your favorite music genre?</label>
<select name="music" id="music" required>
<option value=""></option>
<option value="0">Hip-Hop</option>
<option value="1">Rock</option>
<option value="2">Pop</option>
<option value="3">Jazz</option>
<option value="4">Afrobeats</option>
<option value="5">Reggae</option>
<option value="6">R&B</option>
<option value="7">Blues</option>
<option value="8">Soul</option>
<option value="9">Funk</option>
<option value="10">Amapiano</option>
<option value="11">Kwaito</option>
<option value="12">Gospel</option>
<option value="13">House</option>
<option value="14">Techno</option>
<option value="15">Classical</option>
<option value="16">Country</option>
</select>
</div>
<button type="submit">Generate Name</button>
<p><span class="result"></span></p>

</form>
</body>

</html>
22 changes: 22 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//wutang clan generator
const prefixes = ['Funky', 'Childish', 'Goofy', 'Dark', 'Hyper', 'Mean', 'Insane', 'Mad', 'Silly', 'Wacky', 'Wild', 'Wicked', 'Zany'];
const suffixes = ['Ghost', 'Master', 'Killa', 'Blade', 'Tiger', 'Phoenix', 'Spirit', 'Warrior', 'Assassin', 'Dragon', 'Wizard', 'Pirate', 'Hawk'];
const length = 13;

document.querySelector('form').addEventListener('submit', generateName);

function generateName(e) {
e.preventDefault();

const color = Number(document.getElementById('color').selectedOptions[0].value);
const age = Number(document.getElementById('age').selectedOptions[0].value);
const food = Number(document.getElementById('food').selectedOptions[0].value);
const animal = Number(document.getElementById('animal').selectedOptions[0].value);
const genre = Number(document.getElementById('music').selectedOptions[0].value);

const prefix = prefixes[(color + age) % length];
const suffix = suffixes[(food + animal + genre) % length];

const result = `Your name is ${prefix} ${suffix}`
document.querySelector('.result').textContent = result;
}
28 changes: 28 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
body{
background: black;
color: white;
font-size: 1.2rem;
}

form{
display: flex;
flex-direction: column;
width: 60%;
gap: 1rem;
margin: 0 auto;
}

h1{
text-align: center;
}

select{
padding: 0 0.5rem;
align-self: right;
width: 30%;
}

.question{
display: flex;
justify-content: space-between;
}