Skip to content

Commit db0763d

Browse files
committed
Fix size
1 parent 545bb4b commit db0763d

File tree

1 file changed

+79
-66
lines changed

1 file changed

+79
-66
lines changed

src/containers/post/RelatedPostsForGuest.tsx

Lines changed: 79 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -80,27 +80,32 @@ function RelatedPostsForGuest({
8080
<h4>관심 있을 만한 포스트</h4>
8181
{postsWithAds.map((post, index) => {
8282
return post ? (
83-
<Row key={post.id ?? index}>
84-
<div className="fourty">
85-
<div className="thumbnail-wrapper">
86-
<img
87-
src={optimizeImage(
88-
post.thumbnail ??
89-
post.user.profile.thumbnail ??
90-
userThumbnail,
91-
640,
92-
)}
93-
alt={post.title}
94-
/>
83+
<Row>
84+
<StyledRowLink
85+
to={`/@${post.user.username}/${post.url_slug}`}
86+
key={post.id ?? index}
87+
>
88+
<div className="fourty">
89+
<div className="thumbnail-wrapper">
90+
<img
91+
src={optimizeImage(
92+
post.thumbnail ??
93+
post.user.profile.thumbnail ??
94+
userThumbnail,
95+
640,
96+
)}
97+
alt={post.title}
98+
/>
99+
</div>
95100
</div>
96-
</div>
97-
<div className="content">
98-
<h5>{post.title}</h5>
99-
<p>
100-
{post.short_description.replace(/&#x3A;/g, ':')}
101-
{post.short_description.length === 150 && '...'}
102-
</p>
103-
</div>
101+
<div className="content">
102+
<h5>{post.title}</h5>
103+
<p>
104+
{post.short_description.replace(/&#x3A;/g, ':')}
105+
{post.short_description.length === 150 && '...'}
106+
</p>
107+
</div>
108+
</StyledRowLink>
104109
</Row>
105110
) : (
106111
<Row>
@@ -170,12 +175,17 @@ const Grid = styled.div`
170175
margin-top: 1.5rem;
171176
`;
172177

173-
const Row = styled.div`
174-
display: flex;
175-
.fourty {
176-
width: 40%;
177-
margin-right: 0.75rem;
178+
const Item = styled.div`
179+
position: relative;
180+
width: 33.333%;
181+
padding-left: 0.25rem;
182+
padding-right: 0.25rem;
183+
padding-bottom: 2rem;
184+
${media.medium} {
185+
width: 50%;
186+
padding-bottom: 1rem;
178187
}
188+
179189
.thumbnail-wrapper {
180190
width: 100%;
181191
padding-top: 52.35%;
@@ -191,45 +201,37 @@ const Row = styled.div`
191201
display: block;
192202
}
193203
}
194-
& + & {
195-
margin-top: 0.5rem;
196-
}
197-
.content {
198-
width: 60%;
199-
}
200204
h5 {
201-
margin-top: 0;
202-
margin-bottom: 0.625rem;
203-
font-size: 0.875rem;
204-
color: ${palette.gray8};
205-
${ellipsis}
206-
}
207-
208-
p {
209-
margin: 0;
210-
font-size: 0.75rem;
211-
display: -webkit-box;
212-
-webkit-line-clamp: 3;
205+
font-size: 1rem;
213206
line-height: 1.5;
214-
height: 3.375rem;
215-
overflow: hidden;
216-
word-break: keep-all;
217-
color: ${palette.gray6};
207+
margin-top: 0.5rem;
208+
margin-bottom: 0;
209+
display: -webkit-box;
210+
-webkit-line-clamp: 2;
218211
-webkit-box-orient: vertical;
212+
overflow: hidden;
213+
text-overflow: ellipsis;
214+
text-decoration: none;
215+
color: inherit;
216+
color: ${palette.gray8};
219217
}
220218
`;
221219

222-
const Item = styled.div`
223-
position: relative;
224-
width: 33.333%;
225-
padding-left: 0.25rem;
226-
padding-right: 0.25rem;
227-
padding-bottom: 2rem;
228-
${media.medium} {
229-
width: 50%;
230-
padding-bottom: 1rem;
220+
const Row = styled.div`
221+
& + & {
222+
margin-top: 0.5rem;
223+
}
224+
`;
225+
const StyledRowLink = styled(Link)`
226+
width: 100%;
227+
display: flex;
228+
text-decoration: none;
229+
color: inherit;
230+
display: flex;
231+
.fourty {
232+
width: 40%;
233+
margin-right: 0.75rem;
231234
}
232-
233235
.thumbnail-wrapper {
234236
width: 100%;
235237
padding-top: 52.35%;
@@ -245,19 +247,30 @@ const Item = styled.div`
245247
display: block;
246248
}
247249
}
250+
251+
.content {
252+
flex: 1;
253+
min-width: 0;
254+
}
248255
h5 {
249-
font-size: 1rem;
250-
line-height: 1.5;
251-
margin-top: 0.5rem;
252-
margin-bottom: 0;
256+
margin-top: 0;
257+
margin-bottom: 0.5rem;
258+
font-size: 0.875rem;
259+
color: ${palette.gray8};
260+
${ellipsis}
261+
}
262+
263+
p {
264+
margin: 0;
265+
font-size: 0.75rem;
253266
display: -webkit-box;
254267
-webkit-line-clamp: 2;
255-
-webkit-box-orient: vertical;
268+
line-height: 1.5;
269+
height: 2.25rem;
256270
overflow: hidden;
257-
text-overflow: ellipsis;
258-
text-decoration: none;
259-
color: inherit;
260-
color: ${palette.gray8};
271+
word-break: keep-all;
272+
color: ${palette.gray6};
273+
-webkit-box-orient: vertical;
261274
}
262275
`;
263276

0 commit comments

Comments
 (0)