diff --git a/README.md b/README.md index 7ed589e..ad5c9ec 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,11 @@ -# AD - SBA - HTML/CSS/JavaScript - +# Website +Access to my website by clicking here -> https://alonsonina95.github.io/sba.javascript_3-page-website/homepage.html ### Description -* In this Skill-based Assessment, you will be creating a small website and you get to pick what is the website about. The main purpose of this SBA is to test your skills in implementing a clean HTML structure that follows the methodologies of visual design, and styling your site so that it is user-friendly. - -* You have the entire day for this SBA. Make sure to check in with your instructor for approval of your idea. Your work will be graded based on the below technical requirements. Also, creativity always works in your favor. - -* Since this is your first time creating a 3 page website, keep it simple. Keeping it simple is very important. It ensures that you can complete this project within the given time and also gives you a better idea of what can you get done in the given time if you were to do it again with more requirements. - -* Once you got your idea, think in the user’s perspective when creating the website.  You like your users to have a good experience when interacting with your site. This gives you a better chance of users trusting your site and coming back for more. For this SBA, don’t worry too much about the content. There are many places you can get free content to display on your site. Concentrate more on the web site's structure and grid system. - - -* Some resources for free content: - * Photos: `https://www.pexels.com/search/template/` - * Text: `https://www.lipsum.com/` - * GIFs: `https://www.motionelements.com/stock-image-10116013-business-and-startup-4k` +* A small website using vanilla javascript. -* Useful API sites: - * https://rapidapi.com/ (Links to an external site.) - * https://any-api.com/ (Links to an external site.) - * https://github.com/toddmotto/public-apis#public-apis- (Links to an external site.) - * https://apilist.fun/ +* Requirements for this website is to have 3 pages ### Deliverable: * A theme for your site that you feel comfortable with @@ -33,8 +17,6 @@ * Submit the project in a ZIP file - - ## Technical requirements * HTML @@ -63,45 +45,3 @@ * Use JSON or XML (Optional) * Use JQuery (Optional) - - -## How to Download - -#### Part 1 - Forking the Project -* To _fork_ the project, click the `Fork` button located at the top right of the project. - - -#### Part 2 - Navigating to _forked_ Repository -* Navigate to your github profile to find the _newly forked repository_. -* Copy the URL of the project to the clipboard. - -#### Part 3 - Cloning _forked_ repository -* Clone the repository from **your account** into the `~/dev` directory. - * if you do not have a `~/dev` directory, make one by executing the following command: - * * `mkdir ~/dev` - * navigate to the `~/dev` directory by executing the following command: - * * `cd ~/dev` - * clone the project by executing the following command: - * * `git clone https://github.com/${MYUSERNAME}/${NAMEOFPROJECT}` - - - - - - -## How to Submit - -#### Part 1 - _Pushing_ local changes to remote repository -* from a _terminal_ navigate to the root directory of the _cloned_ project. -* from the root directory of the project, execute the following commands: - * * add all changes - * * `git add .` - * * commit changes to be pushed - * * `git commit -m 'I have added changes'` - * * push changes to your repository - * * `git push -u origin master` - -#### Part 2 - Submitting assignment -* from the browser, navigate to the _forked_ project from **your** github account. -* click the `Pull Requests` tab. -* select `New Pull Request` diff --git a/css/homepage.css b/css/homepage.css new file mode 100644 index 0000000..dee98d5 --- /dev/null +++ b/css/homepage.css @@ -0,0 +1,9 @@ +@import url('https://fonts.googleapis.com/css2?family=Bangers&display=swap'); + +body { + background-color: #C5CAE9; +} + +#homepageText { + font-family: 'Bangers', cursive; +} \ No newline at end of file diff --git a/css/loginForm.css b/css/loginForm.css new file mode 100644 index 0000000..dbc643c --- /dev/null +++ b/css/loginForm.css @@ -0,0 +1,86 @@ +@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,700); + +body { + background: #C5CAE9; + font-family: 'Open Sans', sans-serif; +} + +.container { + width: 420px; + margin: 16px auto; + font-size: 16px; +} + +.container-header, +.container p { + margin-top: 0; + margin-bottom: 0; +} + +.container-triangle { + width: 0; + margin-right: auto; + margin-left: auto; + border: 12px solid transparent; + border-bottom-color: #28d; +} + +.container-header { + background: #28d; + padding: 20px; + font-size: 1.4em; + font-weight: normal; + text-align: center; + text-transform: uppercase; + color: #fff; +} + +.login { + background: #ebebeb; + padding: 12px; +} + +.login p { + padding: 12px; +} + +.login input { + box-sizing: border-box; + display: block; + width: 100%; + border-width: 1px; + border-style: solid; + padding: 16px; + outline: 0; + font-family: inherit; + font-size: 0.95em; +} + +#email, #password { + background: #fff; + border-color: #bbb; + color: #555; +} + +#email:focus, #password:focus { + border-color: #888; +} + +#submitButton { + background: #28d; + border-color: transparent; + color: #fff; + cursor: pointer; +} + +#submitButton:hover { + background: #17c; +} + +#submitButton:focus { + border-color: #05a; +} + +#navImage { + cursor: pointer; +} \ No newline at end of file diff --git a/css/signupForm.css b/css/signupForm.css new file mode 100644 index 0000000..440db29 --- /dev/null +++ b/css/signupForm.css @@ -0,0 +1,86 @@ +@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,700); + +body { + background: #C5CAE9; + font-family: 'Open Sans', sans-serif; +} + +.container { + width: 420px; + margin: 16px auto; + font-size: 16px; +} + +.container-header, +.container p { + margin-top: 0; + margin-bottom: 0; +} + +.container-triangle { + width: 0; + margin-right: auto; + margin-left: auto; + border: 12px solid transparent; + border-bottom-color: #28d; +} + +.container-header { + background: #28d; + padding: 20px; + font-size: 1.4em; + font-weight: normal; + text-align: center; + text-transform: uppercase; + color: #fff; +} + +.login { + background: #ebebeb; + padding: 12px; +} + +.login p { + padding: 12px; +} + +.login input { + box-sizing: border-box; + display: block; + width: 100%; + border-width: 1px; + border-style: solid; + padding: 16px; + outline: 0; + font-family: inherit; + font-size: 0.95em; +} + +#email, #password { + background: #fff; + border-color: #bbb; + color: #555; +} + +#email:focus, #password:focus { + border-color: #888; +} + +#submitButton { + background: #28d; + border-color: transparent; + color: #fff; + cursor: pointer; +} + +#submitButton:hover { + background: #17c; +} + +#submitButton:focus { + border-color: #05a; +} + +#navImage { + cursor: pointer; +} diff --git a/css/style.css b/css/style.css deleted file mode 100644 index d17d83a..0000000 --- a/css/style.css +++ /dev/null @@ -1,9 +0,0 @@ -body { - background-color: navy; -} - - -object { - height: 100vh; - width: 100vh; -} diff --git a/extensions/loginForm.html b/extensions/loginForm.html new file mode 100644 index 0000000..3d2d80e --- /dev/null +++ b/extensions/loginForm.html @@ -0,0 +1,34 @@ + + + + + + + + + + + + +
+ +
+ +
+
+

