@binarynoir/vitepress-blog 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/style.css CHANGED
@@ -10,6 +10,12 @@
10
10
  --vp-blog-tag-bg: var(--vp-c-default-soft);
11
11
  --vp-blog-tag-color: var(--vp-c-text-2);
12
12
  --vp-blog-accent: var(--vp-c-brand-1);
13
+ --vp-blog-browse-bg: var(--vp-c-bg-soft);
14
+ /* Width of the label column in the browse panel, so every row's chips line up. */
15
+ --vp-blog-facet-label-width: 6.5rem;
16
+ --vp-blog-announcement-height: 40px;
17
+ --vp-blog-announcement-bg: var(--vp-button-brand-bg);
18
+ --vp-blog-announcement-color: var(--vp-button-brand-text);
13
19
  }
14
20
 
15
21
  /* Markdown inside the generated blocks is wrapped in <p>; its margins are handled here instead. */
@@ -43,7 +49,7 @@
43
49
  border-color: var(--vp-blog-accent);
44
50
  }
45
51
 
46
- .vp-blog-card--sticky {
52
+ .vp-blog-card--pinned {
47
53
  border-color: var(--vp-blog-accent);
48
54
  }
49
55
 
@@ -83,6 +89,28 @@
83
89
  padding: 16px 20px 20px;
84
90
  }
85
91
 
92
+ /* The category, above the title: a small linked eyebrow. */
93
+ .vp-blog-card__category {
94
+ margin-bottom: -4px;
95
+ font-size: 12px;
96
+ font-weight: 600;
97
+ letter-spacing: 0.06em;
98
+ line-height: 1.4;
99
+ text-transform: uppercase;
100
+ }
101
+
102
+ .vp-blog-card .vp-blog-card__category a {
103
+ color: var(--vp-blog-accent);
104
+ font-weight: 600;
105
+ text-decoration: none;
106
+ }
107
+
108
+ .vp-blog-card .vp-blog-card__category a:hover,
109
+ .vp-blog-card .vp-blog-card__category a.is-active {
110
+ text-decoration: underline;
111
+ text-underline-offset: 3px;
112
+ }
113
+
86
114
  .vp-blog-card__title {
87
115
  font-size: 18px;
88
116
  font-weight: 600;
@@ -162,9 +190,11 @@
162
190
  }
163
191
 
164
192
  .vp-blog-tag,
193
+ .vp-blog-category,
165
194
  .vp-blog-badge,
166
- .vp-blog-tags a,
195
+ .vp-blog-facet a,
167
196
  .vp-blog-card__tags a,
197
+ .vp-blog-byline__category a,
168
198
  .vp-blog-byline__tags a {
169
199
  display: inline-block;
170
200
  margin: 2px 4px 2px 0;
@@ -177,30 +207,46 @@
177
207
  line-height: 22px;
178
208
  }
179
209
 
180
- /* Keyword chips are links that filter their blog. */
181
- .vp-blog .vp-blog-tags a,
210
+ /* Chips are links that filter their blog. */
211
+ .vp-blog .vp-blog-facet a,
182
212
  .vp-blog .vp-blog-card__tags a,
213
+ .vp-blog-byline__category a,
183
214
  .vp-blog-byline__tags a {
184
215
  text-decoration: none;
185
216
  transition:
186
217
  background-color 0.25s,
187
- color 0.25s;
218
+ color 0.25s,
219
+ opacity 0.25s;
188
220
  }
189
221
 
190
- .vp-blog .vp-blog-tags a:hover,
222
+ .vp-blog .vp-blog-facet a:hover,
191
223
  .vp-blog .vp-blog-card__tags a:hover,
224
+ .vp-blog-byline__category a:hover,
192
225
  .vp-blog-byline__tags a:hover,
