diff options
author | Akshay <[email protected]> | 2024-11-04 22:01:32 +0000 |
---|---|---|
committer | Akshay <[email protected]> | 2024-11-04 22:01:32 +0000 |
commit | 4e586aacad21e48cfb69b4052a5d0aba788709ae (patch) | |
tree | ddf5e738f9ea17315cf02f4d3e2a65de7ff5d0a3 /src | |
parent | d18f24945f35fde4e04b29ab27abce93ffbc6a99 (diff) |
fixup info-styles, add collapse everywhere
Diffstat (limited to 'src')
-rw-r--r-- | src/mixins/comment.pug | 35 | ||||
-rw-r--r-- | src/public/styles.css | 68 | ||||
-rw-r--r-- | src/views/comments.pug | 17 |
3 files changed, 69 insertions, 51 deletions
diff --git a/src/mixins/comment.pug b/src/mixins/comment.pug index 3af1f53..518307d 100644 --- a/src/mixins/comment.pug +++ b/src/mixins/comment.pug | |||
@@ -2,12 +2,15 @@ include ../utils | |||
2 | 2 | ||
3 | mixin infoContainer(data) | 3 | mixin infoContainer(data) |
4 | div.comment-info-container | 4 | div.comment-info-container |
5 | div.info-item #{fmtnum(data.ups)} ↑ | 5 | | #{fmtnum(data.ups)} ↑ |
6 | div.info-item u/#{data.author} #{data.is_submitter ? '(OP)' : ''} | 6 | | · |
7 | span(class=`${data.is_submitter ? 'op' : ''}`) | ||
8 | | u/#{data.author} #{data.is_submitter ? '(op)' : ''} | ||
9 | | · | ||
7 | if data.collapsed_reason_code == "DELETED" | 10 | if data.collapsed_reason_code == "DELETED" |
8 | div.info-item | 11 | a(href=`https://undelete.pullpush.io${data.permalink}`) search on undelete |
9 | a(href=`https://undelete.pullpush.io${data.permalink}`) search on undelete | 12 | | · |
10 | div.info-item #{timeDifference(Date.now(), data.created * 1000)} | 13 | | #{timeDifference(Date.now(), data.created * 1000)} |
11 | 14 | ||
12 | - | 15 | - |
13 | function hasReplies(data) { | 16 | function hasReplies(data) { |
@@ -20,22 +23,16 @@ mixin comment(com, isfirst) | |||
20 | - var hasReplyData = hasReplies(data) | 23 | - var hasReplyData = hasReplies(data) |
21 | 24 | ||
22 | if kind == "more" | 25 | if kind == "more" |
23 | div(class=`${isfirst ? 'first' : ''}`) | 26 | div(class=`more ${isfirst ? 'first' : ''}`) |
24 | div.more #{data.count} more comments | 27 | | #{data.count} more comments |
25 | else | 28 | else |
26 | div(class=`comment ${isfirst ? 'first' : ''}`) | 29 | div(class=`comment ${isfirst ? 'first' : ''}`) |
27 | if hasReplyData | 30 | details(id=`${data.id}` open="") |
28 | details(id=`${data.id}` open="") | 31 | summary.expand-comments |
29 | summary.expand-comments | 32 | +infoContainer(data) |
30 | +infoContainer(data) | 33 | div.comment-body |
31 | div.comment-body | 34 | != data.body_html |
32 | != data.body_html | 35 | if hasReplyData |
33 | |||
34 | div.replies | 36 | div.replies |
35 | each reply in data.replies.data.children | 37 | each reply in data.replies.data.children |
36 | +comment(reply, false) | 38 | +comment(reply, false) |
37 | |||
38 | else | ||
39 | +infoContainer(data) | ||
40 | div.comment-body | ||
41 | != data.body_html | ||
diff --git a/src/public/styles.css b/src/public/styles.css index cd7d6b1..87e1573 100644 --- a/src/public/styles.css +++ b/src/public/styles.css | |||
@@ -7,9 +7,10 @@ | |||
7 | --blockquote-color: green; | 7 | --blockquote-color: green; |
8 | --link-color: #29BC9B; | 8 | --link-color: #29BC9B; |
9 | --link-visited-color: #999; | 9 | --link-visited-color: #999; |
10 | --accent: var(--link-color); | ||
10 | 11 | ||
11 | font-family: Inter, sans-serif; | 12 | font-family: Inter, sans-serif; |
12 | font-feature-settings: 'ss01' 1, 'kern' 1, 'liga' 1, 'cv05' 1, 'tnum' 1, 'dlig' 1, 'ss01' 1, 'ss07' 1, 'ss08' 1; | 13 | font-feature-settings: 'ss01' 1, 'kern' 1, 'liga' 1, 'cv05' 1, 'dlig' 1, 'ss01' 1, 'ss07' 1, 'ss08' 1; |
13 | 14 | ||
14 | } | 15 | } |
15 | 16 | ||
@@ -22,6 +23,7 @@ | |||
22 | --blockquote-color: lightgreen; | 23 | --blockquote-color: lightgreen; |
23 | --link-color: #79ffe1; | 24 | --link-color: #79ffe1; |
24 | --link-visited-color: #999; | 25 | --link-visited-color: #999; |
26 | --accent: var(--link-color); | ||
25 | } | 27 | } |
26 | } | 28 | } |
27 | 29 | ||
@@ -38,7 +40,6 @@ body { | |||
38 | main { | 40 | main { |
39 | display: flex; | 41 | display: flex; |
40 | flex-direction: column; | 42 | flex-direction: column; |
41 | gap: 1rem; | ||
42 | align-items: center; | 43 | align-items: center; |
43 | } | 44 | } |
44 | 45 | ||
@@ -111,19 +112,19 @@ nav { | |||
111 | } | 112 | } |
112 | 113 | ||
113 | .post, .hero { | 114 | .post, .hero { |
114 | font-size: 1rem; | 115 | font-size: 0.9rem; |
115 | } | 116 | } |
116 | 117 | ||
117 | .comments-container { | 118 | .comments-container { |
118 | font-size: 1rem; | 119 | font-size: 0.9rem; |
119 | } | 120 | } |
120 | 121 | ||
121 | .info-container a, | 122 | .info-container a, |
122 | .info-container, | 123 | .info-container, |
123 | .comment-info-container, | 124 | .comment-info-container, |
124 | .more, | 125 | .more, |
125 | summary::before, | 126 | summary::before |
126 | hr { | 127 | { |
127 | color: var(--text-color-muted) | 128 | color: var(--text-color-muted) |
128 | } | 129 | } |
129 | 130 | ||
@@ -163,6 +164,12 @@ summary::before { | |||
163 | height: 4rem; | 164 | height: 4rem; |
164 | } | 165 | } |
165 | 166 | ||
167 | .media-preview a { | ||
168 | font-size: 2rem; | ||
169 | text-decoration: none; | ||
170 | padding: 1rem; | ||
171 | } | ||
172 | |||
166 | .post-author { | 173 | .post-author { |
167 | display: none | 174 | display: none |
168 | } | 175 | } |
@@ -180,20 +187,20 @@ summary::before { | |||
180 | width: 90%; | 187 | width: 90%; |
181 | } | 188 | } |
182 | .post, .hero { | 189 | .post, .hero { |
183 | font-size: 1.3rem; | 190 | font-size: 1rem; |
184 | } | 191 | } |
185 | .comments-container { | 192 | .comments-container { |
186 | font-size: 1.3rem; | 193 | font-size: 1rem; |
187 | } | 194 | } |
188 | .info-container, .comment-info-container, .more | 195 | .info-container, .comment-info-container, .more |
189 | { | 196 | { |
190 | font-size: 1rem; | 197 | font-size: 0.8rem; |
191 | } | 198 | } |
192 | summary::before { | 199 | summary::before { |
193 | font-size: 0.8rem; | 200 | font-size: 0.7rem; |
194 | } | 201 | } |
195 | .domain { | 202 | .domain { |
196 | font-size: 1rem; | 203 | font-size: 0.8rem; |
197 | } | 204 | } |
198 | .media-preview img, | 205 | .media-preview img, |
199 | .media-preview video | 206 | .media-preview video |
@@ -201,6 +208,10 @@ summary::before { | |||
201 | width: 7rem; | 208 | width: 7rem; |
202 | height: 7rem; | 209 | height: 7rem; |
203 | } | 210 | } |
211 | .media-preview a { | ||
212 | font-size: 2rem; | ||
213 | padding: 2rem; | ||
214 | } | ||
204 | .post-author { | 215 | .post-author { |
205 | display: inline | 216 | display: inline |
206 | } | 217 | } |
@@ -215,19 +226,19 @@ summary::before { | |||
215 | width: 60%; | 226 | width: 60%; |
216 | } | 227 | } |
217 | .post, .hero { | 228 | .post, .hero { |
218 | font-size: 1.3rem; | 229 | font-size: 1rem; |
219 | } | 230 | } |
220 | .comments-container { | 231 | .comments-container { |
221 | font-size: 1.3rem; | 232 | font-size: 1rem; |
222 | } | 233 | } |
223 | .info-container, .comment-info-container, .more { | 234 | .info-container, .comment-info-container, .more { |
224 | font-size: 1rem; | 235 | font-size: 0.8rem; |
225 | } | 236 | } |
226 | summary::before { | 237 | summary::before { |
227 | font-size: 0.8rem; | 238 | font-size: 0.7rem; |
228 | } | 239 | } |
229 | .domain { | 240 | .domain { |
230 | font-size: 1rem; | 241 | font-size: 0.8rem; |
231 | } | 242 | } |
232 | .media-preview img, | 243 | .media-preview img, |
233 | .media-preview video | 244 | .media-preview video |
@@ -235,6 +246,10 @@ summary::before { | |||
235 | width: 7rem; | 246 | width: 7rem; |
236 | height: 7rem; | 247 | height: 7rem; |
237 | } | 248 | } |
249 | .media-preview a { | ||
250 | font-size: 2rem; | ||
251 | padding: 2rem; | ||
252 | } | ||
238 | .post-author { | 253 | .post-author { |
239 | display: inline | 254 | display: inline |
240 | } | 255 | } |
@@ -250,7 +265,7 @@ summary::before { | |||
250 | .comment, .more { | 265 | .comment, .more { |
251 | width: 100%; | 266 | width: 100%; |
252 | border-left: 1px dashed var(--text-color-muted); | 267 | border-left: 1px dashed var(--text-color-muted); |
253 | padding: 10px 0px 0px 24px; | 268 | padding: 8px 0px 0px 24px; |
254 | box-sizing: border-box; | 269 | box-sizing: border-box; |
255 | } | 270 | } |
256 | 271 | ||
@@ -258,15 +273,10 @@ summary::before { | |||
258 | padding: 0px 0px 0px 24px; | 273 | padding: 0px 0px 0px 24px; |
259 | } | 274 | } |
260 | 275 | ||
261 | .more { | ||
262 | margin-bottom: 0px; | ||
263 | } | ||
264 | |||
265 | .first { | 276 | .first { |
266 | border-left: none; | 277 | border-left: none; |
267 | padding-left: 0; | 278 | padding-left: 0; |
268 | margin: 0; | 279 | margin-top: 10px; |
269 | margin-top: 40px; | ||
270 | } | 280 | } |
271 | 281 | ||
272 | .post-container { | 282 | .post-container { |
@@ -321,7 +331,9 @@ summary::before { | |||
321 | } | 331 | } |
322 | 332 | ||
323 | hr { | 333 | hr { |
324 | border 1px solid #000; | 334 | border: none; |
335 | border-top: 1px dashed var(--text-color-muted); | ||
336 | height: 0; | ||
325 | } | 337 | } |
326 | 338 | ||
327 | blockquote { | 339 | blockquote { |
@@ -402,3 +414,11 @@ a { | |||
402 | width: auto; | 414 | width: auto; |
403 | max-height: 500px; | 415 | max-height: 500px; |
404 | } | 416 | } |
417 | |||
418 | .post-title { | ||
419 | margin-top: 0; | ||
420 | } | ||
421 | |||
422 | .op { | ||
423 | color: var(--accent); | ||
424 | } | ||
diff --git a/src/views/comments.pug b/src/views/comments.pug index 50c54ec..bfb0e35 100644 --- a/src/views/comments.pug +++ b/src/views/comments.pug | |||
@@ -21,7 +21,15 @@ html | |||
21 | h3.sub-title | 21 | h3.sub-title |
22 | a(href=`/r/${post.subreddit}`) ← r/#{post.subreddit} | 22 | a(href=`/r/${post.subreddit}`) ← r/#{post.subreddit} |
23 | 23 | ||
24 | h2 #{post.title} | 24 | div.info-container |
25 | p | ||
26 | | #{fmtnum(post.ups)} ↑ | ||
27 | | · by u/#{post.author} | ||
28 | | · | ||
29 | | #{timeDifference(Date.now(), post.created * 1000)} | ||
30 | |||
31 | h2.post-title | ||
32 | != post.title | ||
25 | 33 | ||
26 | if post.is_gallery && post.is_gallery == true | 34 | if post.is_gallery && post.is_gallery == true |
27 | if post.gallery_data | 35 | if post.gallery_data |
@@ -48,13 +56,6 @@ html | |||
48 | if post.selftext_html | 56 | if post.selftext_html |
49 | p.self-text !{post.selftext_html} | 57 | p.self-text !{post.selftext_html} |
50 | 58 | ||
51 | div.info-container | ||
52 | p | ||
53 | | #{fmtnum(post.ups)} ↑ | ||
54 | | · by u/#{post.author} | ||
55 | | · | ||
56 | | #{timeDifference(Date.now(), post.created * 1000)} | ||
57 | |||
58 | hr | 59 | hr |
59 | 60 | ||
60 | div.comments-container | 61 | div.comments-container |