Skip to content

Commit

Permalink
optimize CLS
Browse files Browse the repository at this point in the history
  • Loading branch information
tryoasnafi committed May 9, 2022
1 parent ee0a231 commit f44aa37
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 18 deletions.
10 changes: 5 additions & 5 deletions src/scripts/views/templates/template-creator.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ const createSkeletonRestaurantsTemplate = (count) => {
template += `
<section class="card">
<img src="/icons/placeholder.png" alt="skeleton restaurant" class="restaurant-image" />
<h4 class="card__title text-overflow">Restaurant Title</h4>
<p class="card__description text-overflow">Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus.</p>
<h4 class="card__title text-overflow">Restaurant Name</h4>
<p class="card__description text-overflow">A good restaurant for your best experience. We always on the mood to serve you!</p>
<section class="flex align-center">
<p class="flex"> <img src="./icons/rating-star.svg" width="20px" height="24px" alt="rating icon" loading="lazy" /> <span class="label">Rating</span></p>
<p class="flex px-1"><img src="./icons/map-pin.svg" width="16px" height="24px" alt="location icon" loading="lazy" /> <span class="label">Locations</span></p>
<p class="flex"> <img src="/icons/placeholder.png" width="20px" height="24px" alt="rating icon" /> <span class="label">4.5</span></p>
<p class="flex px-1"><img src="/icons/placeholder.png" width="16px" height="24px" alt="location icon" /> <span class="label">locations</span></p>
</section>
</section>
`;
Expand All @@ -156,7 +156,7 @@ const createSkeletonFoodsTemplate = (count) => {
for (let i = 0; i < count; i += 1) {
template += `
<section class="card">
<img src="/icons/placeholder.png" width="100%" height="192px" alt="skeleton food" class="food-image"/>
<img src="/icons/placeholder.png" alt="skeleton food" class="food-image"/>
<h4 class="card__title text-overflow">Food Menu Title</h4>
</section>
`;
Expand Down
1 change: 0 additions & 1 deletion src/styles/_content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

&:hover {
color: #15803d;
text-shadow: 1px 1px 2px #86efac;
transition: all 0.2s;
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/styles/_default.scss
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ input {
}

.card__title {
line-clamp: 2;
-webkit-line-clamp: 1;
line-clamp: 1;
}

.card__description {
Expand All @@ -81,8 +82,8 @@ input {
-webkit-box-orient: vertical;
}

#mainContent {
min-height: 80vh;
main {
min-height: min-content;

&:focus {
outline: #15803d solid 1px;
Expand Down
7 changes: 5 additions & 2 deletions src/styles/_footer.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
footer {
padding: 1.75rem 0;
background-color: #fff;
text-align: center;

p {
padding: 16px 0;
text-align: center;
}
}
10 changes: 3 additions & 7 deletions src/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@
<nav class="container px-1">
<section class="nav__brand">
<a href="/" class="flex align-center">
<img
src="./icons/icon.png"
width="48px"
height="48px"
alt="logo resfi"
/>
<h1>Resfi</h1>
</a>
<button
Expand Down Expand Up @@ -79,7 +73,9 @@ <h1>Resfi</h1>
</header>
<main id="mainContent" tabindex="0"></main>
<footer tabindex="0">
Copyright &copy; 2022 Resfi. Developed By Tryo Asnafi.
<p class="container">
Copyright &copy; 2022 Resfi. Developed By Tryo Asnafi.
</p>
</footer>
</body>
</html>

1 comment on commit f44aa37

@vercel
Copy link

@vercel vercel bot commented on f44aa37 May 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

dicoding-mfwde – ./

resfi.vercel.app
dicoding-mfwde-git-main-tryoasnafi.vercel.app
dicoding-mfwde-tryoasnafi.vercel.app

Please sign in to comment.