diff --git a/README.md b/README.md index 68ce041..088b3d9 100644 Binary files a/README.md and b/README.md differ diff --git a/client/public/components/components.js b/client/public/components/components.js index a6c3b0a..9939365 100644 --- a/client/public/components/components.js +++ b/client/public/components/components.js @@ -8,7 +8,9 @@ class Component extends HTMLElement { } } -// some not-so-scalable way to load all the components +// other components with behaviour go here + +// some not-so-scalable way to load all the generic template-like components async function loadComponents() { // because of "sECuRItY" i can't simply just find everything in the components folder // there is a way to sideload this with express and have it do all that stuff @@ -17,10 +19,12 @@ async function loadComponents() { 'navbar' ]; for (let i = 0; i < components.length; i++) { - const path = `./components/${components[i]}.html`; + const path = `./components/${components[i]}/${components[i]}.html`; const component = await sideLoad(path); - const stylePath = `./components/${components[i]}.css`; + const stylePath = `./components/${components[i]}/${components[i]}.css`; const styleComponent = await sideLoad(stylePath); + const scriptPath = `./components/${components[i]}/${components[i]}.js`; + const scriptComponent = await sideLoad(scriptPath); const Template = class extends Component { constructor() { @@ -31,6 +35,11 @@ async function loadComponents() { shadow.innerHTML = component; + const script = document.createElement('script'); + script.text = scriptComponent; + shadow.appendChild(script); + + // always assume global.css is the first css file const style = document.createElement('style'); style.textContent = styleComponent; shadow.appendChild(style); diff --git a/client/public/components/navbar.css b/client/public/components/navbar.css deleted file mode 100644 index e1a7fc7..0000000 --- a/client/public/components/navbar.css +++ /dev/null @@ -1,5 +0,0 @@ -h1 { - font-size: 1.5em; - color: rgb(214, 114, 114); - margin: 0; -} \ No newline at end of file diff --git a/client/public/components/navbar.html b/client/public/components/navbar.html deleted file mode 100644 index a602c42..0000000 --- a/client/public/components/navbar.html +++ /dev/null @@ -1,2 +0,0 @@ - -