summaryrefslogtreecommitdiff
path: root/projects/2-stay-motivated/templates.js
diff options
context:
space:
mode:
Diffstat (limited to 'projects/2-stay-motivated/templates.js')
-rw-r--r--projects/2-stay-motivated/templates.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/projects/2-stay-motivated/templates.js b/projects/2-stay-motivated/templates.js
index 776913c..daa2ebe 100644
--- a/projects/2-stay-motivated/templates.js
+++ b/projects/2-stay-motivated/templates.js
@@ -1,20 +1,26 @@
+// Create a module to keep
+// our template functions
+// out of the global scope
let Templates = (function() {
return {
+ // Allowing an id to be passed in is very useful
+ // for finding this node after it gets mounted
gridContainer(gridItems, id) {
- return `<section class="grid-container" id=${id}>
+ return `<section class="grid-container" id="${id}">
${gridItems}
</section>`
},
gridItem(isHighlighted, id) {
return `<div
- id=${id}
+ id="${id}"
class="grid-item ${isHighlighted ? 'grid-item__highlighted' : ''}">
</div>`
},
form(header, id, inputId, value = '') {
- return `<section class="form-container" id=${id}>
+ return `<section class="form-container" id="${id}">
<h1>${header}</h1>
- <input autofocus type="text" name="goal" value="${value}" id=${inputId}></input>
+ <input autofocus type="text" name="goal" value="${value}" id="${inputId}">
+ </input>
</section>`
},
container(content) {