Skip to content

Commit

Permalink
added to-do app functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
maximgeller committed Jul 8, 2020
1 parent 024de5c commit 4d8e75e
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 10 deletions.
19 changes: 19 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
function newItem() {
var item = document.getElementById('input').value;
var ul = document.getElementById("list");
var li = document.createElement('li');
li.appendChild(document.createTextNode("- "+item));
ul.appendChild(li);
document.getElementById('input').value="";
li.onclick = removeItem;
}

document.body.onkeyup = function(e){
if(e.keyCode == 13){
newItem();
}
}

function removeItem(e) {
e.target.parentElement.removeChild(e.target);
}
12 changes: 7 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>electron-app</title>
<link rel="stylesheet" href="style.css" />
<title>My To Do List App</title>
</head>
<body>
<h1>This app is built with HTML!</h1>
<h3>And it's not witchcraft! It's Electron!</h3>
</body>
<body>
<input id="input" placeholder="What needs to be done?">
<ul id="list"></ul>
</body>
<script src="app.js"></script>
</html>
5 changes: 0 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,8 @@ nodeIntegration: true

// and load the index.html of the app.
win.loadFile('index.html')

// Open the DevTools.
win.webContents.openDevTools()

}


// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
Expand Down
32 changes: 32 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
html{
font-family: "Avenir Next", Helevetica, sans-serif;
text-align: center;
}

body {
max-width: 500px;
margin: 0 auto;
}

input {
padding-top: 30px;
width: 500px;
height: 60px;
font-size: 40px;
border: 0;
}

input:focus {
outline:none;
}

li {
text-align: left;
font-size: 40px;
list-style: none;
margin: 0;
}

li:hover {
text-decoration: line-through;
}

0 comments on commit 4d8e75e

Please sign in to comment.