Log in

+
+

+

+

+

Don't have an account? Sign up here

+
+
+ + + + \ No newline at end of file diff --git a/extensions/signupForm.html b/extensions/signupForm.html new file mode 100644 index 0000000..afa7161 --- /dev/null +++ b/extensions/signupForm.html @@ -0,0 +1,38 @@ + + + + + + + + + + + + +
+ +
+ +
+
+

Sign Up Form

+
+

+

+

+

+

+
+
+ + + + + + + \ No newline at end of file diff --git a/homepage.html b/homepage.html new file mode 100644 index 0000000..9354c03 --- /dev/null +++ b/homepage.html @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + +
+
+ + + + + \ No newline at end of file diff --git a/index.html b/index.html deleted file mode 100644 index 4dc0c72..0000000 --- a/index.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The quickest of brown foxes. - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/js/footer-functions.js b/js/footer-functions.js deleted file mode 100644 index c7d6a2c..0000000 --- a/js/footer-functions.js +++ /dev/null @@ -1,2 +0,0 @@ -w3IncludeHTML(); -document.write(''); diff --git a/js/header-functions.js b/js/header-functions.js deleted file mode 100644 index ff2614d..0000000 --- a/js/header-functions.js +++ /dev/null @@ -1,11 +0,0 @@ -// import jquery-3.4.0 -document.write(''); -document.write(''); - -// import `utils.js` -document.write(''); - - - -// import w3-include -document.write(''); diff --git a/js/homepage.js b/js/homepage.js new file mode 100644 index 0000000..8928a75 --- /dev/null +++ b/js/homepage.js @@ -0,0 +1,129 @@ +const url = 'https://ron-swanson-quotes.herokuapp.com/v2/quotes'; +let randomlyCreated = false; +let cardContainer = document.getElementById('card-container'); +let cardContainerQuote = document.getElementById('card-container-quote'); + +let getSingleQuoteButton = document.getElementById("getSingleQuote"); +getSingleQuoteButton.addEventListener('click', () => { + getSingleQuote(); +}); + +let getTermQuote = document.getElementById("getTermQuote"); +getTermQuote.addEventListener('click', () => { + getTermQuotes(); +}); + +function getSingleQuote() { + + randomlyCreated = true; + let xhr = new XMLHttpRequest(); + let response; + xhr.open('GET', url); + + xhr.send(); + + xhr.onload = function() { + if (xhr.status != 200) { + alert(`Error ${xhr.status}: ${xhr.statusText}`); + } else { + alert(`Done, got ${xhr.response.length} bytes (This means we finshed fetching the response, yei)`); // response is the server + response= JSON.parse(xhr.response); + if(cardContainer.children.length > 0) { + updateCard(cardContainer, response); + } else { + createTaskCard(cardContainer, response,randomlyCreated) + } + } + }; + + xhr.onprogress = function(event) { + if (event.lengthComputable) { + alert(`Received ${event.loaded} of ${event.total} bytes ( this means we got the total size of the response; this means yei)`); + } else { + alert(`Received ${event.loaded} bytes`); + } + + }; + + xhr.onerror = function() { + alert("Request failed"); + }; +} + +function getTermQuotes() { + + let inputQuote = prompt("Enter a word"); + let responses; + let changeableUrl = `${url}/search/${inputQuote}`; + + let xhr = new XMLHttpRequest(); + + xhr.open('GET', changeableUrl); + + xhr.send(); + + xhr.onload = function() { + if (xhr.status != 200) { + alert(`Error ${xhr.status}: ${xhr.statusText}`); + } else { + alert(`Done, got ${xhr.response.length} bytes (This means we finshed fetching the response, yei)`); // response is the server + responses= JSON.parse(xhr.response); + for ( let response in responses) { + createTaskCard(cardContainerQuote,responses[response], randomlyCreated); + } + + } + }; + + xhr.onprogress = function(event) { + if (event.lengthComputable) { + alert(`Received ${event.loaded} of ${event.total} bytes ( this means we got the total size of the response; this means yei)`); + } else { + alert(`Received ${event.loaded} bytes`); + } + + }; + + xhr.onerror = function() { + alert("Request failed"); + }; +} + +function createTaskCard(cardContainer, quote, randomlyCreated) { + + let card = document.createElement('div'); + + if (randomlyCreated == true) { + card.className = 'card border-primary mb-3'; + card.style = 'margin-top: 10px;' + } else { + card.className = 'card border-light mb-3'; + card.style = 'margin-top: 10px;' + } + + let cardHeader = document.createElement('div'); + cardHeader.className = "card-header"; + cardHeader.textContent = "Ron Swanson says" + + let cardBody = document.createElement('div'); + cardBody.className = 'card-body'; + + let title = document.createElement('h5'); + title.className = 'card-title'; + + let color = document.createElement('p'); + color.textContent = quote; + color.className = 'card-text'; + + + cardBody.appendChild(title); + cardBody.appendChild(color); + card.appendChild(cardHeader); + card.appendChild(cardBody); + cardContainer.appendChild(card); +} + +function updateCard(cardContainer, quote) { + + cardContainer.childNodes[0].childNodes[1].childNodes[1].textContent = quote; +} \ No newline at end of file diff --git a/js/utils.js b/js/utils.js deleted file mode 100644 index bf0c12e..0000000 --- a/js/utils.js +++ /dev/null @@ -1,26 +0,0 @@ -// Utility JS functions are to be defined here -function resizeIFrameToFitContent( iFrame ) { - iFrame.width = iFrame.contentWindow.document.body.scrollWidth; - iFrame.height = iFrame.contentWindow.document.body.scrollHeight; -} - -// used to fetch all methods of an arbitrary object to display to client -function getAllMethodsOfObejct(obj) { - var result = []; - for (var id in obj) { - try { - if (typeof(obj[id]) == "function") { - result.push(id + ": " + obj[id].toString()); - } - } catch (err) { - result.push(id + ": inaccessible"); - } - } - return result; - } - - - -function loadHtml(elementId, fileName) { - $(elementId).html(''); -};