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
26 changes: 26 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<title>Michael Scott Translation Generator</title>
</head>
<body>
<h1>
Michael Scott Translation Generator
</h1>
<button type="button" name="button" id="button">I am a little stitious</button>
<button type="button" name="resetBtn" id="resetBtn">Reset</button>
<!-- I got this from the objects nasa and weather api hw -->
<img src="" id="" alt="">
<div class="description"></div>

<script src="main.js"></script>
</body>
</html>


<!-- simple api project -->
<!-- used my weather app as template -->
<!-- got api from here: https://github.com/sameerkumar18/corporate-bs-generator-api -->
44 changes: 44 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// working off of my simple-api-two and plugging in the new info and then deleted what's not needed reverse engineering for this project.
// https://github.com/sameerkumar18/corporate-bs-generator-api
//Call
const descriptionDiv = document.querySelector('.description');
const getOfficeButton = document.querySelector('button');
getOfficeButton.addEventListener('click', getOffice);
const resetBtn = document.querySelector('#resetBtn');
resetBtn.addEventListener('click', reset);

//API's Used
const url = 'https://corporatebs-generator.sameerkumar.website/';

//Function
async function getOffice() {
const options = {
method: "GET",
};
try {
const response = await fetch(url, options);
const result = await response.json();
descriptionDiv.innerText = "";
const corpBsCard = document.createElement("div");
const corpBsText = document.createElement("h2");
corpBsText.innerText = result.phrase;
corpBsCard.appendChild(corpBsText);
descriptionDiv.appendChild(corpBsCard);

console.log(result);
} catch (error) {
console.error(error);
}
}
function reset() {
descriptionDiv.innerText = '';
}






//SOURCES
//Worked on with Maureen Zitouni RC 2025B and used simple api two as template to plug in relevant info and delete what's not needed
//referenced @Leon Noel Lecture, @mdn @dcode https://www.youtube.com/watch?v=X6MFUagtKiQ
17 changes: 17 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
*{
box-sizing: border-box;
}
body{
background-color: #087FC2;
color: rgb(255, 255, 255);
font-family: Arial, Helvetica, sans-serif;
text-align: center;
margin-top: 160px;
}

/* pseudo code
I want the h1 to have an outline of solid black.
I want the input and submit button to be bigger.
I want the whole page to center in the middle of the page
I want an office background picture
I want it to be responsive */