Skip to content

Commit d98c21f

Browse files
committed
Styling a bit more.
1 parent c3dbbe3 commit d98c21f

3 files changed

Lines changed: 57 additions & 8 deletions

File tree

src/components/singlePost.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ import { createHeader } from "./headerFooterLoader.js";
66

77
async function generateSinglePost(post) {
88
const postContainer = document.createElement("div");
9+
postContainer.classList = "post-container";
910
const postTitle = document.createElement("h1");
1011
postTitle.classList = "single-title";
1112
postTitle.textContent = post.title;
13+
1214
const postMedia = document.createElement("img");
1315
postMedia.classList = "single-image";
1416
if (post.media) {
@@ -25,7 +27,7 @@ async function generateSinglePost(post) {
2527
postContainer.append(postTitle, postMedia, postBody);
2628
if (profileName === post.author.name) {
2729
const sendToEditButton = document.createElement("button");
28-
sendToEditButton.classList = "editButton";
30+
sendToEditButton.classList = "edit-button";
2931
sendToEditButton.textContent = "Edit post";
3032
sendToEditButton.addEventListener("click", () => {
3133
window.location.href = `./edit.html?id=${post.id}`;

src/profile.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,16 @@ async function renderProfile(profile) {
2626

2727
const profilePageUsername = document.createElement("h2");
2828
profilePageUsername.textContent = profile.name;
29+
profilePageUsername.classList = "profile-page-name";
30+
2931
const followButton = document.createElement("button");
3032
followButton.textContent = "Follow";
33+
followButton.classList = "follow-button";
3134
followButton.addEventListener("click", followUser);
3235

3336
const unfollowButton = document.createElement("button");
3437
unfollowButton.textContent = "Unfollow";
38+
unfollowButton.classList = "unfollow-button";
3539
unfollowButton.addEventListener("click", unfollowUser);
3640

3741
if (profile.name === profileName) {
@@ -68,10 +72,8 @@ async function renderPosts(posts) {
6872
profilePostImage.src = "https://i.imghippo.com/files/AVMh8683c.png";
6973
}
7074
profilePostImage.classList = "profile-post-image";
71-
const profilePostTitle = document.createElement("p");
72-
profilePostTitle.textContent = posts[i].title;
73-
profilePostTitle.classList = "profile-post-title";
74-
postContainer.append(profilePostImage, profilePostTitle);
75+
76+
postContainer.append(profilePostImage);
7577
profilePostsContainer.append(postContainer);
7678
}
7779
}
@@ -88,6 +90,7 @@ async function mainProfile() {
8890
alert("Something went wrong", error);
8991
}
9092
}
93+
9194
if (!getFromLocalStorage("accessToken")) {
9295
profileContainer.innerHTML = loggedOutText;
9396
} else {

src/style.css

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ body a {
1212
margin: 0%;
1313
}
1414

15-
.header-button {
15+
.header-button,
16+
.follow-button,
17+
.unfollow-button,
18+
.edit-button {
1619
height: 2rem;
1720
background-color: white;
1821
border-color: black;
@@ -25,7 +28,8 @@ body a {
2528
width: 100%;
2629
margin-top: 5rem;
2730
}
28-
.profile-pic-feed {
31+
.profile-pic-feed,
32+
.profile-page-image {
2933
border-radius: 50%;
3034
width: 3rem;
3135
height: auto;
@@ -35,8 +39,48 @@ body a {
3539
align-self: center;
3640
text-align: center;
3741
}
38-
.post-image-feed {
42+
.post-image-feed,
43+
.profile-page-image {
3944
width: 20rem;
4045
display: block;
4146
margin: 0 auto;
4247
}
48+
49+
/**Profile.html**/
50+
#profile-container {
51+
text-align: center;
52+
}
53+
.profile-page-banner {
54+
width: 100%;
55+
}
56+
.profile-page-image {
57+
width: 10rem;
58+
margin-top: 3rem;
59+
}
60+
#profile-posts-container {
61+
max-width: 100%;
62+
display: grid;
63+
grid-template-columns: auto auto;
64+
gap: 1rem;
65+
align-items: center;
66+
justify-content: center;
67+
}
68+
.profile-post-image {
69+
max-width: 10rem;
70+
aspect-ratio: 1/1;
71+
}
72+
73+
/*post.html*/
74+
.post-container {
75+
display: flex;
76+
flex-direction: column;
77+
78+
align-items: center;
79+
text-align: center;
80+
}
81+
.single-image {
82+
max-width: 20rem;
83+
}
84+
.single-body {
85+
max-width: 60%;
86+
}

0 commit comments

Comments
 (0)