193
- .vp-blog-tags a.is-active,
194
- .vp-blog-card__tags a.is-active {
226
+ .vp-blog .vp-blog-facet a.is-active,
227
+ .vp-blog .vp-blog-card__tags a.is-active {
228
+ background: var(--vp-c-brand-soft);
229
+ color: var(--vp-blog-accent);
230
+ }
231
+
232
+ /* A post's category in its byline: a chip in the accent, ahead of its keywords. */
233
+ .vp-blog-category,
234
+ .vp-blog-byline__category a {
195
235
  background: var(--vp-c-brand-soft);
196
236
  color: var(--vp-blog-accent);
237
+ font-weight: 600;
197
238
  }
198
239
 
199
- .vp-blog-badge--sticky {
240
+ .vp-blog-badge--pinned {
200
241
  background: var(--vp-c-brand-soft);
201
242
  color: var(--vp-c-brand-1);
202
243
  }
203
244
 
245
+ .vp-blog-badge--announcement {
246
+ background: var(--vp-c-tip-soft);
247
+ color: var(--vp-c-tip-1);
248
+ }
249
+
204
250
  .vp-blog-badge--draft {
205
251
  background: var(--vp-c-warning-soft);
206
252
  color: var(--vp-c-warning-1);
@@ -258,29 +304,53 @@
258
304
  }
259
305
  }
260
306
 
261
- /* The blog: keyword list, filter banner, pinned posts and page links. */
307
+ /* The blog: browse panel, active filters, pinned posts and page links. */
262
308
  .vp-blog {
263
309
  scroll-margin-top: calc(var(--vp-nav-height, 64px) + 24px);
264
310
  }
265
311
 
266
- .vp-blog-tags {
267
- margin: 16px 0 8px;
268
- line-height: 2;
312
+ /*
313
+ * The browse panel: one row each for categories, keywords and years, and the
314
+ * months of the year in view below the years. Labels sit in a column of their
315
+ * own on wide screens, above their chips on narrow ones.
316
+ */
317
+ .vp-blog-browse {
318
+ display: flex;
319
+ flex-direction: column;
320
+ gap: 10px;
321
+ margin: 16px 0;
322
+ padding: 14px 16px;
323
+ border: 1px solid var(--vp-blog-card-border);
324
+ border-radius: var(--vp-blog-card-radius);
325
+ background: var(--vp-blog-browse-bg);
269
326
  }
270
327
 
271
- .vp-blog-tags p {
272
- margin: 0;
328
+ .vp-blog-facet {
329
+ display: grid;
330
+ grid-template-columns: var(--vp-blog-facet-label-width) minmax(0, 1fr);
331
+ gap: 2px 12px;
332
+ align-items: baseline;
273
333
  }
274
334
 
275
- .vp-blog-tags__label {
276
- margin-right: 8px;
335
+ .vp-blog-facet__label {
277
336
  color: var(--vp-blog-meta-color);
278
- font-size: 14px;
337
+ font-size: 13px;
279
338
  font-weight: 600;
339
+ line-height: 26px;
280
340
  }
281
341
 
282
- /* The post count in a keyword pill: a small counter badge inside it. */
283
- .vp-blog-tags__count {
342
+ /* A year's months: tucked under the years, their label the year. */
343
+ .vp-blog-facet--month .vp-blog-facet__label {
344
+ font-variant-numeric: tabular-nums;
345
+ font-weight: 500;
346
+ }
347
+
348
+ .vp-blog-facet__chips p {
349
+ margin: 0;
350
+ }
351
+
352
+ /* The post count in a chip: a small counter badge inside it. */
353
+ .vp-blog-facet__count {
284
354
  display: inline-block;
285
355
  min-width: 18px;
286
356
  margin-left: 6px;
@@ -299,14 +369,38 @@
299
369
  color 0.25s;
300
370
  }
301
371
 
302
- .vp-blog-tags a:hover .vp-blog-tags__count,
303
- .vp-blog-tags a.is-active .vp-blog-tags__count {
372
+ .vp-blog-facet a:hover .vp-blog-facet__count,
373
+ .vp-blog-facet a.is-active .vp-blog-facet__count {
304
374
  background: var(--vp-blog-accent);
305
375
  /* The page background, so the number stays readable on the accent in light and dark mode. */
306
376
  color: var(--vp-c-bg);
307
377
  }
308
378
 
379
+ /* A chip that would show no posts with the other filters kept. */
380
+ .vp-blog .vp-blog-facet a.is-empty {
381
+ opacity: 0.45;
382
+ }
383
+
384
+ .vp-blog .vp-blog-facet a.is-empty:hover {
385
+ opacity: 0.8;
386
+ }
387
+
388
+ @media (max-width: 639px) {
389
+ .vp-blog-facet {
390
+ grid-template-columns: minmax(0, 1fr);
391
+ }
392
+
393
+ .vp-blog-facet__label {
394
+ line-height: 20px;
395
+ }
396
+ }
397
+
398
+ /* The active filters: how many posts match, a removable chip for each filter, and a link to clear them all. */
309
399
  .vp-blog-filter {
400
+ display: flex;
401
+ flex-wrap: wrap;
402
+ gap: 8px;
403
+ align-items: center;
310
404
  margin: 16px 0;
311
405
  padding: 10px 16px;
312
406
  border-radius: 8px;
@@ -314,15 +408,61 @@
314
408
  font-size: 14px;
315
409
  }
316
410
 
411
+ .vp-blog-filter__count {
412
+ margin-right: 4px;
413
+ color: var(--vp-c-text-1);
414
+ font-weight: 600;
415
+ }
416
+
417
+ .vp-blog .vp-blog-filter__chip {
418
+ display: inline-flex;
419
+ gap: 4px;
420
+ align-items: center;
421
+ padding: 0 4px 0 10px;
422
+ border: 1px solid var(--vp-blog-accent);
423
+ border-radius: 999px;
424
+ background: var(--vp-c-bg);
425
+ color: var(--vp-c-text-1);
426
+ font-size: 13px;
427
+ font-weight: 500;
428
+ line-height: 24px;
429
+ text-decoration: none;
430
+ }
431
+
432
+ .vp-blog-filter__kind {
433
+ color: var(--vp-blog-meta-color);
434
+ font-weight: 400;
435
+ }
436
+
437
+ .vp-blog-filter__remove {
438
+ display: inline-flex;
439
+ align-items: center;
440
+ justify-content: center;
441
+ width: 18px;
442
+ height: 18px;
443
+ border-radius: 50%;
444
+ color: var(--vp-blog-meta-color);
445
+ font-size: 14px;
446
+ line-height: 1;
447
+ transition:
448
+ background-color 0.25s,
449
+ color 0.25s;
450
+ }
451
+
452
+ .vp-blog .vp-blog-filter__chip:hover .vp-blog-filter__remove {
453
+ background: var(--vp-c-brand-soft);
454
+ color: var(--vp-blog-accent);
455
+ }
456
+
317
457
  .vp-blog-filter__clear {
318
- margin-left: 8px;
458
+ margin-left: auto;
319
459
  }
320
460
 
321
- .vp-blog-sticky {
461
+ .vp-blog-pinned {
322
462
  margin: 24px 0;
323
463
  }
324
464
 
325
- .vp-blog-sticky .vp-blog-list {
465
+ .vp-blog-pinned .vp-blog-list {
326
466
  margin: 0;
327
467
  }
328
468
 
@@ -416,3 +556,108 @@
416
556
  /* The RSS orange, as feed readers expect. */
417
557
  color: #f26522;
418
558
  }
559
+
560
+ /*
561
+ * The announcement banner, in the theme's `layout-top` slot: fixed across the
562
+ * top of the window, one line high. While it shows, VitePress's
563
+ * --vp-layout-top-height moves the nav bar, sidebar and content down by its
564
+ * height. The class on <html> hides it before hydration once dismissed.
565
+ */
566
+ :root:not(.vp-blog-announcement-dismissed):has(.vp-blog-announcement) {
567
+ --vp-layout-top-height: var(--vp-blog-announcement-height);
568
+ }
569
+
570
+ .vp-blog-announcement-dismissed .vp-blog-announcement {
571
+ display: none;
572
+ }
573
+
574
+ .vp-blog-announcement {
575
+ position: fixed;
576
+ top: 0;
577
+ right: 0;
578
+ left: 0;
579
+ z-index: var(--vp-z-index-layout-top);
580
+ display: flex;
581
+ gap: 8px;
582
+ align-items: center;
583
+ justify-content: center;
584
+ box-sizing: border-box;
585
+ height: var(--vp-blog-announcement-height);
586
+ padding: 0 48px;
587
+ background: var(--vp-blog-announcement-bg);
588
+ color: var(--vp-blog-announcement-color);
589
+ font-size: 14px;
590
+ font-weight: 500;
591
+ line-height: var(--vp-blog-announcement-height);
592
+ }
593
+
594
+ .vp-blog-announcement__content {
595
+ display: flex;
596
+ gap: 10px;
597
+ align-items: center;
598
+ min-width: 0;
599
+ }
600
+
601
+ .vp-blog-announcement__text {
602
+ overflow: hidden;
603
+ color: inherit;
604
+ text-decoration: none;
605
+ text-overflow: ellipsis;
606
+ white-space: nowrap;
607
+ }
608
+
609
+ .vp-blog-announcement__text:hover {
610
+ text-decoration: underline;
611
+ text-underline-offset: 3px;
612
+ }
613
+
614
+ /* How many announcements there are: a counter pill that opens the list of them. */
615
+ .vp-blog-announcement__count {
616
+ flex: none;
617
+ min-width: 22px;
618
+ padding: 0 7px;
619
+ border-radius: 999px;
620
+ background: var(--vp-blog-announcement-color);
621
+ color: var(--vp-blog-announcement-bg);
622
+ font-size: 12px;
623
+ font-weight: 700;
624
+ font-variant-numeric: tabular-nums;
625
+ line-height: 20px;
626
+ text-align: center;
627
+ text-decoration: none;
628
+ transition: opacity 0.25s;
629
+ }
630
+
631
+ a.vp-blog-announcement__count:hover {
632
+ opacity: 0.85;
633
+ }
634
+
635
+ .vp-blog-announcement__dismiss {
636
+ position: absolute;
637
+ top: 50%;
638
+ right: 12px;
639
+ display: flex;
640
+ align-items: center;
641
+ justify-content: center;
642
+ width: 28px;
643
+ height: 28px;
644
+ border-radius: 6px;
645
+ color: inherit;
646
+ opacity: 0.8;
647
+ transform: translateY(-50%);
648
+ transition:
649
+ background-color 0.25s,
650
+ opacity 0.25s;
651
+ }
652
+
653
+ .vp-blog-announcement__dismiss:hover {
654
+ background: rgba(255, 255, 255, 0.16);
655
+ opacity: 1;
656
+ }
657
+
658
+ @media (max-width: 639px) {
659
+ .vp-blog-announcement {
660
+ justify-content: flex-start;
661
+ padding: 0 48px 0 16px;
662
+ }
663
+ }