Skip to content

Commit

Permalink
Merge pull request #32 from DaleStudy/sam/23
Browse files Browse the repository at this point in the history
feat : implemented header component
  • Loading branch information
SamTheKorean authored Jun 14, 2024
2 parents a9eb4f9 + 32ec7fa commit 115c61d
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 10 deletions.
68 changes: 68 additions & 0 deletions components/header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import "./link-button/link-button.js";

const template = document.createElement("template");
template.innerHTML = `
<style>
:host {
position: fixed;
top: 0;
left: 0;
padding: 20px 0;
width: 100%;
border-bottom: 1px solid #D3D3D3;
background-color: rgba(255, 255, 255, 0.8);
}
header {
width: 80%;
margin: 0 auto;
justify-content: space-between;
display: flex;
align-items: center;
}
.buttons-container {
display: flex;
}
a {
display: flex;
gap: 10px;
align-items: center;
text-decoration: none;
}
a img {
width: 45px;
height: 22.5px;
}
a span {
font-size: 20px;
font-weight: 500;
color: black;
}
</style>
<header>
<a href="/">
<img src="images/logo.png" alt="logo" />
<span>달레 스터디</span>
</a>
<div class="buttons-container">
<link-button href="#join-instruction-container" size="large" variant="primary">참여방법 안내</link-button>
<link-button href="https://discord.gg/43UkheRV" size="large" variant="secondary">디스코드 참여하기</link-button>
</div>
</header>
`;

class HeaderComponent extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: "open" });
this.shadowRoot.appendChild(template.content.cloneNode(true));
}
}

customElements.define("header-component", HeaderComponent);

11 changes: 1 addition & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -234,16 +234,7 @@
</head>

<body>
<header>
<div>
<img src="images/logo.png" alt="#" />
<span>달레 스터디</span>
</div>
<div>
<link-button size="small" variant="ghost" href="#join-instruction-container">참여방법 안내</link-button>
<link-button size="small" variant="secondary" href="https://discord.gg/43UkheRV">디스코드 참여하기</link-button>
</div>
</header>
<header-component></header-component>

<div id="intro-container">
<div class="hero">
Expand Down
2 changes: 2 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import "./components/divider/divider.js";
import "./components/footer-link/footer-link.js";
import "./components/header.js"
import "./components/hero/hero.js";
import "./components/link-button/link-button.js";
import "./components/review-item/review-item.js";
import "./components/seo-meta-tag/seo-meta-tag.js";

0 comments on commit 115c61d

Please sign in to comment.