Skip to content

Commit ec42789

Browse files
authored
fix: adjust responsive widht heidht (#151)
1 parent f094753 commit ec42789

File tree

1 file changed

+32
-18
lines changed

1 file changed

+32
-18
lines changed

app/assets/medium.ts

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// @ts-ignore
22
export default ({ title, description, date, url, thumbnail }) => `
3-
<svg fill="none" width="800" height="120" xmlns="http://www.w3.org/2000/svg">
3+
<svg fill="none" width="100%" height="100%" viewBox="0 0 1000 140" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg">
44
<foreignObject width="100%" height="100%">
55
<div xmlns="http://www.w3.org/1999/xhtml">
66
<style>
7-
*{
7+
* {
88
margin: 0;
99
padding: 0;
1010
box-sizing: border-box;
11-
font-family: sans-serif
11+
font-family: sans-serif;
1212
}
1313
@keyframes gradientBackground {
1414
0% {
@@ -20,13 +20,18 @@ export default ({ title, description, date, url, thumbnail }) => `
2020
}
2121
.flex {
2222
display: flex;
23-
align-items:center;
23+
align-items: center;
24+
width: 100%;
25+
height: 100%;
2426
}
25-
.outer-container{
26-
height:120px;
27+
.outer-container {
28+
width: 100%;
29+
height: 100%;
30+
min-height: 140px;
2731
}
28-
.container{
29-
height: 118px;
32+
.container {
33+
height: 100%;
34+
width: 100%;
3035
border: 1px solid rgba(0,0,0,.2);
3136
padding: 10px 20px;
3237
border-radius: 10px;
@@ -41,29 +46,38 @@ export default ({ title, description, date, url, thumbnail }) => `
4146
margin-right: 10px;
4247
width: 150px;
4348
height: 100%;
49+
min-height: 98px; /* 140px - 2 * 10px padding - 2 * 1px border */
4450
object-fit: cover;
4551
}
46-
.right{
52+
.right {
4753
flex: 1;
54+
min-width: 0; /* This helps with text overflow */
4855
}
49-
a{
56+
a {
5057
text-decoration: none;
51-
color: inherit
58+
color: inherit;
5259
}
5360
p {
5461
line-height: 1.5;
55-
color: #555
62+
color: #555;
63+
overflow: hidden;
64+
text-overflow: ellipsis;
65+
display: -webkit-box;
66+
-webkit-line-clamp: 2;
67+
-webkit-box-orient: vertical;
5668
}
57-
h3{
58-
color: #333
69+
h3 {
70+
color: #333;
71+
overflow: hidden;
72+
text-overflow: ellipsis;
73+
white-space: nowrap;
5974
}
60-
small{
75+
small {
6176
color: #888;
6277
display: block;
6378
margin-top: 5px;
64-
margin-bottom: 8px
79+
margin-bottom: 8px;
6580
}
66-
6781
</style>
6882
<div class="outer-container flex">
6983
<a class="container flex" href="${url}" target="__blank">
@@ -78,4 +92,4 @@ export default ({ title, description, date, url, thumbnail }) => `
7892
</div>
7993
</foreignObject>
8094
</svg>
81-
`;
95+
`;

0 commit comments

Comments
 (0)