Skip to content

Commit

Permalink
refactor : break html into css and html
Browse files Browse the repository at this point in the history
  • Loading branch information
SamTheKorean committed Jun 20, 2024
1 parent 1c1bb1d commit f1a8d8d
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions components/hero.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
const html = `
const css = `
<style>
:host {
display: block;
font-weight: 500;
font-size: 30px;
}
:host {
display: block;
font-weight: 500;
font-size: 30px;
}
h2 {
font-weight: inherit;
font-size: 30px; /* Default font-size for h2 */
display: block; /* Ensure block display */
}
h2 {
font-weight: inherit;
font-size: 30px; /* Default font-size for h2 */
display: block; /* Ensure block display */
}
@media only screen and (min-width: 768px) {
h2 {
font-size: 40px;
}
@media only screen and (min-width: 768px) {
h2 {
font-size: 40px;
}
}
@media only screen and (min-width: 1024px) {
h2 {
font-size: 50px;
}
@media only screen and (min-width: 1024px) {
h2 {
font-size: 50px;
}
}
</style>
`;

const html = `
<h2>
<slot></slot>
</h2>
Expand All @@ -33,7 +36,7 @@ class Hero extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = html;
this.shadowRoot.innerHTML = css + html;
}
}

Expand Down

0 comments on commit f1a8d8d

Please sign in to comment.