This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addBox(name, color, h, w) { | |
let box = new Box(name, color, h, w); | |
box.initBox(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class Box { | |
... | |
initBox() { | |
let htmlBox = createBox(); | |
//remeber that we are importing createBox() from selectors.js file. Which returns a div element. | |
htmlBox.id = this.id; | |
htmlBox.style.height = `${this.h}px`; | |
htmlBox.style.width = `${this.w}px`; | |
htmlBox.style.margin = '6px'; | |
htmlBox.style.backgroundColor = this.color; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addBox(name, color, h, w) { | |
let box = new Box(name, color, h, w); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Box, boxes } from './classes.js'; | |
import { | |
boxHeight, | |
boxWidth, | |
boxColor, | |
boxName, | |
button, | |
boxStorage | |
} from './selectors.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
export class Box { | |
constructor(name, color, h, w) { | |
this.id = Math.random() | |
this.h = h; | |
this.w = w; | |
this.name = name; | |
this.color = color; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {myFunction} from 'selectors' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {createBox} from './selector.js' | |
export let boxes = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const createElm = document.createElment('div') | |
//this will generate <div></div> and if we where to asign it a class like "box" | |
//and then try to use it again only with the a different class say like "box2" | |
//we'd only be changing the className not createing a new elment. |
NewerOlder