Skip to content

Commit

Permalink
Re ordered files, added compo extends and add posts b00tc4mp#174
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronbmaartin committed Oct 15, 2024
1 parent 4369737 commit ed8b731
Show file tree
Hide file tree
Showing 37 changed files with 609 additions and 612 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 0 additions & 18 deletions staff/aaron-barrios/unsocial/compo.demo.html

This file was deleted.

22 changes: 0 additions & 22 deletions staff/aaron-barrios/unsocial/compo.demo.js

This file was deleted.

240 changes: 0 additions & 240 deletions staff/aaron-barrios/unsocial/compo.js

This file was deleted.

10 changes: 10 additions & 0 deletions staff/aaron-barrios/unsocial/compo/Button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//BUTTON INSTANCES
class Button extends Compo {
constructor(text, type) {
super(document.createElement('button'))

this.container.innerText = text
this.container.type = type
}

}
32 changes: 32 additions & 0 deletions staff/aaron-barrios/unsocial/compo/Compo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//FUNCIÓN PADRE
class Compo {
constructor(container) {
this.children = []
this.container = container

// this.parent = null
}

add = function (child) {
this.children.push(child)

// child.parent = this

this.container.appendChild(child.container)
}

remove = function () {
// var index = this.parent.children.findIndex(function (child) {
// return child === this
// }.bind(this))

// if (index > -1)
// this.parent.children.splice(index, 1)

this.container.remove()
}

addBehavior = function (type, callback) {
this.container.addEventListener(type, callback)
}
}
11 changes: 11 additions & 0 deletions staff/aaron-barrios/unsocial/compo/Form.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//FORMULARIOS
class Form extends Compo {
constructor(container) {
super(document.createElement('form'))
}


reset = function () {
this.container.reset()
}
}
8 changes: 8 additions & 0 deletions staff/aaron-barrios/unsocial/compo/Heading.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//HEADING INSTANCES
class Heading extends Compo {
constructor(text, level) {
super(document.createElement('h' + level))

this.container.innerText = text
}
}
8 changes: 8 additions & 0 deletions staff/aaron-barrios/unsocial/compo/Image.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class Image extends Compo {
constructor(address) {
super(document.createElement('img'))

this.container.src = address
this.container.style.width = '100%'
}
}
28 changes: 28 additions & 0 deletions staff/aaron-barrios/unsocial/compo/Input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//INPUT Instances
class Input extends Compo {
constructor(type, id) {
super(document.createElement('input'))
this.container.style.width = '100%'
this.container.style.boxSizing = 'border-box'

this.container.type = type
this.container.id = id
}


getValue = function () {
return this.container.value
}

setValue = function (value) {
this.container.value = value
}

getType = function () {
return this.container.type
}

setType = function (type) {
this.container.type = type
}
}
9 changes: 9 additions & 0 deletions staff/aaron-barrios/unsocial/compo/Label.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//LABEL INSTANCES
class Label extends Compo {
constructor(text, id) {
super(document.createElement('label'))

this.container.innerText = text
this.container.htmlFor = id
}
}
Loading

0 comments on commit ed8b731

Please sign in to comment.