Skip to content

Commit c48e4c5

Browse files
authored
fix: grid to responsive flexbox design & css modifications (#13)
1 parent 1e2d2d2 commit c48e4c5

File tree

2 files changed

+216
-173
lines changed

2 files changed

+216
-173
lines changed

src/Home.module.css

Lines changed: 83 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
1-
/* --- Main Layout --- */
2-
.filterContainer {
3-
position: sticky;
4-
top: 0;
5-
z-index: 100;
6-
background-color: white;
7-
padding: 16px 30px 0px 30px;
8-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
9-
}
10-
111
.main {
122
display: flex;
133
flex-direction: column;
14-
padding: 0 30px 16px 30px;
4+
padding: 16px 30px;
5+
}
6+
.panelWrapper {
7+
flex-direction: column;
8+
align-items: flex-start;
159
}
1610

1711
.contentWrapper {
1812
display: flex;
19-
flex-direction: column;
13+
flex-direction: row;
2014
gap: 20px;
2115
width: 100%;
22-
/* Removed max-width for 3-column layout */
2316
margin: 0 auto;
24-
width: 1000px;
17+
max-width: 1200px;
18+
padding: 0 16px;
19+
}
20+
21+
.filterContainer {
22+
flex: 0 0 220px; /* Do not grow, do not shrink, base width 220px */
23+
}
24+
25+
.postsArea {
26+
flex: 1;
27+
min-width: 0;
2528
}
2629

27-
/* --- Filter Panel (Accordion) --- */
2830
.accordion {
2931
background-color: #eee;
3032
color: #444;
@@ -52,25 +54,61 @@
5254
overflow: hidden;
5355
}
5456

55-
/* --- Filter Chips --- */
57+
.panel div {
58+
margin-bottom: 6px;
59+
font-size: 18px;
60+
}
61+
.panel section {
62+
margin-top: 12px;
63+
}
64+
5665
ul.chips {
57-
margin: 0;
66+
margin: 30px 0 50px;
5867
list-style: none;
5968
display: flex;
6069
gap: 6px;
6170
flex-wrap: wrap;
62-
padding: 0;
71+
padding: 0 16px 16px 16px;
6372
}
6473

65-
/* --- Post Grid (3xN Layout) --- */
74+
/* --- Post List (flex, responsive) --- */
6675
.postList {
67-
display: grid;
68-
/* Defines the 3-column layout */
69-
grid-template-columns: repeat(3, 1fr);
76+
display: flex;
77+
flex-wrap: wrap;
7078
gap: 20px;
79+
justify-content: space-between;
80+
align-items: flex-start;
81+
}
82+
83+
.postList > * {
84+
/* Default: 3 columns. The -20px accounts for gaps so cards fit nicely */
85+
flex: 1 1 calc(33.333% - 20px);
86+
max-width: calc(33.333% - 20px);
87+
}
88+
89+
/* Medium screens: 2 columns */
90+
@media (max-width: 1000px) {
91+
.postList > * {
92+
flex: 1 1 calc(50% - 20px);
93+
max-width: calc(50% - 20px);
94+
}
95+
}
96+
97+
/* Small screens: 1 column */
98+
@media (max-width: 768px) {
99+
.contentWrapper {
100+
flex-direction: column;
101+
padding: 0 12px;
102+
}
103+
.postList {
104+
gap: 16px;
105+
}
106+
.postList > * {
107+
flex: 1 1 100%;
108+
max-width: 100%;
109+
}
71110
}
72111

73-
/* --- Pagination --- */
74112
.pagination {
75113
display: flex;
76114
justify-content: center;
@@ -106,12 +144,11 @@ ul.chips {
106144
}
107145

108146
.pagination button.activePage {
109-
background-color: #007bff;
147+
background-color: #555;
110148
color: white;
111-
border-color: #007bff;
149+
border-color: rgba(217, 217, 217, 1);
112150
}
113151

114-
/* --- Modal Styles (Dropdown) --- */
115152
.modalTrigger {
116153
position: relative;
117154
}
@@ -200,6 +237,26 @@ ul.chips {
200237
transform: scale(1);
201238
}
202239

240+
[type="checkbox"] {
241+
appearance: none;
242+
box-sizing: border-box;
243+
background-clip: content-box;
244+
width: 1.25em;
245+
height: 1.25em;
246+
border: 1px solid rgba(72, 76, 83, 1);
247+
border-radius: 3px;
248+
cursor: pointer;
249+
}
250+
251+
[type="checkbox"]:checked {
252+
border-color: rgba(72, 76, 83, 1);
253+
background-color: rgba(72, 76, 83, 1);
254+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 11 8' fill='none'%3E%3Cpath d='M1 3.5L4.5 7L9.5 1' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
255+
background-position: center;
256+
background-repeat: no-repeat;
257+
background-size: 0.75em;
258+
}
259+
203260
/* --- Modal Styles (Login Confirmation) --- */
204261
.modalBackdrop {
205262
position: fixed;
@@ -234,29 +291,3 @@ ul.chips {
234291
gap: 12px;
235292
justify-content: center;
236293
}
237-
238-
.modalActions button {
239-
padding: 10px 20px;
240-
border-radius: 6px;
241-
border: 1px solid #ccc;
242-
background-color: #f0f0f0;
243-
cursor: pointer;
244-
font-size: 14px;
245-
font-weight: 500;
246-
color: #212529;
247-
transition: background-color 0.2s;
248-
}
249-
250-
.modalActions button:first-child:hover {
251-
background-color: #e2e6ea;
252-
}
253-
254-
.modalActions button:last-child {
255-
background-color: #007bff;
256-
color: white;
257-
border-color: #007bff;
258-
}
259-
260-
.modalActions button:last-child:hover {
261-
background-color: #0069d9;
262-
}

0 commit comments

Comments
 (0)