From 9e0e09d44297af43ffa5a9386ef28b5ea8376f24 Mon Sep 17 00:00:00 2001 From: bat Date: Thu, 2 Mar 2023 08:29:51 +0000 Subject: [PATCH] Actualizar 'components/project.js' --- components/project.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/components/project.js b/components/project.js index 47e0c12..5bc6e9e 100644 --- a/components/project.js +++ b/components/project.js @@ -3,6 +3,12 @@ export class Project extends HTMLElement { super() const shadow = this.attachShadow({mode: 'open'}) const textArea = document.createElement('textarea') + const path = new URL( + window.location.hash || '/', + window.location + ).pathname + const header = document.createElement('h1') + header.innerText = path textArea.value = localStorage.getItem( window.location.hash ) ?? '' @@ -12,10 +18,20 @@ export class Project extends HTMLElement { e.target.value ) }) - shadow.appendChild(textArea) + const div = document.createElement('div') + div.appendChild(header) + div.appendChild(textArea) + shadow.appendChild(div) } connectedCallback() { - // add css + const style = document.createElement('style') + style.textContent = ` + textarea { + width: 80%; + height: 90dvh; + } + ` + this.shadowRoot.append(style) } } \ No newline at end of file