diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..1052b5df779469e64ddc179bbbb46684c13f2e33 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2017 Matthias Eurich + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/doc/README.md b/doc/README.md new file mode 100644 index 0000000000000000000000000000000000000000..8a142f7e46c6272f3c4c5afde2a70796da837981 --- /dev/null +++ b/doc/README.md @@ -0,0 +1 @@ +### Documentation placeholder \ No newline at end of file diff --git a/src/style.css b/src/style.css new file mode 100644 index 0000000000000000000000000000000000000000..ac0faf54c6aa861776941c06cc2399d5e9523af7 --- /dev/null +++ b/src/style.css @@ -0,0 +1,71 @@ +body { + margin: 0; + padding: 0; + font-family: sans-serif; + font-size: 18px; + background-color: #CECECE; +} + +#page { + padding: 25px; +} + +#form { + padding: 15px; +} + +#view { + margin-right: 25px; +} + +#title { + width: 100%; + padding: 1px; + font-size: 24px; +} + +#description { + width: 100%; + resize: none; + font-size: 18px; +} + +#textAreaContainer { + margin-top: 15px; +} + +#submitButtonContainer { + margin-top: 15px; +} + +#submitButton { + width: 100%; + text-align: center; + background-color: #7CB342; + padding: 25px; +} + +.component { + width: 100%; +} + +.page-title { + text-align: center; + padding: 15px; +} + +.box { + background-color: #FFFFFF; + box-shadow: rgba(0, 0, 0, 0.14902) 0 0 1px 0; + padding: 15px; +} + +.todo-container { + margin-top: 15px; +} + +.box-sizing { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; +} \ No newline at end of file diff --git a/src/todo.html b/src/todo.html new file mode 100644 index 0000000000000000000000000000000000000000..baaa54bfdacb629833420afded60d5881c1d4268 --- /dev/null +++ b/src/todo.html @@ -0,0 +1,22 @@ +<!DOCTYPE html> +<html lang="de"> +<head> + <meta charset="UTF-8"> + <title>Todo!</title> + <link rel="stylesheet" type="text/css" href="style.css"> + <script src="todo.js"></script> +</head> +<body> + +<div id="page"> + <div class="page-title box-sizing"><h1>Todo!</h1></div> + <div id="form" class="component box box-sizing"> + <div><input id="title" class="box-sizing" type="text" placeholder="Titel"/></div> + <div id="textAreaContainer"><textarea id="description" class="box-sizing" cols="40" rows="10" placeholder="Beschreibung"></textarea></div> + <div id="submitButtonContainer"><div id="submitButton" class="box-sizing" onclick="submitTodo()"><strong>Hinzufügen</strong></div></div> + </div> + <div id="view" class="component"></div> +</div> + +</body> +</html> \ No newline at end of file diff --git a/src/todo.js b/src/todo.js new file mode 100644 index 0000000000000000000000000000000000000000..d5067d350a2777f81233f9e60c0c39904b0f1fdd --- /dev/null +++ b/src/todo.js @@ -0,0 +1,42 @@ +/** + * Created by merh on 24.03.17. + */ +const todos = []; + + +class Todo { + constructor(title, description) { + this.title = title; + this.description = description; + } +} + +function addTodo(todo) { + todos.push(todo); +} + +function addTodoView(todo) { + const view = document.getElementById('view'); + const wrapper = document.createElement('DIV'); + const title = document.createElement('H3'); + const description = document.createElement('P'); + + title.appendChild(document.createTextNode(todo.title)); + description.appendChild(document.createTextNode(todo.description)); + wrapper.appendChild(title); + wrapper.appendChild(description); + wrapper.className = 'todo-container box box-sizing'; + view.appendChild(wrapper); +} + +function submitTodo() { + const title = document.getElementById('title'); + const description = document.getElementById('description'); + const todo = new Todo(title.value, description.value); + + addTodo(todo); + addTodoView(todo); + + title.value = ''; + description.value = ''; +} \ No newline at end of file