Skip to content

Commit

Permalink
new functions nd stuff
Browse files Browse the repository at this point in the history
laget functions som bruker addDoc function fra firebase library osv
. fikset layout og deisgn av knapper. Funker
  • Loading branch information
Knnordseth committed Mar 7, 2023
1 parent a7e754a commit a51f317
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 34 deletions.
37 changes: 28 additions & 9 deletions Style.css
Original file line number Diff line number Diff line change
@@ -1,18 +1,37 @@
#addoc {
#leggtilmeny {
display: inline-block;
margin: 5px;
margin-top: 10px;
margin-left:1000px ;

}

.topnav {
color: brown;

}

#leggtilmeny {
display: block;
block-size: 35px;
margin: 35px;
background-color: pink;
block-size: 30px;
margin: auto;
background-color: rgb(18, 163, 168);
margin-bottom: 10px;
margin-top: 15px;
}

#ViewAll {
font-family: Geneva, Tahoma, sans-serif;

}

h1 {
margin-top: 20px;
font-family:'Gill Sans MT', 'Trebuchet MS', sans-serif;
font-weight: bolder;
display: block;
background-color: blanchedalmond;

}

.activities:hover {
color: red;
cursor: pointer;
display: block;
}

60 changes: 43 additions & 17 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,49 @@
</head>
<body>

<h1>welcome to da beach</h1>
<h1>welcome to da beach</h1>
<h2>meny</h2>

<div class="topnav">
<a href="#leggtilmeny">meny</a>
<a class="active" href="#home">Home</a>
<a href="#news">Activiteies</a>
<a href="#contact">Contact</a>
<a href="#leggtilmeny">meny input</a>
</div>
</div>

</div>
<div id="leggtilmeny">

<form>
<label for="inputBox1">Field 1:</label>
<input type="text" id="inputBox1" name="field1"><br>
<label for="inputBox2">Field 2:</label>
<input type="text" id="inputBox2" name="field2"><br>
<button type="button" id="addButton">Add to menu</button>
<label for="inputBox1">hovedrett: </label>
<input type="text" id="inputBox1" name="hovedrett">
<br>
<label for="inputBox2">Desert:</label>
<input type="text" id="inputBox2" name="Desert">

<button type="button" id="leggtilmeny">Add hovedrett to meny</button>
<button type="button" id="leggtilmeny">Add Desert to meny </button>
</form>
</div>
<br>
<br>
<br>
<br>
<br>

<div id="activities">
<h1>Activities</h1>
<button id="viweAct">wiev all activities</button>

<h1 id="activities">Activities</h1>
<button id="viewActBtn">Display</button>
<p id="viewAct">aktiviteter idag:</p>
<!-- <img id="myImage" src="placeholder.jpg" alt="blank"> -->
</div>

<script type="module">

// Import the functions you need from the SDKs you need
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.6.3/firebase-app.js";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries
import { getFirestore, addDoc, collection } from "https://www.gstatic.com/firebasejs/9.6.3/firebase-firestore.js"

// Your web app's Firebase configuration
const firebaseConfig = {
apiKey: "AIzaSyCrCsxxIIYTUpF8uJ12a49UTsDx9KIrbtU",
Expand All @@ -55,14 +62,33 @@ <h1>Activities</h1>
messagingSenderId: "195541876312",
appId: "1:195541876312:web:9c2e5805b988c51071542d",
};

// Initialize Firebase
const app = initializeApp(firebaseConfig);

const db = getFirestore();

document.getElementById("leggtilmeny").addEventListener("click", addDocFOOD)

function addDocFOOD() {
const input = document.getElementById("inputBox1","inputbox2").value; // retrieve input data
if (input === "") {

} else {
addDoc(_hovedrett_, { Text: input }); // legg til i hovedrett collection?
}}


// display all activities inni activites tab i firestore tingen
// const ACTV10 = document.getElementById("ViewAct")

// ACTV10.addEventlistener("click", randomshitGO())
// function randomshitGO() {
// const activityDoc = db.collection("activities").doc("activities");
// }

</script>

<script src="/script.js"></script>
<!-- <script src="https://www.gstatic.com/firebasejs/8.10.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.10.1/firebase-firestore.js"></script> -->
Expand Down
29 changes: 21 additions & 8 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@

console.log("hello world");
console.log("Fuck you world");




function ViewAll() {
const dinput = document.getElementById("viewActBtn").value;
console.log("funky town");
document.getElementById("viewAct").innerHTML = "These are the activities ongoing"
// document.getElementById("myImage").src = "volleyball.jpg";
}

// document.getElementById("ViewAct").addEventListener("click", ViewAll)
// {
// console.log("pressed, run ViewAll");
// }



// display all activities inni activites tab i firestore tingen




// const wievAct() {
// wievAct.addEventListener(

// getDoc(db, activities,activities)
// )
// }

0 comments on commit a51f317

Please sign in to comment.