diff --git a/README.md b/README.md index d02719c..4221fe8 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,16 @@ -## The Golden Rule: +![wireframe of MAGIC-8-BALL](assets/8BALLwireframe.png) -🦸 🦸‍♂️ `Stop starting and start finishing.` 🏁 +# HTML -If you work on more than one feature at a time, you are guaranteed to multiply your bugs and your anxiety. +- 2 sections +- h - for title and circles +- input - for question +- button -## Making a plan +# EVENT -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.** - -Additional considerations: - -- 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?) +- button click +- hide section +- display section +- pick a random number between 0 and length of array +- set the content of the answer to the random choice diff --git a/app.js b/app.js index 2a4309c..08c05df 100644 --- a/app.js +++ b/app.js @@ -1,11 +1,48 @@ -/* Imports */ +const questionSection = document.getElementById('question-section'); +const answerSection = document.getElementById('answer-section'); +const button = document.getElementById('button'); +const askAgain = document.getElementById('ask-button'); +const answer = document.getElementById('answer'); +const input = document.getElementById('input'); -/* Get DOM Elements */ +const answers = [ + 'Yes, definitely', + 'It is certain', + 'It is decidedly so', + 'Without a doubt', + 'You may rely on it', + 'As I see it, yes', + 'Most Likely', + 'Outlook good', + 'Signs point to yes', + 'Outlook hazy, try again', + 'Ask again later', + 'Better not tell you now', + 'Cannot predict now', + 'Concentrate and ask again', + 'Don’t count on it', + 'My reply is no', + 'My sources say no', + 'Outlook not so good', + 'Very doubtful', +]; -/* State */ +button.addEventListener('click', () => { + toggleSections(); -/* Events */ + const randomInt = Math.floor(Math.random() * answers.length); + const randomChoice = answers[randomInt]; + input.value = ''; + answer.textContent = randomChoice; +}); -/* Display Functions */ +function toggleSections() { + questionSection.classList.toggle('hide'); + answerSection.classList.toggle('hide'); +} -// (don't forget to call any display functions you want to run on page load!) +askAgain.addEventListener('click', () => { + toggleSections(); +}); + +answers.style.fontFamily = 'Fredoka One'; diff --git a/assets/8.png b/assets/8.png new file mode 100644 index 0000000..f6bba7b Binary files /dev/null and b/assets/8.png differ diff --git a/assets/8BALLwireframe.png b/assets/8BALLwireframe.png new file mode 100644 index 0000000..efb1284 Binary files /dev/null and b/assets/8BALLwireframe.png differ diff --git a/assets/8ball.png b/assets/8ball.png new file mode 100644 index 0000000..ddfaf40 Binary files /dev/null and b/assets/8ball.png differ diff --git a/index.html b/index.html index 7c510f1..843db79 100644 --- a/index.html +++ b/index.html @@ -1,39 +1,54 @@ - - - - - - - - - Web App - - - - - - - - - - - - - - - - -
- -

Web App

-
- -
- -
- - - - \ No newline at end of file + + + + + + + + Magic 8 Ball + + + + + + + + + + + + + + + + + + +
+
+
+

MAGIC 8 BALL

+ + +
+
+ +
+

+

+

