Skip to content

Commit 9ff0692

Browse files
committed
added new application get-cart
1 parent 493ac8e commit 9ff0692

File tree

6 files changed

+96
-0
lines changed

6 files changed

+96
-0
lines changed

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
# js-projects
22

33
A set of my js projects
4+
5+
* Passenger Counter App - A simple app stores the count of passengers in a station and displays it on the screen. It also has a reset button that resets the counter to zero.
6+
7+
* Mini Calculator - A simple calculator that performs basic arithmetic operations.
8+
9+
* BlackJack - A simple game of blackjack, where cards are drawn at random, if they exceed 21, the player losses, if the player gets 21, the player wins.
10+
11+
* Chrome extension - A Lead Tracker chrome extension, which can track all the leads of the user and store them in a localstorage(browser database)

get-cart/cat.png

32.6 KB
Loading

get-cart/index.html

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<title> Get Cart </title>
5+
<link rel="preconnect" href="https://fonts.googleapis.com">
6+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
7+
<link href="https://fonts.googleapis.com/css2?family=Rubik:wght@300&display=swap" rel="stylesheet">
8+
<link rel="stylesheet" href="style.css" type="text/css">
9+
</head>
10+
11+
<body>
12+
<div class="main-container">
13+
<img src="cat.png" alt="cat" id="cat">
14+
<input type="text" id="input-field" placeholder="Enter Item name">
15+
<button id="add-btn"> Add Item </button>
16+
<p id="items">
17+
18+
</p>
19+
</div>
20+
21+
<script src="index.js" type="module"></script>
22+
</body>
23+
</html>

get-cart/index.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//@ts-check
2+
3+
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.15.0/firebase-app.js"
4+
import { getDatabase, ref, push } from "https://www.gstatic.com/firebasejs/9.15.0/firebase-database.js"
5+
6+
const appSettings = {
7+
databaseURL: "https://get-cart-default-rtdb.firebaseio.com/"
8+
}
9+
10+
const app = initializeApp(appSettings);
11+
const db = getDatabase(app);
12+
const itemsInDB = ref(db, "items");
13+
14+
let inputEL = document.querySelector("#input-field");
15+
let btnEL = document.querySelector("#add-btn");
16+
let pEL = document.querySelector("#items");
17+
18+
btnEL.addEventListener("click", function () {
19+
let item = inputEL.value;
20+
21+
push(itemsInDB, item);
22+
pEL.textContent += item + " ";
23+
inputEL.value = "";
24+
});

get-cart/project.zip

34.7 KB
Binary file not shown.

get-cart/style.css

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
html, body {
2+
margin: 0;
3+
padding: 0;
4+
font-family: 'Rubik', sans-serif;
5+
background-color: #EEF0F4;
6+
}
7+
8+
.main-container {
9+
display: flex;
10+
flex-direction: column;
11+
max-width: 320px;
12+
margin: 30px auto;
13+
}
14+
15+
img {
16+
width: 150px;
17+
margin: 0 auto;
18+
}
19+
20+
input {
21+
margin: 10px 0;
22+
border: none;
23+
padding: 15px;
24+
border-radius: 8px;
25+
font-size: 20px;
26+
text-align: center;
27+
color: #432000;
28+
background-color: #DCE1EB;
29+
font-family: 'Rubik', sans-serif;
30+
}
31+
32+
button {
33+
border: none;
34+
border-radius: 8px;
35+
padding: 15px;
36+
font-size: 20px;
37+
text-align: center;
38+
color: #FDFDFD;
39+
background-color: #AC485A;
40+
font-family: 'Rubik', sans-serif;
41+
}

0 commit comments

Comments
 (0)