Skip to content

Commit 964477f

Browse files
authored
redesigned blog (#2162)
* wip * add blog header * Make DataColocation narrower on very large screens * get styles closer to designs * Improve focus management * Handle longer bylines * Add hover styles * wip * Implement BlogCardPicture * Use oklch * Make it pop * Reduce jitter * Optimize and tweak styles * Fade in * Actually fade in * Format * temporary: add leva to let the designers pick aspectRatio * Point Prettier to our Tailwind config * Improve mobile styles * Update blog layout just a bit * Remove temporary code, the designers picked aspectRatio=4.75 * Set aspect-ratio to 4.75 and refactor out a weird selector * Make tags on /blog links, hide featured posts on /tags/* pages * Add a bit more space * Update lockfile
1 parent 81f1432 commit 964477f

File tree

23 files changed

+957
-123
lines changed

23 files changed

+957
-123
lines changed

.prettierrc

Lines changed: 0 additions & 22 deletions
This file was deleted.

next.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ const config = {
173173
},
174174
]
175175
},
176+
typedRoutes: true,
176177
}
177178

178179
const withBundleAnalyzer = nextBundleAnalyzer({

prettier.config.mjs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { dirname, resolve } from "path"
2+
import { fileURLToPath } from "url"
3+
4+
const __dirname = dirname(fileURLToPath(import.meta.url))
5+
6+
/**
7+
* @type {import("prettier").Config}
8+
*/
9+
export default {
10+
arrowParens: "avoid",
11+
semi: false,
12+
singleQuote: false,
13+
useTabs: false,
14+
tabWidth: 2,
15+
overrides: [
16+
{
17+
files: "*.svg",
18+
options: { parser: "html" },
19+
},
20+
{
21+
files: "*.mdx",
22+
options: {
23+
proseWrap: "always",
24+
semi: false,
25+
trailingComma: "none",
26+
},
27+
},
28+
],
29+
plugins: ["prettier-plugin-pkg", "prettier-plugin-tailwindcss"],
30+
// We need this to ensure classes format the same across CI and editors.
31+
tailwindConfig: resolve(__dirname, "./tailwind.config.ts"),
32+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
export function arrowsMoveSideways(event: React.KeyboardEvent<HTMLElement>) {
2+
if (
3+
event.key !== "ArrowLeft" &&
4+
event.key !== "ArrowRight" &&
5+
event.key !== "ArrowUp" &&
6+
event.key !== "ArrowDown"
7+
) {
8+
return
9+
}
10+
11+
let repeat = 1
12+
13+
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
14+
const vertical = event.currentTarget.dataset.vertical
15+
console.log({ vertical })
16+
repeat = vertical ? parseInt(vertical) : 1
17+
}
18+
19+
let current = event.currentTarget
20+
for (let i = 0; i < repeat; ++i) {
21+
if (event.key === "ArrowLeft" || event.key === "ArrowUp") {
22+
const previousElement = current.previousElementSibling
23+
if (previousElement) {
24+
current = previousElement as HTMLElement
25+
}
26+
} else if (event.key === "ArrowRight" || event.key === "ArrowDown") {
27+
const nextElement = current.nextElementSibling
28+
if (nextElement) {
29+
current = nextElement as HTMLElement
30+
}
31+
}
32+
}
33+
34+
event.preventDefault()
35+
current.focus()
36+
}

0 commit comments

Comments
 (0)