+ +
+
+ + diff --git a/styles/global.css b/styles/global.css index fb1260d..2428893 100644 --- a/styles/global.css +++ b/styles/global.css @@ -1,5 +1,5 @@ :root { - --background: rgb(224, 234, 247); + --background: rgb(0, 0, 0); --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; @@ -12,24 +12,119 @@ body { grid-template-rows: auto 1fr; } -header { - position: sticky; - top: 0; - padding: 15px; - height: 80px; +main { + padding: 100px; +} - display: flex; - align-items: center; - gap: 10px; +/* * { + border: solid 1px; +} */ - background-color: var(--header-background); - box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); +.question-section { + display: grid; + justify-content: center; + align-content: center; + text-align: center; } -header .logo { - height: 100%; +.answer-section { + display: grid; + justify-content: center; + align-content: center; } -main { +.big-circle { + width: 540px; + height: 540px; + display: grid; + justify-content: center; + align-content: center; + background-color: black; + border-radius: 270px; + border: solid 0.1rem; + border-color: white; + margin-top: 40px; +} + +.small-circle { + width: 300px; + height: 300px; + background-color: white; + border-radius: 150px; + display: grid; + text-align: center; + align-items: center; + font-size: 1.6rem; padding: 20px; + line-height: 1.4rem; + font-family: 'Fredoka One'; + font-weight: lighter; +} + +.button { + display: grid; + justify-self: center; + width: 3rem; + height: 3rem; + margin-top: 12rem; + background-color: rgb(255, 255, 255); + border: none; + border-radius: 30px; + opacity: 0.3; + transition: 0.3s; + align-items: center; + font-size: 32px; +} + +.button:hover { + opacity: 1; +} + +.hide { + display: none; +} + +.title { + margin-bottom: 94px; + font-size: 2rem; + background-color: black; + color: white; + border-radius: 30px; + font-family: 'Fredoka One'; +} + +.input { + background-image: url('/Users/rafa/alchemy/onboarding/MAGIC-8-BALL/assets/8.png'); + background-repeat: no-repeat; + height: 300px; + width: 300px; + text-align: center; + border: none; + outline: none; + font-size: 14px; + font-family: Verdana, Geneva, Tahoma, sans-serif; + border-radius: 150px; + background-image: url('/Users/rafa/alchemy/onboarding/MAGIC-8-BALL/assets/8.png'); + background-repeat: no-repeat; + word-wrap: break-word; + word-break: break-all; +} + +.ask-button { + width: 3rem; + height: 3rem; + margin-top: 3.2rem; + background-color: rgb(255, 255, 255); + border: none; + border-radius: 30px; + display: grid; + justify-self: center; + opacity: 0.3; + transition: 0.3s; + align-items: center; + font-size: 32px; +} + +.ask-button:hover { + opacity: 1; } diff --git a/styles/reset.css b/styles/reset.css index 8b5fefc..d85d0af 100644 --- a/styles/reset.css +++ b/styles/reset.css @@ -1,38 +1,100 @@ - /* adapted from http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 License: none (public domain) */ -*{ +* { box-sizing: border-box; } -html, body { +html, +body { height: 100%; width: 100%; } -html, body, div, span, applet, object, iframe, blockquote, pre, -a, abbr, acronym, address, big, cite, code, -del, dfn, em, img, ins, kbd, q, s, samp, -small, strike, strong, sub, sup, tt, var, -b, u, i, center, -dl, dt, dd, ol, ul, li, -fieldset, form, label, legend, -table, caption, tbody, tfoot, thead, tr, th, td, -article, aside, canvas, details, embed, -figure, figcaption, footer, header, hgroup, -menu, nav, output, ruby, section, summary, -time, mark, audio, video { - margin: 0; - padding: 0; - border: 0; - font-size: 100%; - font: inherit; - vertical-align: baseline; +html, +body, +div, +span, +applet, +object, +iframe, +blockquote, +pre, +a, +abbr, +acronym, +address, +big, +cite, +code, +del, +dfn, +em, +img, +ins, +kbd, +q, +s, +samp, +small, +strike, +strong, +sub, +sup, +tt, +var, +b, +u, +i, +center, +dl, +dt, +dd, +ol, +ul, +li, +fieldset, +form, +label, +legend, +table, +caption, +tbody, +tfoot, +thead, +tr, +th, +td, +article, +aside, +canvas, +details, +embed, +figure, +figcaption, +footer, +header, +hgroup, +menu, +nav, +output, +ruby, +section, +summary, +time, +mark, +audio, +video { + margin: 0; + padding: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; } -ol, ul { - list-style: none; +ol, +ul { + list-style: none; }