diff --git a/app.js b/app.js index e69de29..3229d8f 100644 --- a/app.js +++ b/app.js @@ -0,0 +1,55 @@ +const HabitTrackerApp = { + elements: { + habitGrid: null, + addHabitForm: null, + addHabbitButton: null + }, + + init: function() { + + }, + + setupEventListeners: function() { + this.elements.addHabbitButton.addEventListener('click', () => { + this.elements.addHabitForm.style.display = 'block'; + }); + }, + + loadElements: function() { + this.elements.habitGrid = document.getElementById('habits-grid'); + this.elements.addHabitForm = document.getElementById('add-habit-form'); + this.elements.addHabbitButton = document.getElementById('add-habbit-button'); + }, + + render: function() { + const habitsHTML = HabitManager.habits.map(habit => { + const cardClass = `habit-card ${habit.isCompleted ? 'habit-card--completed' : ''}`; + const progress = (habit.currentCount / habit.targetCount) * 100; + + return `
+
+
💧
+

${habit.name}

+
+ +

${habit.description}

+ +
+
+ Прогресс + ${progress}% +
+
+
+
+
+ +
+ + +
+ ` + } + ); + } +} \ No newline at end of file diff --git a/habbit-manager.html b/habbit-manager.html index 70492b6..8b9eaca 100644 --- a/habbit-manager.html +++ b/habbit-manager.html @@ -235,7 +235,7 @@ -
+
@@ -310,9 +310,9 @@
-
-

➕ Добавить новую привычку

- +
+

➕ Добавить новую привычку

+