Skip to content

Commit d1f3359

Browse files
committed
the style of the buttons are improved
1 parent 5140058 commit d1f3359

File tree

17 files changed

+131
-61
lines changed

17 files changed

+131
-61
lines changed

index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
<link rel="stylesheet" href="src/styles/normalize.css">
1212
<link rel="stylesheet" href="src/styles/common.css">
1313

14+
<link rel="stylesheet" href="src/styles/components/buttons.css">
15+
<link rel="stylesheet" href="src/styles/components/inputs.css">
16+
<link rel="stylesheet" href="src/styles/components/selects.css">
17+
1418
<link rel="stylesheet" href="src/styles/navbar.css">
1519
<link rel="stylesheet" href="src/styles/footer.css">
1620

@@ -22,7 +26,7 @@
2226
<link rel="stylesheet" href="src/styles/components/post-card-container.css">
2327
<link rel="stylesheet" href="src/styles/components/post.css">
2428

25-
<link rel="stylesheet" href="src/styles/components/buttons.css">
29+
2630

2731
<link rel="stylesheet" href="src/styles/components/pagination.css">
2832

src/js/components/navbar/navbarView.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,28 @@ export function navbarView() {
1212
return `
1313
<div class='navbar-container'>
1414
<div class="nav-left">
15-
<a id="index-btn">Home</a>
15+
<a id="index-btn" class="btn btn-home">Home</a>
1616
</div>
1717
1818
<div class="nav-center">
1919
<form id="search-form">
2020
21-
<input id="search" name="search" type="text" placeholder="Search" />
21+
<input id="search" class="input-search" name="search" type="text" placeholder="Search" />
2222
23-
<select id="post-tag" name="tag">
23+
<select id="post-tag" class="select-search" name="tag">
2424
${tagSelector}
2525
</select>
2626
27-
<button type="submit">Search</button>
27+
<button type="submit" class="btn btn-search">Search</button>
2828
2929
</form>
3030
</div>
3131
3232
<div class="nav-right">
33-
<a id="create-post-btn">Create Post</a>
34-
<a id="login-btn">Login</a>
35-
<a id="signup-btn">Sign Up</a>
36-
<a id="logout-btn">Log Out</a>
33+
<a id="create-post-btn" class="btn btn-primary-navbar">Create Post</a>
34+
<a id="login-btn" class="btn btn-primary-navbar">Login</a>
35+
<a id="signup-btn" class="btn btn-primary-navbar">Sign Up</a>
36+
<a id="logout-btn" class="btn btn-secondary-navbar">Log Out</a>
3737
</div>
3838
</div>
3939
`;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export const buildNotification = (message) => {
22
return `
33
<p>${message}</p>
4-
<button>X</button>
4+
<button class="btn-exit">X</button>
55
`
66
}
77

src/js/modules/create-post/createPostView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const buildCreatePostForm = () => {
4545
<select id='post-tag'>${tagSelector}</select>
4646
</div>
4747
48-
<button>Create Post</button>
48+
<button class="btn btn-primary">Create Post</button>
4949
`;
5050

5151
return createPostFormView

src/js/modules/post-detail/postDetailController.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ export const postDetailController = async (postContainer, postId) => {
7474
cancel.addEventListener("click", (event) => {
7575
event.preventDefault();
7676

77-
render_ReadOnlyView(postDetail, true);
77+
postContainer.innerHTML = buildReadOnlyView(post, true);
78+
renderReadOnlyView(post, true)
7879
});
7980
}
8081

src/js/modules/post-detail/postDetailView.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ export const buildReadOnlyView = (post, isOwner) => {
3333
<p><strong>Last update at: </strong>${formattedDate}</p>
3434
3535
${isOwner ? `
36-
<button id="edit-post">Edit</button>
37-
<button id="delete-post">Delete</button>
36+
<div class="buttons-container">
37+
<button id="edit-post" class="btn btn-primary">Edit</button>
38+
<button id="delete-post"class="btn btn-secondary">Delete</button>
39+
</div>
3840
` : ''}
3941
`;
4042

@@ -59,7 +61,7 @@ export const buildEditableView = (post) => {
5961
const postHTML = `
6062
<form id="edit-post-form" class="form">
6163
62-
<div class="image-preview">
64+
<div class="image-container">
6365
<img src="${post.image}" alt="Current Image" class="post-image" />
6466
</div>
6567
@@ -97,8 +99,8 @@ export const buildEditableView = (post) => {
9799
</div>
98100
99101
<div class="buttons-container">
100-
<button id="save-changes">Save</button>
101-
<button id="cancel-edit">Cancel</button>
102+
<button id="save-changes" class="btn btn-primary">Save</button>
103+
<button id="cancel-edit" class="btn btn-secondary">Cancel</button>
102104
</div>
103105
</form>
104106
`;

src/js/modules/show-posts/showPostsController.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ export async function showPostsController(container) { // the container is ".pos
7575

7676
for (let i = 1; i <= pageCount; i++) {
7777
const btn = document.createElement('button');
78+
btn.classList.add('btn');
79+
7880
btn.textContent = i;
7981

8082
if (i === currentPage) {

src/styles/common.css

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,23 @@
66
--bg-color-4: #b3b3b3;
77

88
--bg-post: white;
9+
--bg-search: rgb(157, 234, 248);
10+
--bg-search-2: rgb(245, 254, 255);
911

10-
--btn-X-notification-success: #1e84be;
11-
--btn-X-notification-error: brown;
12+
--btn-home: rgb(226, 228, 119);
13+
--btn-search: rgb(38, 192, 219);
14+
15+
--btn-p-navbar: rgb(160, 231, 94) ;
16+
--btn-s-navbar: rgb(247, 117, 66) ;
17+
18+
--btn-p: rgb(191, 243, 142) ;
19+
--btn-s: rgb(248, 71, 48) ;
20+
21+
--btn-X-notification: rgb(255, 255, 255);
22+
--font-X-notification: rgb(255, 0, 0);
23+
24+
--font-btn-p: rgb(0, 0, 0);
25+
--font-btn-s: rgb(0, 0, 0);
1226

1327
font-family: Arial, sans-serif;
1428
font-size: clamp(2px, 5vw, 16px);
@@ -74,9 +88,10 @@ textarea,
7488
label,
7589
p,
7690
textarea,
77-
button,
7891
select {
7992
padding: 7px;
93+
border-radius: 6px;
94+
border: none;
8095
}
8196

8297
.radio-button{

src/styles/components/buttons.css

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,73 @@
1-
button{
1+
button,
2+
.btn {
23
font-weight: bold;
4+
font-size: large;
35
align-self: self-start;
46
width: auto;
7+
padding: 0.5rem;
58
padding-right: 1rem;
69
padding-left: 1rem;
10+
11+
border-radius: 6px;
12+
border: none;
13+
cursor: pointer;
14+
}
15+
16+
button,
17+
a.btn {
18+
opacity: 1;
19+
transition: opacity 0.3s ease-in-out;
20+
}
21+
22+
button:hover,
23+
a.btn:hover {
24+
opacity: 0.8;
25+
}
26+
27+
a.btn {
28+
display: flex;
29+
30+
width: 100%;
31+
justify-content: center;
32+
align-items: center;
33+
}
34+
35+
.btn-primary,
36+
.btn-secondary {
37+
font-size: larger;
38+
padding-right: 1.5rem;
39+
padding-left: 1.5rem;
40+
}
41+
42+
.btn-primary {
43+
background-color: var(--btn-p);
44+
}
45+
46+
.btn-secondary {
47+
background-color: var(--btn-s);
48+
color: white;
49+
}
50+
51+
52+
.btn-primary-navbar {
53+
background-color: var(--btn-p-navbar);
54+
color: var(--font-btn-p);
55+
}
56+
57+
.btn-secondary-navbar {
58+
background-color: var(--btn-s-navbar);
59+
color: var(--font-btn-s);
60+
}
61+
62+
.btn-search {
63+
background-color: var(--btn-search);
64+
}
65+
66+
.btn-home {
67+
background-color: var(--btn-home);
68+
}
69+
70+
.btn-exit{
71+
background-color: var(--btn-X-notification);
72+
color: var(--font-X-notification);
773
}

src/styles/components/inputs.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.input-search{
2+
background-color: var(--bg-search);
3+
}
4+
5+
.input-search::placeholder{
6+
color: black;
7+
}

0 commit comments

Comments
 (0)