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

Dev #1

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
30 changes: 9 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,15 @@
## The Golden Rule:
# Fortune Teller plan

🦸 🦸‍♂️ `Stop starting and start finishing.` 🏁
![](wireframe.png)

If you work on more than one feature at a time, you are guaranteed to multiply your bugs and your anxiety.
## Set up HTML and CSS

## Making a plan
## Random answer between 1 & length -1

1. **Make a drawing of your app. Simple "wireframes"**
1. **Look at the drawing and name the HTML elements you'll need to realize your vision**
1. **Look at the drawing and imagine using the app. What _state_ do you need to track?**
1. **For each HTML element ask: Why do I need this? (i.e., "we need div to display the results in")**
1. **Once we know _why_ we need each element, think about how to implement the "Why" as a "How" (i.e., `resultsEl.textContent = newResults`)**
1. **Find all the 'events' (user clicks, form submit, on load etc) in your app. Ask one by one, "What happens when" for each of these events. Does any state change? Does any DOM update?**
1. **Think about how to validate each of your features according to a Definition of Done. (Hint: console.log usually helps here.)**
1. **Consider what features _depend_ on what other features. Use this dependency logic to figure out what order to complete tasks.**
## Add mystical image

Additional considerations:
## Set the answer to the random choice

- Ask: which of your HTML elements need to be hard coded, and which need to be dynamically generated?
- Consider your data model.
- What kinds of objects (i.e., Dogs, Friends, Todos, etc) will you need?
- What are the key/value pairs?
- What arrays might you need?
- What needs to live in a persistence layer?
- Is there some state we need to initialize?
- Ask: should any of this work be abstracted into functions? (i.e., is the work complicated? can it be reused?)
# Add event listeners for submit button and try again button

## Add toggle for mystical picture and prompt
44 changes: 38 additions & 6 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,43 @@
/* Imports */

/* Get DOM Elements */
const answerBtn = document.getElementById('answer');
const resetBtn = document.getElementById('reset');
const promptSection = document.getElementById('prompt');
const fortuneSection = document.getElementById('fortune');
const responseP = document.getElementById('response');

/* State */
const responses = [
'Yes, bestie go for it',
'For sure',
'I guess',
'I would love that for you!',
'That is a no from me, dog',
'As I see it... yes',
'Yes and I am so happy for you!',
'Probably babes',
'Signs point to YES!',
'The future is hazy, try again',
'Ask me later *flips hair*',
'You do not wanna know girl',
'You do not want that to happen bestie!',
'Look me in the eyes and ask me again',
'Don’t count on it bestie',
'My reply is absolutely not',
'My trusted sources say that you will slip on a banana peel instead. Sorry :/',
'Keep dreaming girl',
'I doubt it!',
];

/* Events */
// my functions
function toggleSections() {
promptSection.classList.toggle('hide');
fortuneSection.classList.toggle('hide');
}

/* Display Functions */
answerBtn.addEventListener('click', () => {
toggleSections();
const randInt = Math.floor(Math.random() * responses.length);
const randomChoice = responses[randInt];
responseP.textContent = randomChoice;
});

// (don't forget to call any display functions you want to run on page load!)
resetBtn.addEventListener('click', toggleSections);
Binary file added assets/Coffin_icon.112.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/crystalball.png.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/magic8ball2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 48 additions & 37 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,39 +1,50 @@
<!DOCTYPE html>
<html lang="en">

<head>
<!-- metadata -->
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />

<!-- title and favicon -->
<title>Web App</title>
<link rel="icon" type="image/x-icon" href="assets/alchemy-favicon.png" />

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

<!-- fonts -->
<!-- see https://fonts.google.com/ -->

<!-- css -->
<link rel="stylesheet" href="styles/reset.css" />
<link rel="stylesheet" href="styles/global.css" />
<!-- add link for page specific css -->

</head>

<body>
<header>
<img class="logo" src="assets/html_css_js.png" alt="logo">
<h1>Web App</h1>
</header>

<main>

</main>

</body>

</html>
<head>
<!-- metadata -->
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />

<!-- title and favicon -->
<title>Fortune Teller</title>
<link rel="icon" type="image/x-icon" href="assets/Coffin_icon.112.png" />

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

<!-- fonts -->
<!-- see https://fonts.google.com/ -->
<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=Amatic+SC&display=swap"
rel="stylesheet"
/>

<!-- css -->
<link rel="stylesheet" href="styles/reset.css" />
<link rel="stylesheet" href="styles/global.css" />
<!-- add link for page specific css -->
</head>

<body>
<header>
<img class="logo" src="assets/crystalball.png.png" alt="logo" />
<h1>Fortune Teller</h1>
</header>

<main>
<section id="prompt" class="prompt">
<p>What do you want to know?</p>
<input type="text" placeholder="Be careful what you wish for..." />
<button id="answer">Answer!</button>
</section>
<section id="fortune" class="fortune hide">
<img src="./assets/magic8ball2.jpg" alt="magic 8 ball" height="300px" />
<p id="response"></p>
<button id="reset">Ask again!</button>
</section>
</main>
</body>
</html>
42 changes: 35 additions & 7 deletions styles/global.css
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
:root {
--background: rgb(224, 234, 247);
--header-background: rgb(254, 251, 245);
--primary-font: Corbel, 'Lucida Grande', 'Lucida Sans Unicode', 'Lucida Sans', 'DejaVu Sans',
'Bitstream Vera Sans', 'Liberation Sans', Verdana, 'Verdana Ref', sans-serif;
--background: rgb(119, 111, 129);
--header-background: rgb(181, 177, 189);
--primary-font: 'Amatic SC', cursive, 'Lucida Grande', 'Lucida Sans Unicode', 'Lucida Sans',
'DejaVu Sans', 'Bitstream Vera Sans', 'Liberation Sans', Verdana, 'Verdana Ref', sans-serif;
}

body {
font-family: var(--primary-font);
background: var(--background);
display: grid;
grid-template-rows: auto 1fr;
grid-template-columns: auto 1fr;
font-size: 40px;
font-weight: bold;
}

header {
position: sticky;
display: flex;
top: 0;
padding: 15px;
height: 80px;
Expand All @@ -33,3 +34,30 @@ header .logo {
main {
padding: 20px;
}

.fortune {
padding: 20px;
}

.prompt {
padding: 5px;
}

.hide {
display: none;
}

button {
font-family: 'Amatic SC', cursive;
font-weight: bold;
text-align: center;
height: 45px;
width: 90px;
margin: 5px;
font-size: 22px;
}

input {
height: 45px;
width: 200px;
}
Binary file added wireframe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.