Skip to content

Commit 93aea45

Browse files
committed
Make new-extensions urls hierarchical, add pages for each year
1 parent 3d3418a commit 93aea45

File tree

2 files changed

+8
-85
lines changed

2 files changed

+8
-85
lines changed

src/templates/extensions-added-by-year-list.js

Lines changed: 2 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import * as React from "react"
22
import { useState } from "react"
33

4-
import styled from "styled-components"
5-
64
import { useMediaQuery } from "react-responsive"
75
import { device } from "../components/util/styles/breakpoints"
86
import ExtensionCard from "../components/extension-card"
@@ -13,81 +11,7 @@ import Sortings from "../components/sortings/sortings"
1311
import { slugForExtensionsAddedYear } from "../components/util/extension-slugger"
1412
import Link from "gatsby-link"
1513
import { ExtensionCardList } from "../components/extensions-list"
16-
17-
const FilterableList = styled.div`
18-
display: flex;
19-
justify-content: space-between;
20-
flex-direction: row;
21-
22-
// noinspection CssUnknownProperty
23-
@media ${device.sm} {
24-
flex-direction: column;
25-
}
26-
`
27-
28-
const Extensions = styled.ol`
29-
list-style: none;
30-
width: 100%;
31-
padding-inline-start: 0;
32-
grid-template-rows: repeat(auto-fill, 1fr);
33-
display: grid;
34-
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
35-
gap: 30px;
36-
37-
// noinspection CssUnknownProperty
38-
@media ${device.xs} {
39-
display: flex;
40-
flex-direction: column;
41-
}
42-
`
43-
44-
const CardItem = styled.li`
45-
height: 100%;
46-
width: 100%;
47-
display: flex;
48-
max-height: 34rem;
49-
`
50-
51-
const InfoSortRow = styled.div`
52-
display: flex;
53-
column-gap: var(--a-generous-space);
54-
justify-content: space-between;
55-
flex-direction: row;
56-
57-
// noinspection CssUnknownProperty
58-
@media ${device.sm} {
59-
flex-direction: column;
60-
margin-top: 0;
61-
}
62-
`
63-
64-
const Heading = styled.h1`
65-
font-size: 3rem;
66-
@media screen and (max-width: 768px) {
67-
font-size: 2rem;
68-
}
69-
font-weight: var(--font-weight-boldest);
70-
margin: 2.5rem 0 1.5rem 0;
71-
padding-bottom: var(--a-modest-space);
72-
width: calc(100vw - 2 * var(--site-margins));
73-
// noinspection CssUnknownProperty
74-
@media ${device.xs} {
75-
border-bottom: 1px solid var(--card-outline);
76-
}
77-
`
78-
79-
const ExtensionCount = styled.h4`
80-
margin-top: 1.25rem;
81-
margin-bottom: 0.5rem;
82-
font-size: 1rem;
83-
font-weight: 400;
84-
font-style: italic;
85-
86-
// noinspection CssUnknownProperty
87-
@media ${device.sm} {
88-
font-size: var(--font-size-14);
89-
}
90-
`
14+
import { CardItem, ExtensionCount, Extensions, FilterableList, Heading, InfoSortRow } from "./extensions-added-list"
9115

9216
const prettyDate = (timestamp) => new Date(+timestamp).getFullYear()
9317

@@ -140,7 +64,7 @@ const ExtensionsAddedByYearListTemplate = (
14064
const yearTimestamp = extensions[0].metadata.maven.sinceYear
14165
const now = new Date()
14266
const date = new Date(+yearTimestamp)
143-
const verb = now.getFullYear() === date.getFullYear() && now.getUTCFullYear() === date.getUTCFullYear() ? "have been" : "were"
67+
const verb = now.getFullYear() === date.getFullYear() ? "have been" : "were"
14468

14569
if (extensions && extensions.length > 0) {
14670

@@ -158,7 +82,6 @@ const ExtensionsAddedByYearListTemplate = (
15882

15983
const countMessage = `${extensionCount} new extensions ${verb} added this year.`
16084

161-
16285
const name = `Extensions added in ${formattedYear}`
16386

16487
return (

src/templates/extensions-added-list.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import Link from "gatsby-link"
1515
import { dateFormatOptions } from "../components/util/date-utils"
1616
import { ExtensionCardList } from "../components/extensions-list"
1717

18-
const FilterableList = styled.div`
18+
export const FilterableList = styled.div`
1919
display: flex;
2020
justify-content: space-between;
2121
flex-direction: row;
@@ -26,7 +26,7 @@ const FilterableList = styled.div`
2626
}
2727
`
2828

29-
const Extensions = styled.ol`
29+
export const Extensions = styled.ol`
3030
list-style: none;
3131
width: 100%;
3232
padding-inline-start: 0;
@@ -42,14 +42,14 @@ const Extensions = styled.ol`
4242
}
4343
`
4444

45-
const CardItem = styled.li`
45+
export const CardItem = styled.li`
4646
height: 100%;
4747
width: 100%;
4848
display: flex;
4949
max-height: 34rem;
5050
`
5151

52-
const InfoSortRow = styled.div`
52+
export const InfoSortRow = styled.div`
5353
display: flex;
5454
column-gap: var(--a-generous-space);
5555
justify-content: space-between;
@@ -62,7 +62,7 @@ const InfoSortRow = styled.div`
6262
}
6363
`
6464

65-
const Heading = styled.h1`
65+
export const Heading = styled.h1`
6666
font-size: 3rem;
6767
@media screen and (max-width: 768px) {
6868
font-size: 2rem;
@@ -77,7 +77,7 @@ const Heading = styled.h1`
7777
}
7878
`
7979

80-
const ExtensionCount = styled.h4`
80+
export const ExtensionCount = styled.h4`
8181
margin-top: 1.25rem;
8282
margin-bottom: 0.5rem;
8383
font-size: 1rem;

0 commit comments

Comments
 (0)