scrimba
Learn Imba
Making an Animated Drawer
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Making an Animated Drawer
AboutCommentsNotes
Making an Animated Drawer
Expand for more info
index.imba
run
preview
console
import {nanoid} from 'nanoid'
import "./habit-group"
import "./habit-item"
import "./habit-adder"

tag dopamine-box
prop habits = [{name: "Clean Up", done: true, id: nanoid()}]

def completeAll
for habit in habits
habit.done = true

def resetAll
for habit in habits
habit.done = false

def handleHabitAdded e
const newHabit = {name: e.detail, done: false, id:nanoid()}
habits.push(newHabit)

css self d:vflex g:10px
div.controls d:flex jc:space-between
button bgc:transparent td@hover:underline fs:xs color:blue5 cursor:pointer

<self>
<habit-group habits=habits>

<div.controls>
<button @click=completeAll> "Complete All"
<button @click=resetAll> "Reset All"

<habit-adder @habitAdded=handleHabitAdded>


imba.mount <dopamine-box>
Console
/index.html?
-5:05