-
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.
- Loading branch information
Showing
11 changed files
with
73 additions
and
30 deletions.
There are no files selected for viewing
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
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,15 @@ | ||
class BodyComponent extends HTMLElement { | ||
constructor() { | ||
super(); | ||
this.attachShadow({ mode: 'open' }); | ||
const template = document.createElement('template'); | ||
template.innerHTML = ` | ||
<style> | ||
@import "../../stylesheets/body-component.css"; | ||
</style> | ||
<h1>Hello</h1> | ||
`; | ||
this.shadowRoot.appendChild(template.content.cloneNode(true)); | ||
} | ||
} | ||
customElements.define('body-component', BodyComponent); |
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,18 +1,20 @@ | ||
|
||
class FooterComponent extends HTMLElement { | ||
constructor() { | ||
super(); | ||
this.attachShadow({ mode: 'open' }); | ||
const template = document.createElement('template'); | ||
template.innerHTML = ` | ||
constructor() { | ||
super(); | ||
this.attachShadow({ mode: 'open' }); | ||
const template = document.createElement('template'); | ||
template.innerHTML = ` | ||
<head> | ||
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@^2.0/dist/tailwind.min.css" rel="stylesheet"> | ||
</head> | ||
<style> | ||
@import "../../stylesheets/footer-component.css" | ||
</style> | ||
<footer class="flex justify-center items-center bg-gray-700 text-white p-4"> | ||
<p>© 2024 My Website. All rights reserved.</p> | ||
</footer> | ||
`; | ||
this.shadowRoot.appendChild(template.content.cloneNode(true)); | ||
} | ||
this.shadowRoot.appendChild(template.content.cloneNode(true)); | ||
} | ||
} | ||
customElements.define('footer-component', FooterComponent); |
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,18 +1,20 @@ | ||
|
||
class HeaderComponent extends HTMLElement { | ||
constructor() { | ||
super(); | ||
this.attachShadow({ mode: 'open' }); | ||
const template = document.createElement('template'); | ||
template.innerHTML = ` | ||
constructor() { | ||
super(); | ||
this.attachShadow({ mode: 'open' }); | ||
const template = document.createElement('template'); | ||
template.innerHTML = ` | ||
<head> | ||
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@^2.0/dist/tailwind.min.css" rel="stylesheet"> | ||
</head> | ||
<header class="flex justify-center items-center bg-blue-500 text-white p-4"> | ||
<style> | ||
@import "../../stylesheets/header-component.css" | ||
</style> | ||
<header class="justify-center items-center bg-blue-500 text-white p-4"> | ||
<h1>Welcome to My Website</h1> | ||
</header> | ||
`; | ||
this.shadowRoot.appendChild(template.content.cloneNode(true)); | ||
} | ||
this.shadowRoot.appendChild(template.content.cloneNode(true)); | ||
} | ||
} | ||
customElements.define('header-component', HeaderComponent); |
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,15 +1,17 @@ | ||
|
||
class MainComponent extends HTMLElement { | ||
constructor() { | ||
super(); | ||
this.attachShadow({ mode: 'open' }); | ||
const template = document.createElement('template'); | ||
template.innerHTML = ` | ||
constructor() { | ||
super(); | ||
this.attachShadow({ mode: 'open' }); | ||
const template = document.createElement('template'); | ||
template.innerHTML = ` | ||
<style> | ||
@import "../../stylesheets/main-component.css"; | ||
</style> | ||
<header-component></header-component> | ||
<body-component></body-component> | ||
<footer-component></footer-component> | ||
`; | ||
this.shadowRoot.appendChild(template.content.cloneNode(true)); | ||
} | ||
this.shadowRoot.appendChild(template.content.cloneNode(true)); | ||
} | ||
} | ||
customElements.define('main-component', MainComponent); |
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
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,6 @@ | ||
:host { | ||
flex: 1 1 auto; | ||
/* Grow to fill available space */ | ||
overflow-y: auto; | ||
/* Add scroll if content overflows */ | ||
} |
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,3 @@ | ||
:host { | ||
flex: 0 1 auto; | ||
} |
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,3 @@ | ||
:host { | ||
flex: 0 1 auto; | ||
} |
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,6 @@ | ||
:host { | ||
display: flex; | ||
flex-direction: column; | ||
height: 100vh; | ||
/* Full viewport height */ | ||
} |
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,6 @@ | ||
/* theme.css */ | ||
:root { | ||
--background-color: #333; | ||
--text-color: #fff; | ||
--padding: 10px; | ||
} |