Skip to content

Commit 9cf3111

Browse files
committed
fix projectlist
1 parent 6f6c1b4 commit 9cf3111

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

src/components/ArticleList.astro

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const articlesWithExcerpts = await Promise.all(
4545
maxCols >= 2 && "md:grid-cols-2",
4646
maxCols >= 3 && "lg:grid-cols-3",
4747
maxCols >= 4 && "xl:grid-cols-4",
48-
truncate && "truncate",
48+
truncate && "data-truncate",
4949
props.class,
5050
]}
5151
>
@@ -62,12 +62,10 @@ const articlesWithExcerpts = await Promise.all(
6262
const additionalProps = isFeatured
6363
? {
6464
cellClassName: "md:col-span-2 md:row-span-2",
65-
imageClassName: "max-h-[32rem] md:max-h-[48rem]",
6665
excerpt: text.slice(0, 300),
6766
}
6867
: {
6968
cellClassName: "",
70-
imageClassName: "max-h-[24rem]",
7169
excerpt: text.slice(0, 80),
7270
};
7371
return (
@@ -91,16 +89,16 @@ const articlesWithExcerpts = await Promise.all(
9189
class:list={[
9290
"min-h-0 w-full rounded-xl",
9391
!article.data["bg_color"] && "skeleton",
94-
additionalProps.imageClassName,
9592
]}
96-
style={`
97-
aspect-ratio: 5 / 3;
98-
object-fit: ${article.data.fit};
99-
${
100-
article.data.bg_color
101-
? `background-color: ${article.data.bg_color}`
102-
: ""
103-
}`}
93+
style={{
94+
"aspect-ratio": "5 / 3",
95+
"object-fit": article.data.fit,
96+
...(article.data.bg_color
97+
? {
98+
"background-color": article.data.bg_color,
99+
}
100+
: {}),
101+
}}
104102
/>
105103
<div class="mt-4 p-1">
106104
<time class="block text-sm text-gray-500">
@@ -124,8 +122,13 @@ const articlesWithExcerpts = await Promise.all(
124122
</ul>
125123

126124
<style>
127-
@container (width > 64rem) {
128-
.truncate.variant-compact :nth-child(n + 3) a {
125+
@media (width < 48rem) {
126+
.data-truncate > li:nth-child(n + 2) {
127+
display: none;
128+
}
129+
}
130+
@media (width < 64rem) {
131+
.data-truncate > li:nth-child(n + 3) {
129132
display: none;
130133
}
131134
}

0 commit comments

Comments
 (0)