Skip to content

Commit dd40553

Browse files
committed
add content placeholder
1 parent 82d6111 commit dd40553

File tree

4 files changed

+188
-1
lines changed

4 files changed

+188
-1
lines changed

24-content placeholder/index.html

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<link rel="stylesheet" href="style.css" />
7+
<title>Content Placeholder</title>
8+
</head>
9+
<body>
10+
<div class="card">
11+
<div class="card-header animated-bg" id="header">&nbsp;</div>
12+
13+
<div class="card-content">
14+
<h3 class="card-title animated-bg animated-bg-text" id="title">
15+
&nbsp;
16+
</h3>
17+
<p class="card-excerpt" id="excerpt">
18+
&nbsp;
19+
<span class="animated-bg animated-bg-text">&nbsp;</span>
20+
<span class="animated-bg animated-bg-text">&nbsp;</span>
21+
<span class="animated-bg animated-bg-text">&nbsp;</span>
22+
</p>
23+
<div class="author">
24+
<div class="profile-img animated-bg" id="profile-img">&nbsp;</div>
25+
<div class="author-info">
26+
<strong class="animated-bg animated-bg-text" id="name"
27+
>&nbsp;</strong
28+
>
29+
<small class="animated-bg animated-bg-text" id="date">&nbsp;</small>
30+
</div>
31+
</div>
32+
</div>
33+
</div>
34+
<script src="script.js"></script>
35+
</body>
36+
</html>

24-content placeholder/script.js

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
const header = document.getElementById("header");
2+
const title = document.getElementById("title");
3+
const excerpt = document.getElementById("excerpt");
4+
const profile_img = document.getElementById("profile-img");
5+
const name = document.getElementById("name");
6+
const date = document.getElementById("date");
7+
const today = new Date();
8+
const monthNames = [
9+
"Jan",
10+
"Feb",
11+
"Mar",
12+
"Apr",
13+
"May",
14+
"Jun",
15+
"Jul",
16+
"Aug",
17+
"Sep",
18+
"Oct",
19+
"Nov",
20+
"Dec",
21+
];
22+
23+
const animated_bgs = document.querySelectorAll(".animated-bg");
24+
const animated_bg_texts = document.querySelectorAll(".animated-bg-text");
25+
26+
const getData = () => {
27+
header.innerHTML =
28+
'<img src="https://images.unsplash.com/photo-1610729681715-1d22287e7b67?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80" alt="" />';
29+
title.innerHTML = "Lorem ipsum dolor sit amet";
30+
excerpt.innerHTML =
31+
"Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolore perferendis";
32+
profile_img.innerHTML =
33+
'<img src="https://randomuser.me/api/portraits/men/45.jpg" alt="" />';
34+
name.innerHTML = "John Doe";
35+
date.innerHTML = `${
36+
monthNames[today.getMonth()]
37+
} ${today.getDate()}, ${today.getFullYear()}`;
38+
animated_bgs.forEach((background) =>
39+
background.classList.remove("animated-bg")
40+
);
41+
animated_bg_texts.forEach((background) =>
42+
background.classList.remove("animated-bg-text")
43+
);
44+
};
45+
46+
setTimeout(getData, 2500);

24-content placeholder/style.css

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap");
2+
3+
* {
4+
box-sizing: border-box;
5+
}
6+
7+
body {
8+
background-color: #ecf0f1;
9+
font-family: "Roboto", sans-serif;
10+
display: flex;
11+
align-items: center;
12+
justify-content: center;
13+
height: 100vh;
14+
overflow: hidden;
15+
margin: 0;
16+
}
17+
18+
img {
19+
max-width: 100%;
20+
}
21+
22+
.card {
23+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
24+
border-radius: 10px;
25+
overflow: hidden;
26+
width: 350px;
27+
}
28+
29+
.card-header {
30+
height: 200px;
31+
}
32+
33+
.card-header img {
34+
object-fit: cover;
35+
height: 100%;
36+
width: 100%;
37+
}
38+
39+
.card-content {
40+
background-color: #fff;
41+
padding: 30px;
42+
}
43+
44+
.card-title {
45+
height: 20px;
46+
margin: 0;
47+
}
48+
49+
.card-excerpt {
50+
color: #777;
51+
margin: 10px 0 20px;
52+
}
53+
54+
.author {
55+
display: flex;
56+
}
57+
58+
.profile-img {
59+
border-radius: 50%;
60+
overflow: hidden;
61+
height: 40px;
62+
width: 40px;
63+
}
64+
65+
.author-info {
66+
display: flex;
67+
flex-direction: column;
68+
justify-content: space-around;
69+
margin-left: 10px;
70+
width: 100px;
71+
}
72+
73+
.author-info small {
74+
color: #aaa;
75+
margin-top: 5px;
76+
}
77+
78+
.animated-bg {
79+
background-image: linear-gradient(
80+
to right,
81+
#f6f7f8 0%,
82+
#edeef1 10%,
83+
#f6f7f8 20%,
84+
#f6f7f8 100%
85+
);
86+
background-size: 200% 100%;
87+
animation: bgPos 1s linear infinite;
88+
}
89+
90+
.animated-bg-text {
91+
border-radius: 50px;
92+
display: inline-block;
93+
margin: 0;
94+
height: 10px;
95+
width: 100%;
96+
}
97+
98+
@keyframes bgPos {
99+
0% {
100+
background-position: 50% 0;
101+
}
102+
100% {
103+
background-position: -150% 0;
104+
}
105+
}

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
| 21 | [Drag N Drop](https://github.com/solygambas/html-css-fifty-projects/tree/master/21-drag%20n%20drop) | [Live Demo](https://codepen.io/solygambas/pen/RwGEyme) |
3030
| 22 | [Drawing App](https://github.com/solygambas/html-css-fifty-projects/tree/master/22-drawing%20app) | [Live Demo](https://codepen.io/solygambas/pen/wvzREMx) |
3131
| 23 | [Kinetic Loader](https://github.com/solygambas/html-css-fifty-projects/tree/master/23-kinetic%20loader) | [Live Demo](https://codepen.io/solygambas/pen/JjRwVLW) |
32-
| 24 | [Content Placeholder](https://github.com/solygambas/html-css-fifty-projects/tree/master/content-placeholder) | [Live Demo](/content-placeholder/) |
32+
| 24 | [Content Placeholder](https://github.com/solygambas/html-css-fifty-projects/tree/master/24-content%20placeholder) | [Live Demo](https://codepen.io/solygambas/pen/ExgGzaX) |
3333
| 25 | [Sticky Navbar](https://github.com/solygambas/html-css-fifty-projects/tree/master/sticky-navigation) | [Live Demo](/sticky-navbar/) |
3434
| 26 | [Double Vertical Slider](https://github.com/solygambas/html-css-fifty-projects/tree/master/double-vertical-slider) | [Live Demo](/double-vertical-slider/) |
3535
| 27 | [Toast Notification](https://github.com/solygambas/html-css-fifty-projects/tree/master/toast-notification) | [Live Demo](/toast-notification/) |

0 commit comments

Comments
 (0)