-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #163 from shukria-sultani/features
Added the joke generator challenge
- Loading branch information
Showing
8 changed files
with
107 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"workbench.colorCustomizations": { | ||
"activityBar.background": "#392836", | ||
"titleBar.activeBackground": "#50384B", | ||
"titleBar.activeForeground": "#FBFAFB" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!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="style.css"> | ||
<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=Montserrat:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet"> | ||
<title>Joke Generator</title> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<span>😂</span> | ||
<p id="jokeText"></p> | ||
<button id="btn">Generate Joke</button> | ||
</div> | ||
|
||
<div class="designer"> | ||
Be happy! Designed by <a href="https://github.com/shukria-sultani">Shurkia💙</a> | ||
</div> | ||
|
||
<script src="script.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const jokeText = document.getElementById('jokeText'); | ||
let button = document.getElementById('btn'); | ||
let url = "https://v2.jokeapi.dev/joke/Any?blacklistFlags=nsfw,religious,political,racist,explicit&type=single" | ||
|
||
const getJoke = () => { | ||
return new Promise((resolve, reject) => { | ||
fetch(url) | ||
.then(data => data.json()) | ||
.then(item => { | ||
jokeText.textContent = item.joke; | ||
resolve(); | ||
}) | ||
.catch(error => { | ||
console.error('Error fetching joke:', error); | ||
}); | ||
}); | ||
} | ||
|
||
button.addEventListener('click', getJoke); | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
*{ | ||
font-family: "Montserrat", sans-serif; | ||
} | ||
body{ | ||
background-color: orange; | ||
} | ||
.container{ | ||
position: absolute; | ||
padding: 50px , 40px; | ||
transform: translate(-50%,-50%); | ||
left: 50%; | ||
top: 50%; | ||
background-color: black; | ||
box-shadow: 20px 15px 20px 0 #232323; | ||
width: 80vmin; | ||
} | ||
.container span{ | ||
display: block; | ||
text-align: center; | ||
font-size: 100px; | ||
} | ||
.container p{ | ||
color: #fff; | ||
text-align: center; | ||
word-wrap: break-word; | ||
margin: 10px 5; | ||
font-weight: 400; | ||
padding: 10px; | ||
line-height: 30px; | ||
} | ||
.container button{ | ||
display: block; | ||
background-color: orange; | ||
border: none; | ||
padding: 12px 25px; | ||
margin: 0 auto; | ||
margin-bottom: 10px; | ||
font-size: 18px; | ||
text-align: center; | ||
border-radius: 10px; | ||
cursor: pointer; | ||
|
||
} | ||
.container button:hover{ | ||
box-shadow: 3px 0px 5px 5px orange; | ||
} | ||
.designer{ | ||
text-align: center; | ||
padding-top: 20px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
* { | ||
|
||
margin: 0px; | ||
padding: 0px; | ||
box-sizing: border-box; | ||
|