lurt å trykke ctl+s før push

This commit is contained in:
Geir Okkenhaug Jerstad 2024-09-06 14:34:17 +02:00
parent a99883fb2d
commit a1eed2dcc9
6 changed files with 57 additions and 10 deletions

View file

@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="app"></div>
<script>
//model
let timeAndDate = new Date();
let date = new Date(timeAndDate)
// view
updateView();
function updateView() {
document.getElementById('app').innerHTML = /*HTML*/ `
<h1>
${date.toLocaleDateString()}
</h1>
<button onclick="addDay()">+ 1 dag</button>
<button onclick="addDay()">- 1 dag</button>
<button onclick="addDay()">+ 1 time</button>
<button onclick="addDay()">- 1 time</button>
`;
}
// controller
function addDay(){
let date = new Date(timeAndDate);
let millis = date.getTime();
millis += 1000 * 60 * 60 * 24;
timeAndDate = new Date(millis).toISOString();
updateView();
}
</script>
</body>
</html>

View file

@ -21,7 +21,7 @@
let lishtml = ''; let lishtml = '';
for (let i = 1; i <= maxNumber; i++) { for (let i = 1; i <= maxNumber; i++) {
lishtml += /*HTML*/ ` lishtml += /*HTML*/ `
<li>${maxNumber} x ${i} = ${i * 10}</li> <li>${maxNumber} x ${i} = ${i * maxNumber}</li>
`; `;
} }

View file

@ -10,7 +10,7 @@
<script> <script>
const app = document.getElementById('app'); const app = document.getElementById('app');
const pocketStuff = ['Hat', 'Pencil', ]; const pocketStuff = ['Hat', 'Pencil', 'Dinosaur', 'Showercap', 'Piece of tape'];
view(); view();
function view() { function view() {
@ -25,12 +25,12 @@
// controller // controller
function seeWhatsInPocket(){ function seeWhatsInPocket(){
for (i = 0; i < pocketStuff.lenght; i++){ for (i = 0; i < pocketStuff.length; i++){
console.log(i); console.log(i);
app.innerHTML += /*HTML*/ ` app.innerHTML += /*HTML*/ `
<li>${pocketStuff[i]}</li> <li>${pocketStuff[i]}</li>
`; `;
} };
} }
</script> </script>

View file

@ -13,6 +13,7 @@
let htmlCart = ''; let htmlCart = '';
const goods = ['TV', 'Computer', 'Gaming Consol', 'Coffee']; const goods = ['TV', 'Computer', 'Gaming Consol', 'Coffee'];
let shoppingCart = []; let shoppingCart = [];
let item;
let app = document.getElementById('app'); let app = document.getElementById('app');
let tv = 0; let tv = 0;
let computer = 0; let computer = 0;
@ -22,7 +23,6 @@
// View // View
updateView(); updateView();
function updateView(){ function updateView(){
let item;
for (let i = 0; i < goods.length; i++){ for (let i = 0; i < goods.length; i++){
item = goods[i]; item = goods[i];
html += /*HTML*/ ` html += /*HTML*/ `
@ -65,9 +65,12 @@
<li>Gaming antall = ${gaming}</li> <li>Gaming antall = ${gaming}</li>
<li>Kaffe antall = ${coffee}</li> <li>Kaffe antall = ${coffee}</li>
</div> </div>
<button onclick="shopMore()">Kjøp mer!!</button>
`; `;
app.innerHTML = htmlCart;
app.innerHTML += htmlCart; }
function shopMore(){
location.reload();
} }
</script> </script>
</body> </body>

View file

@ -6,6 +6,6 @@ nøkkeltek:
* incus * incus
* libvirt * libvirt
agent - clustering - go/rust eller guile agent - clustering - guile
frontend/web og cli - go frontend/web og cli - go
middleware - bash nix guile middleware - bash nix guile

View file

@ -11,10 +11,12 @@
return (<h1>Develop. Preview. Ship.</h1>) return (<h1>Develop. Preview. Ship.</h1>)
} }
function HomePage() { function HomePage() {
return <div></div>; return <div>
<Header />
</div>;
} }
const root = ReactDOM.createRoot(domNode); const root = ReactDOM.createRoot(domNode);
root.render(<Header />); root.render(<HomePage />);
</script> </script>
</body> </body>
</html> </html>