forked from b00tc4mp/isdi-bootcamp-202409
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re ordered files, added compo extends and add posts b00tc4mp#174
- Loading branch information
1 parent
4369737
commit ed8b731
Showing
37 changed files
with
609 additions
and
612 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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 | ||
} | ||
|
||
} |
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
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) | ||
} | ||
} |
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
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() | ||
} | ||
} |
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
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 | ||
} | ||
} |
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
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%' | ||
} | ||
} |
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
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 | ||
} | ||
} |
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
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 | ||
} | ||
} |
Oops, something went wrong.