Skip to content

Commit

Permalink
Merge pull request #75 from SougataXdev/SougataXdev
Browse files Browse the repository at this point in the history
Added new API Bored API
  • Loading branch information
dishamodi0910 committed May 15, 2024
2 parents 3e64adc + 6e5ef0f commit 78db5e4
Show file tree
Hide file tree
Showing 5 changed files with 216 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Existing_API_Collection/Bored-API/Bored API/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bored API Example</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<div class="wrapper">
<div class="banner-image"></div>
<div class="content">
<h1>Bored Activity Generator</h1>
<p>Explore random activities to beat boredom!</p>
<div class="button-wrapper">
<button class="btn outline">Get Random Activity</button>
</div>
<div class="activity"><ul class="ul">

</ul></div> <!-- Added this line -->
</div>
</div>
</div>

<script src="script.js"></script>
</body>
</html>
32 changes: 32 additions & 0 deletions Existing_API_Collection/Bored-API/Bored API/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
document.addEventListener('DOMContentLoaded', function() {
const searchButton = document.querySelector('.btn');
const activityContainer = document.querySelector('.activity');
searchButton.addEventListener('click', getRandomActivity);

function getRandomActivity() {
const apiUrl = 'https://www.boredapi.com/api/activity';

// Make API request
fetch(apiUrl)
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
displayActivity(data.activity);
})
.catch(error => {
console.error('Error fetching activity:', error);
});
}

function displayActivity(activity) {
let ul = document.querySelector(".ul")
ul.innerHTML = ""; // Clear the ul
let li = document.createElement("li");
li.innerText = activity;
ul.appendChild(li);
}
});
98 changes: 98 additions & 0 deletions Existing_API_Collection/Bored-API/Bored API/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
body {
font-family: 'Lato', sans-serif;
margin: 0;
padding: 0;
}

.container {
background: linear-gradient(45deg, rgba(0,212,255,1) 0%, rgba(11,3,45,1) 100%);
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}

.wrapper {
width: 80%;
max-width: 600px;
margin: auto;
}



.content {
background-color: rgba(17, 25, 40, 0.25);
padding: 20px;
border-radius: 12px;
text-align: center;
color: #fff;
}

h1 {
font-family: 'Righteous', sans-serif;
text-transform: uppercase;
font-size: 2.4rem;
margin-bottom: 10px;
}

p {
font-size: 1rem;
line-height: 1.5;
margin-bottom: 20px;
}

.button-wrapper {
display: flex;
justify-content: center;
}

.btn {
padding: 10px 20px;
border: none;
border-radius: 24px;
font-size: 0.8rem;
letter-spacing: 1px;
cursor: pointer;
margin: 0 10px;
}

.outline {
background: transparent;
color: rgba(0, 212, 255, 0.9);
border: 1px solid rgba(0, 212, 255, 0.6);
transition: all .3s ease;
}

.outline:hover {
transform: scale(1.05);
}

.fill {
background: rgba(0, 212, 255, 0.9);
color: rgba(255,255,255,0.95);
font-weight: bold;
transition: all .3s ease;
}

.fill:hover {
transform: scale(1.05);
}

.activity {
background-color: transparent;
border-radius: 8px;
margin-top: 20px;
font-family: 'Lato', sans-serif;
font-size: 1.2rem;
line-height: 1.5;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.ul {
list-style-type: none;
padding: 0;
}

.ul li {
margin-bottom: 10px;
}
57 changes: 57 additions & 0 deletions Existing_API_Collection/Bored-API/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Bored Activity Generator

Explore random activities to beat boredom! This simple web app uses the Bored API to fetch random activities for users to try out.

## Table of Contents

- [Introduction](#introduction)
- [Demo](#demo)
- [Features](#features)
- [Getting Started](#getting-started)
- [Built With](#built-with)
- [Contributing](#contributing)
- [License](#license)

## Introduction

This web application provides users with a quick and easy way to discover new activities to do when they're feeling bored. By clicking the "Get Random Activity" button, users can fetch a random activity suggestion from the Bored API and get inspired to try something new.

## Demo

Insert a GIF or a link to a live demo of the project here.

## Features

- Fetches random activities from the Bored API.
- Simple and intuitive user interface.
- Responsive design for seamless use on various devices.

## Getting Started

To get a local copy up and running follow these simple steps:

## Getting Started

- Clone the repository:
```sh
git clone https://github.com/SougataXdev/APIVerse.git
```
- Open the project folder in your code editor.
- Open the `index.html` file in your web browser to view the application locally.

## Built With

- HTML
- CSS
- JavaScript
- [Bored API](https://www.boredapi.com/) - For fetching random activity suggestions.

## Contributing

Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
## Steps:
1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
1 change: 1 addition & 0 deletions Existing_API_Collection/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
|[Giphy API](./GiphyAPI)|This API allows developers to integrate Giphy's vast library of GIFs into their own applications, websites, and services.|
|[PokeAPI](./PokeAPI/)| This API provides data regarding Pokemon and others related. |
|[Product Store API](./ProductStoreAPI/)| A Product Store API using NodeJS, ExpressJS, MongoDB and Mongoose |
|[Bored API](./BoredAPI/)|Bored API is a versatile tool designed to provide users with random activity suggestions when they're feeling bored. With this API, users can access a wide range of activities to spark inspiration and alleviate boredom. From creative hobbies to outdoor adventures, Bored API offers something for everyone.|
|[Unsplash API](./unsplashApi/)| An API that enables users to retrieve high quality and copyright free Images from Unsplash and also get random Images |

0 comments on commit 78db5e4

Please sign in to comment.