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.
estructure unsocial with app and api folders b00tc4mp#168
- Loading branch information
Javier Romera Claros
authored and
Javier Romera Claros
committed
Oct 28, 2024
1 parent
e170da4
commit 91f6c91
Showing
120 changed files
with
1,369 additions
and
3 deletions.
There are no files selected for viewing
Binary file not shown.
Empty file.
Empty file.
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,12 @@ | ||
{ | ||
"name": "api", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"description": "" | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
.../javier-romera/unsocial/package-lock.json → ...ier-romera/unsocial/app/package-lock.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
staff/javier-romera/unsocial/package.json → ...f/javier-romera/unsocial/app/package.json
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "unsocial", | ||
"name": "app", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
13 changes: 13 additions & 0 deletions
13
staff/javier-romera/unsocial/zzz/unsocial.01/compo/Button.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* Constructs Button instances | ||
* | ||
* @param {string} text The text of the button | ||
* @param {string} type The button type | ||
*/ | ||
class Button extends Compo { | ||
constructor(type, text) { | ||
super(document.createElement('button')) | ||
this.container.innerText = text | ||
this.container.type = type | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
staff/javier-romera/unsocial/zzz/unsocial.01/compo/Code.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* | ||
* @param {*} text | ||
*/ | ||
class Code extends Compo { | ||
constructor(text) { | ||
super(document.createElement('code')) | ||
|
||
this.container.innerText = text | ||
} | ||
|
||
setText(text) { | ||
this.container.innerText = text | ||
} | ||
|
||
getText() { | ||
return this.container.innerText | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
staff/javier-romera/unsocial/zzz/unsocial.01/compo/Compo.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Constructs Compo instances | ||
* | ||
* @param {HTMLElement} container The DOM container of the Compo instance | ||
*/ | ||
class Compo { | ||
constructor(container) { | ||
this.children = [] | ||
this.container = container | ||
this.parent = null | ||
} | ||
|
||
add(child) { | ||
this.children.push(child) | ||
child.parent = this | ||
|
||
this.container.appendChild(child.container) | ||
} | ||
|
||
removeSelf() { | ||
const index = this.parent.children.findIndex(child => child === this) | ||
|
||
if (index > -1) | ||
this.parent.children.splice(index, 1) | ||
|
||
this.container.remove() | ||
} | ||
|
||
addBehavior(type, callback) { | ||
this.container.addEventListener(type, callback) | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
staff/javier-romera/unsocial/zzz/unsocial.01/compo/Form.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* Constructs Form instances | ||
*/ | ||
class Form extends Compo { | ||
constructor() { | ||
super(document.createElement('form')) | ||
} | ||
|
||
reset() { | ||
this.container.reset() | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
staff/javier-romera/unsocial/zzz/unsocial.01/compo/Heading.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* Constructs Heading instances | ||
* | ||
* @param {string} text The text of the heading | ||
* @param {number} level The heading level | ||
*/ | ||
class Heading extends Compo { | ||
constructor(text, level) { | ||
super(document.createElement('h' + level)) | ||
this.container.innerText = text | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
staff/javier-romera/unsocial/zzz/unsocial.01/compo/Image.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* | ||
*/ | ||
class Image extends Compo { | ||
constructor(address) { | ||
super(document.createElement('img')) | ||
|
||
this.container.src = address | ||
this.container.style.width = '100%' | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
staff/javier-romera/unsocial/zzz/unsocial.01/compo/Input.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Constructs Input instances | ||
* | ||
* @param {string} type The input type | ||
* @param {string} id The input id | ||
*/ | ||
class Input extends Compo { | ||
constructor(id, type) { | ||
super(document.createElement('input')) | ||
// this.container.style.width = '100%' | ||
// this.container.style.boxSizing = 'border-box' | ||
|
||
this.container.id = id | ||
this.container.type = type | ||
} | ||
|
||
getValue() { | ||
return this.container.value | ||
} | ||
|
||
setValue(value) { | ||
this.container.value = value | ||
} | ||
|
||
getType() { | ||
return this.container.type | ||
} | ||
|
||
setType(type) { | ||
this.container.type = type | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
staff/javier-romera/unsocial/zzz/unsocial.01/compo/Label.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* Constructs Label instances | ||
* | ||
* @param {string} text The text of the label | ||
* @param {string} id The id of the input to relate with | ||
*/ | ||
class Label extends Compo { | ||
constructor(text, id) { | ||
super(document.createElement('label')) | ||
this.container.innerText = text | ||
this.container.htmlFor = id | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
staff/javier-romera/unsocial/zzz/unsocial.01/compo/Link.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* Constructs Link instances | ||
* | ||
* @param {string} text The text of the link | ||
*/ | ||
class Link extends Compo { | ||
constructor(text) { | ||
super(document.createElement('a')) | ||
this.container.href = '' | ||
this.container.innerText = text | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
staff/javier-romera/unsocial/zzz/unsocial.01/compo/ListItem.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* | ||
*/ | ||
class ListItem extends Compo { | ||
constructor() { | ||
super(document.createElement('li')) | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
staff/javier-romera/unsocial/zzz/unsocial.01/compo/Paragraph.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* | ||
* @param {*} text | ||
*/ | ||
class Paragraph extends Compo { | ||
constructor(text) { | ||
super(document.createElement('p')) | ||
|
||
this.container.innerText = text | ||
} | ||
|
||
setText(text) { | ||
this.container.innerText = text | ||
} | ||
|
||
getText() { | ||
return this.container.innerText | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
staff/javier-romera/unsocial/zzz/unsocial.01/compo/PasswordInput.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* Constructs PasswordInput instances | ||
* | ||
* @param {string} id The input id | ||
*/ | ||
class PasswordInput extends Compo { | ||
constructor(id) { | ||
super(document.createElement('div')) | ||
this.container.style.display = 'flex' | ||
|
||
const input = new Input('password', id) | ||
input.container.style.paddingRight = '18px' | ||
this.add(input) | ||
|
||
const span = new Span('😌') | ||
span.container.style.cursor = 'pointer' | ||
span.container.style.position = 'absolute' | ||
span.container.style.right = '10px' | ||
this.add(span) | ||
|
||
span.addBehavior('click', () => { | ||
if (span.getText() === '😌') { | ||
input.setType('text') | ||
span.setText('😳') | ||
} else { | ||
input.setType('password') | ||
span.setText('😌') | ||
} | ||
}) | ||
} | ||
|
||
getValue() { | ||
return this.children[0].container.value | ||
} | ||
|
||
setValue(value) { | ||
this.container.value = value | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
staff/javier-romera/unsocial/zzz/unsocial.01/compo/Preformatted.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* | ||
* @param {*} text | ||
*/ | ||
class Preformatted extends Compo { | ||
constructor(text) { | ||
super(document.createElement('pre')) | ||
|
||
this.container.innerText = text | ||
} | ||
|
||
setText(text) { | ||
this.container.innerText = text | ||
} | ||
|
||
getText() { | ||
return this.container.innerText | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
staff/javier-romera/unsocial/zzz/unsocial.01/compo/Snippet.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* | ||
* @param {*} text | ||
*/ | ||
class Snippet extends Compo { | ||
constructor(title, text) { | ||
super(document.createElement('div')) | ||
|
||
const heading = new Heading(title, 4) | ||
this.add(heading) | ||
|
||
const pre = new Preformatted('') | ||
const code = new Code(text) | ||
pre.add(code) | ||
|
||
this.add(pre) | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
staff/javier-romera/unsocial/zzz/unsocial.01/compo/Span.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* Constructs Span instances | ||
* | ||
* @param {string} text The text inside span | ||
*/ | ||
class Span extends Compo { | ||
constructor(text) { | ||
super(document.createElement('span')) | ||
|
||
this.container.innerText = text | ||
} | ||
|
||
setText(text) { | ||
this.container.innerText = text | ||
} | ||
|
||
getText() { | ||
return this.container.innerText | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
staff/javier-romera/unsocial/zzz/unsocial.01/compo/Time.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* | ||
* @param {*} text | ||
*/ | ||
class Time extends Compo { | ||
constructor(text) { | ||
super(document.createElement('time')) | ||
|
||
this.container.innerText = text | ||
} | ||
|
||
setText(text) { | ||
this.container.innerText = text | ||
} | ||
|
||
getText() { | ||
return this.container.innerText | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
staff/javier-romera/unsocial/zzz/unsocial.01/compo/UnorderedList.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* | ||
*/ | ||
class UnorderedList extends Compo { | ||
constructor() { | ||
super(document.createElement('ul')) | ||
} | ||
} |
Oops, something went wrong.