-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: modify review item component #54
Merged
Merged
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b6310b8
refactor: refine to more semantic
yolophg 460c0a2
refactor: modify minor styles based on figma
yolophg 7468f4d
refactor: combine CSS in JS
yolophg ef6bb6c
remove: separated CSS file
yolophg 18a7b7c
rename: move JS file to /components
yolophg bae4e1a
fix: add style tag
yolophg f00d337
refactor: modify component path in main.js
yolophg 016fa3c
refactor: align depth of HTML
yolophg 8eead56
Merge branch 'main' into helena/review-item-component
yolophg 6f340f1
Merge branch 'main' into helena/review-item-component
yolophg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
class ReviewItem extends HTMLElement { | ||
constructor() { | ||
super(); | ||
} | ||
|
||
// initial render in here to ensure the element is fully connected to the DOM. | ||
connectedCallback() { | ||
this.attachShadow({ mode: "open" }); | ||
this.render(); | ||
} | ||
|
||
// getter to make it clean to access the attribute value and ensure a default empty string if the attribute is missing. | ||
get text() { | ||
return this.getAttribute("text") || ""; | ||
} | ||
|
||
get name() { | ||
return this.getAttribute("name") || ""; | ||
} | ||
|
||
get img() { | ||
return this.getAttribute("img") || ""; | ||
} | ||
|
||
render() { | ||
try { | ||
this.shadowRoot.innerHTML = ` | ||
<style> | ||
.review-item { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
border-radius: 10px; | ||
padding: 41px 51px 31px; | ||
background-color: #efefef; | ||
max-width: 568px; | ||
} | ||
.review-item blockquote, | ||
figure { | ||
margin: 0; | ||
} | ||
.review-content { | ||
display: flex; | ||
align-items: center; | ||
} | ||
.review-content figure { | ||
width: 104px; | ||
height: 104px; | ||
flex-shrink: 0; | ||
object-fit: cover; | ||
margin-right: 31px; | ||
} | ||
.review-content figure > img { | ||
width: 100%; | ||
height: 100%; | ||
padding-top: 7px; | ||
border-radius: 48%; | ||
background-color: #ffffff; | ||
} | ||
.review-content blockquote { | ||
font-size: 14px; | ||
} | ||
.review-footer { | ||
width: 100%; | ||
margin-top: 14px; | ||
} | ||
.review-footer figcaption { | ||
font-size: 16px; | ||
text-align: right; | ||
} | ||
</style> | ||
<article class="review-item"> | ||
<section class="review-content"> | ||
<figure> | ||
<img src="${this.img}" alt="Reviewer"> | ||
</figure> | ||
<blockquote>${this.text}</blockquote> | ||
</section> | ||
<footer class="review-footer"> | ||
<figcaption>${this.name}</figcaption> | ||
</footer> | ||
</article> | ||
`; | ||
} catch (error) { | ||
// log any rendering errors. | ||
console.error("Error during render:", error); | ||
} | ||
} | ||
} | ||
|
||
customElements.define("review-item", ReviewItem); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,6 +1,8 @@ | ||
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.js"; | ||
import "./components/button-link.js"; | ||
import "./components/review-item/review-item.js"; | ||
import "./components/seo-meta-tag/seo-meta-tag.js"; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
한 페이지 안에 footer가 두 개 이상 있으면 안 될 것 같아요. 어색해보이네요.
하지만 또, 찾아보면 꼭 footer가 하나만 있어야 한다는 것도 아니네요. SEO에도 큰 영향은 없어보입니다.
@DaleSeo @nhistory 분들은 어떻게 생각하시나요?