1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-06-28 16:48:00 +02:00

more config updates

This commit is contained in:
Matthias Kretschmann 2023-08-30 01:10:25 +01:00
parent c491b01122
commit 8a01ef953f
Signed by: m
GPG Key ID: 606EEEF3C479A91F
27 changed files with 397 additions and 135 deletions

View File

@ -18,7 +18,8 @@
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jsx-a11y/recommended",
"plugin:astro/jsx-a11y-recommended",
"plugin:astro/recommended",
"plugin:react/recommended",
"plugin:prettier/recommended"
],
@ -28,6 +29,22 @@
},
"settings": { "react": { "version": "detect" } },
"overrides": [
{
// Define the configuration for `.astro` file.
"files": ["*.astro"],
// Allows Astro components to be parsed.
"parser": "astro-eslint-parser",
// Parse the script in `.astro` as TypeScript by adding the following configuration.
// It's the setting you need when using TypeScript.
"parserOptions": {
"parser": "@typescript-eslint/parser",
"extraFileExtensions": [".astro"]
},
"rules": {
// override/add rules settings here, such as:
// "astro/no-set-html-directive": "error"
}
},
{
"files": [
"**/__tests__/**/*.[jt]s?(x)",

View File

@ -1,5 +1,4 @@
import { defineConfig } from 'astro/config'
import react from '@astrojs/react'
// https://astro.build/config

314
package-lock.json generated
View File

@ -51,6 +51,7 @@
"@typescript-eslint/parser": "^6.5.0",
"eslint": "^8.48.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-astro": "^0.29.0",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.33.2",
@ -63,6 +64,7 @@
"ora": "^7.0.1",
"postcss": "^8.4.28",
"prettier": "^3.0.2",
"prettier-plugin-astro": "^0.12.0",
"stylelint": "^15.10.2",
"stylelint-config-css-modules": "^4.3.0",
"stylelint-config-standard": "^34.0.0",
@ -154,6 +156,21 @@
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
"node_modules/@astrojs/language-server/node_modules/prettier-plugin-astro": {
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/prettier-plugin-astro/-/prettier-plugin-astro-0.9.1.tgz",
"integrity": "sha512-pYZXSbdq0eElvzoIMArzv1SBn1NUXzopjlcnt6Ql8VW32PjC12NovwBjXJ6rh8qQLi7vF8jNqAbraKW03UPfag==",
"dependencies": {
"@astrojs/compiler": "^1.0.1",
"prettier": "^2.8.3",
"sass-formatter": "^0.7.5",
"synckit": "^0.8.4"
},
"engines": {
"node": "^14.15.0 || >=16.0.0",
"pnpm": ">=7.14.0"
}
},
"node_modules/@astrojs/markdown-remark": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/@astrojs/markdown-remark/-/markdown-remark-2.2.1.tgz",
@ -6841,6 +6858,96 @@
}
}
},
"node_modules/astro-eslint-parser": {
"version": "0.15.0",
"resolved": "https://registry.npmjs.org/astro-eslint-parser/-/astro-eslint-parser-0.15.0.tgz",
"integrity": "sha512-iC3VvAS/o6TX92Frwp5Yht/AO3a2tQhCnOe9CdbiICwy+ZYTH/ZOiBxeXI2I5qE1YlbtP2wvBLr+SCgwOAEZvg==",
"dev": true,
"dependencies": {
"@astrojs/compiler": "^2.0.0",
"@typescript-eslint/scope-manager": "^5.0.0",
"@typescript-eslint/types": "^5.0.0",
"astrojs-compiler-sync": "^0.3.0",
"debug": "^4.3.4",
"eslint-visitor-keys": "^3.0.0",
"espree": "^9.0.0",
"semver": "^7.3.8"
},
"engines": {
"node": "^14.18.0 || >=16.0.0"
},
"funding": {
"url": "https://github.com/sponsors/ota-meshi"
}
},
"node_modules/astro-eslint-parser/node_modules/@astrojs/compiler": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@astrojs/compiler/-/compiler-2.0.1.tgz",
"integrity": "sha512-DfBR7Cf+tOgQ4n7TIgTtU5x5SEA/08DNshpEPcT+91A0KbBlmUOYMBM/O6qAaHkmVo1KIoXQYhAmfdTT1zx9PQ==",
"dev": true
},
"node_modules/astro-eslint-parser/node_modules/@typescript-eslint/scope-manager": {
"version": "5.62.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz",
"integrity": "sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "5.62.0",
"@typescript-eslint/visitor-keys": "5.62.0"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/astro-eslint-parser/node_modules/@typescript-eslint/types": {
"version": "5.62.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.62.0.tgz",
"integrity": "sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ==",
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/astro-eslint-parser/node_modules/@typescript-eslint/visitor-keys": {
"version": "5.62.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz",
"integrity": "sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "5.62.0",
"eslint-visitor-keys": "^3.3.0"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/astro-eslint-parser/node_modules/semver": {
"version": "7.5.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
"dev": true,
"dependencies": {
"lru-cache": "^6.0.0"
},
"bin": {
"semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/astro/node_modules/ansi-regex": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz",
@ -7085,6 +7192,24 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/astrojs-compiler-sync": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/astrojs-compiler-sync/-/astrojs-compiler-sync-0.3.3.tgz",
"integrity": "sha512-LbhchWgsvjvRBb5n5ez8/Q/f9ZKViuox27VxMDOdTUm8MRv9U7phzOiLue5KluqTmC0z1LId4gY2SekvoDrkuw==",
"dev": true,
"dependencies": {
"synckit": "^0.8.0"
},
"engines": {
"node": "^14.18.0 || >=16.0.0"
},
"funding": {
"url": "https://github.com/sponsors/ota-meshi"
},
"peerDependencies": {
"@astrojs/compiler": ">=0.27.0"
}
},
"node_modules/async-mutex": {
"version": "0.2.6",
"resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.2.6.tgz",
@ -9439,6 +9564,42 @@
"eslint": ">=7.0.0"
}
},
"node_modules/eslint-plugin-astro": {
"version": "0.29.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-astro/-/eslint-plugin-astro-0.29.0.tgz",
"integrity": "sha512-JFgonlwmDXPorv7+HLecpHeUF3EzGIxIFwgBueaCrTN7PYPjPeoGVtObJzYSkOtBj1qvagghWRD/qETZdLMDHw==",
"dev": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@jridgewell/sourcemap-codec": "^1.4.14",
"@typescript-eslint/types": "^5.25.0",
"astro-eslint-parser": "^0.15.0",
"postcss": "^8.4.14",
"postcss-selector-parser": "^6.0.10"
},
"engines": {
"node": "^14.18.0 || >=16.0.0"
},
"funding": {
"url": "https://github.com/sponsors/ota-meshi"
},
"peerDependencies": {
"eslint": ">=7.0.0"
}
},
"node_modules/eslint-plugin-astro/node_modules/@typescript-eslint/types": {
"version": "5.62.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.62.0.tgz",
"integrity": "sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ==",
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/eslint-plugin-jsx-a11y": {
"version": "6.7.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.7.1.tgz",
@ -16819,32 +16980,17 @@
}
},
"node_modules/prettier-plugin-astro": {
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/prettier-plugin-astro/-/prettier-plugin-astro-0.9.1.tgz",
"integrity": "sha512-pYZXSbdq0eElvzoIMArzv1SBn1NUXzopjlcnt6Ql8VW32PjC12NovwBjXJ6rh8qQLi7vF8jNqAbraKW03UPfag==",
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/prettier-plugin-astro/-/prettier-plugin-astro-0.12.0.tgz",
"integrity": "sha512-8E+9YQR6/5CPZJs8XsfBw579zrwZkc0Wb7x0fRVm/51JC8Iys4lBw4ecV8fHwpbQnzve86TUa4fJ08BJzqfWnA==",
"dev": true,
"dependencies": {
"@astrojs/compiler": "^1.0.1",
"prettier": "^2.8.3",
"sass-formatter": "^0.7.5",
"synckit": "^0.8.4"
"@astrojs/compiler": "^1.5.5",
"prettier": "^3.0.0",
"sass-formatter": "^0.7.6"
},
"engines": {
"node": "^14.15.0 || >=16.0.0",
"pnpm": ">=7.14.0"
}
},
"node_modules/prettier-plugin-astro/node_modules/prettier": {
"version": "2.8.8",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
"integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==",
"bin": {
"prettier": "bin-prettier.js"
},
"engines": {
"node": ">=10.13.0"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
"node": "^14.15.0 || >=16.0.0"
}
},
"node_modules/pretty-format": {
@ -21763,6 +21909,17 @@
"version": "2.8.8",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
"integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q=="
},
"prettier-plugin-astro": {
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/prettier-plugin-astro/-/prettier-plugin-astro-0.9.1.tgz",
"integrity": "sha512-pYZXSbdq0eElvzoIMArzv1SBn1NUXzopjlcnt6Ql8VW32PjC12NovwBjXJ6rh8qQLi7vF8jNqAbraKW03UPfag==",
"requires": {
"@astrojs/compiler": "^1.0.1",
"prettier": "^2.8.3",
"sass-formatter": "^0.7.5",
"synckit": "^0.8.4"
}
}
}
},
@ -26816,6 +26973,74 @@
}
}
},
"astro-eslint-parser": {
"version": "0.15.0",
"resolved": "https://registry.npmjs.org/astro-eslint-parser/-/astro-eslint-parser-0.15.0.tgz",
"integrity": "sha512-iC3VvAS/o6TX92Frwp5Yht/AO3a2tQhCnOe9CdbiICwy+ZYTH/ZOiBxeXI2I5qE1YlbtP2wvBLr+SCgwOAEZvg==",
"dev": true,
"requires": {
"@astrojs/compiler": "^2.0.0",
"@typescript-eslint/scope-manager": "^5.0.0",
"@typescript-eslint/types": "^5.0.0",
"astrojs-compiler-sync": "^0.3.0",
"debug": "^4.3.4",
"eslint-visitor-keys": "^3.0.0",
"espree": "^9.0.0",
"semver": "^7.3.8"
},
"dependencies": {
"@astrojs/compiler": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@astrojs/compiler/-/compiler-2.0.1.tgz",
"integrity": "sha512-DfBR7Cf+tOgQ4n7TIgTtU5x5SEA/08DNshpEPcT+91A0KbBlmUOYMBM/O6qAaHkmVo1KIoXQYhAmfdTT1zx9PQ==",
"dev": true
},
"@typescript-eslint/scope-manager": {
"version": "5.62.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz",
"integrity": "sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w==",
"dev": true,
"requires": {
"@typescript-eslint/types": "5.62.0",
"@typescript-eslint/visitor-keys": "5.62.0"
}
},
"@typescript-eslint/types": {
"version": "5.62.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.62.0.tgz",
"integrity": "sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ==",
"dev": true
},
"@typescript-eslint/visitor-keys": {
"version": "5.62.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz",
"integrity": "sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw==",
"dev": true,
"requires": {
"@typescript-eslint/types": "5.62.0",
"eslint-visitor-keys": "^3.3.0"
}
},
"semver": {
"version": "7.5.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
"dev": true,
"requires": {
"lru-cache": "^6.0.0"
}
}
}
},
"astrojs-compiler-sync": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/astrojs-compiler-sync/-/astrojs-compiler-sync-0.3.3.tgz",
"integrity": "sha512-LbhchWgsvjvRBb5n5ez8/Q/f9ZKViuox27VxMDOdTUm8MRv9U7phzOiLue5KluqTmC0z1LId4gY2SekvoDrkuw==",
"dev": true,
"requires": {
"synckit": "^0.8.0"
}
},
"async-mutex": {
"version": "0.2.6",
"resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.2.6.tgz",
@ -28610,6 +28835,28 @@
"dev": true,
"requires": {}
},
"eslint-plugin-astro": {
"version": "0.29.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-astro/-/eslint-plugin-astro-0.29.0.tgz",
"integrity": "sha512-JFgonlwmDXPorv7+HLecpHeUF3EzGIxIFwgBueaCrTN7PYPjPeoGVtObJzYSkOtBj1qvagghWRD/qETZdLMDHw==",
"dev": true,
"requires": {
"@eslint-community/eslint-utils": "^4.2.0",
"@jridgewell/sourcemap-codec": "^1.4.14",
"@typescript-eslint/types": "^5.25.0",
"astro-eslint-parser": "^0.15.0",
"postcss": "^8.4.14",
"postcss-selector-parser": "^6.0.10"
},
"dependencies": {
"@typescript-eslint/types": {
"version": "5.62.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.62.0.tgz",
"integrity": "sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ==",
"dev": true
}
}
},
"eslint-plugin-jsx-a11y": {
"version": "6.7.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.7.1.tgz",
@ -33790,21 +34037,14 @@
}
},
"prettier-plugin-astro": {
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/prettier-plugin-astro/-/prettier-plugin-astro-0.9.1.tgz",
"integrity": "sha512-pYZXSbdq0eElvzoIMArzv1SBn1NUXzopjlcnt6Ql8VW32PjC12NovwBjXJ6rh8qQLi7vF8jNqAbraKW03UPfag==",
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/prettier-plugin-astro/-/prettier-plugin-astro-0.12.0.tgz",
"integrity": "sha512-8E+9YQR6/5CPZJs8XsfBw579zrwZkc0Wb7x0fRVm/51JC8Iys4lBw4ecV8fHwpbQnzve86TUa4fJ08BJzqfWnA==",
"dev": true,
"requires": {
"@astrojs/compiler": "^1.0.1",
"prettier": "^2.8.3",
"sass-formatter": "^0.7.5",
"synckit": "^0.8.4"
},
"dependencies": {
"prettier": {
"version": "2.8.8",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
"integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q=="
}
"@astrojs/compiler": "^1.5.5",
"prettier": "^3.0.0",
"sass-formatter": "^0.7.6"
}
},
"pretty-format": {

View File

@ -6,9 +6,9 @@
"homepage": "https://kremalicious.com",
"license": "MIT",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro build",
"dev": "astro dev --config ./config/astro.config.mjs",
"start": "astro dev --config ./config/astro.config.mjs",
"build": "astro build --config ./config/astro.config.mjs",
"preview": "astro preview",
"astro": "astro",
"test": "npm run lint && npm run type-check && npm run jest",
@ -65,6 +65,7 @@
"@typescript-eslint/parser": "^6.5.0",
"eslint": "^8.48.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-astro": "^0.29.0",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.33.2",
@ -77,6 +78,7 @@
"ora": "^7.0.1",
"postcss": "^8.4.28",
"prettier": "^3.0.2",
"prettier-plugin-astro": "^0.12.0",
"stylelint": "^15.10.2",
"stylelint-config-css-modules": "^4.3.0",
"stylelint-config-standard": "^34.0.0",

View File

@ -1,6 +1,6 @@
import React from 'react'
import testRender from '../../../.jest/testRender'
import Footer from './Footer'
import Footer from '.'
describe('Footer', () => {
testRender(<Footer />)

View File

@ -1,9 +1,8 @@
import React from 'react'
import { Link } from 'gatsby'
import { useSiteMetadata } from '../../hooks/useSiteMetadata'
import Icon from '../core/Icon'
import Vcard from './Vcard'
import styles from './Footer.module.css'
import styles from './index.module.css'
function Copyright() {
const { name, uri, github } = useSiteMetadata().author
@ -21,10 +20,10 @@ function Copyright() {
<Icon name="GitHub" />
View source
</a>
<Link to="/thanks" className={styles.btc}>
<a href="/thanks" className={styles.btc}>
<Icon name="Bitcoin" />
Say Thanks
</Link>
</a>
</p>
</section>
)

View File

@ -1,5 +1,4 @@
import React, { ReactElement, useEffect, useState } from 'react'
import { Link } from 'gatsby'
import { useSiteMetadata } from '../../hooks/useSiteMetadata'
import Hamburger from '../core/Hamburger'
import styles from './Menu.module.css'
@ -22,9 +21,9 @@ export default function Menu(): ReactElement {
const MenuItems = menu.map((item) => (
<li key={item.title}>
<Link onClick={toggleMenu} to={item.link}>
<a onClick={toggleMenu} href={item.link}>
{item.title}
</Link>
</a>
</li>
))

View File

@ -1,6 +1,6 @@
import React from 'react'
import { fireEvent, render, screen } from '@testing-library/react'
import Header from './Header'
import Header from '.'
describe('Header', () => {
it('renders correctly', () => {

View File

@ -1,18 +1,17 @@
import React from 'react'
import { Link } from 'gatsby'
import { ReactComponent as Logo } from '../../images/logo.svg'
import Menu from './Menu'
import Search from './Search'
import ThemeSwitch from '../molecules/ThemeSwitch'
import styles from './Header.module.css'
import ThemeSwitch from './ThemeSwitch'
import styles from './index.module.css'
export default function Header(): JSX.Element {
return (
<header role="banner" className={styles.header}>
<div className={styles.headerContent}>
<Link to="/" className={styles.title}>
<a href="/" className={styles.title}>
<Logo className={styles.logo} /> kremalicious
</Link>
</a>
<nav aria-label="Menu" className={styles.nav}>
<ThemeSwitch />

View File

@ -1,5 +1,4 @@
import React, { ReactElement } from 'react'
import { Link } from 'gatsby'
import { PageContext } from '../@types/Post'
import Icon from './core/Icon'
import styles from './Pagination.module.css'
@ -17,9 +16,9 @@ function PageNumber({
const link = i === 0 ? slug : `${slug}page/${i + 1}`
return (
<Link className={classes} to={link}>
<a className={classes} href={link}>
{i + 1}
</Link>
</a>
)
}
@ -35,13 +34,13 @@ function PrevNext({
const title = prevPagePath ? 'Newer Posts' : 'Older Posts'
return (
<Link to={link} rel={rel} title={title} className={styles.number}>
<a href={link} rel={rel} title={title} className={styles.number}>
{prevPagePath ? (
<Icon name="ChevronLeft" />
) : (
<Icon name="ChevronRight" />
)}
</Link>
</a>
)
}

View File

@ -1,5 +1,4 @@
import React, { ReactElement } from 'react'
import { Link, graphql } from 'gatsby'
import { Image } from '../core/Image'
import PostTitle from '../layouts/Post/Title'
import styles from './PostTeaser.module.css'
@ -40,9 +39,9 @@ export default function PostTeaser({
const { slug, date } = post.fields
return (
<Link
<a
className={styles.post}
to={slug}
href={slug}
onClick={toggleSearch && toggleSearch}
>
{image ? (
@ -60,6 +59,6 @@ export default function PostTeaser({
updated={updated}
className={styles.title}
/>
</Link>
</a>
)
}

View File

@ -1,5 +1,4 @@
import React, { ReactElement, useState } from 'react'
import { graphql, useStaticQuery } from 'gatsby'
import { PhotoThumb } from '../templates/Photos'
import PostTeaser from './PostTeaser'
import styles from './RelatedPosts.module.css'

View File

@ -1,5 +1,4 @@
import React, { ReactElement } from 'react'
import { Link } from 'gatsby'
import styles from './Tag.module.css'
export default function Tag({
@ -14,9 +13,9 @@ export default function Tag({
style?: any
}): ReactElement {
return (
<Link className={styles.tag} to={url} style={style}>
<a className={styles.tag} href={url} style={style}>
{name}
{count && <span className={styles.count}>{count}</span>}
</Link>
</a>
)
}

View File

@ -1,17 +0,0 @@
import React from 'react'
import { Script } from 'gatsby'
const script = `
(function(d) {
var config = {
kitId: '${process.env.PUBLIC_TYPEKIT_ID}',
scriptTimeout: 3000,
async: true
},
h=d.documentElement,t=setTimeout(function(){h.className=h.className.replace(/\bwf-loading\b/g,"")+" wf-inactive";},config.scriptTimeout),tk=d.createElement("script"),f=false,s=d.getElementsByTagName("script")[0],a;h.className+=" wf-loading";tk.src='https://use.typekit.net/'+config.kitId+'.js';tk.async=true;tk.onload=tk.onreadystatechange=function(){a=this.readyState;if(f||a&&a!="complete"&&a!="loaded")return;f=true;clearTimeout(t);try{Typekit.load(config)}catch(e){}};s.parentNode.insertBefore(tk,s)
})(document);
`
export default function Typekit(): JSX.Element {
return <Script id="typekit" dangerouslySetInnerHTML={{ __html: script }} />
}

View File

@ -0,0 +1,39 @@
---
import '../../../styles/global.css'
import '../../../styles/imports.css'
import styles from './index.module.css'
import Footer from '../../Footer'
import Header from '../../Header'
const { title, pathname } = Astro.props
---
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width" />
<title>Astro</title>
<script>
(function(d) {
var config = {
kitId: process.env.PUBLIC_TYPEKIT_ID,
scriptTimeout: 3000,
async: true
},
h=d.documentElement,t=setTimeout(function(){h.className=h.className.replace(/\bwf-loading\b/g,"")+" wf-inactive";},config.scriptTimeout),tk=d.createElement("script"),f=false,s=d.getElementsByTagName("script")[0],a;h.className+=" wf-loading";tk.src='https://use.typekit.net/'+config.kitId+'.js';tk.async=true;tk.onload=tk.onreadystatechange=function(){a=this.readyState;if(f||a&&a!="complete"&&a!="loaded")return;f=true;clearTimeout(t);try{Typekit.load(config)}catch(e){}};s.parentNode.insertBefore(tk,s)
})(document);
</script>
</head>
<body >
<Header />
<main class={styles.document} id="document">
<div class={styles.content}><slot /></div>
</main>
<Footer />
</body>
</html>

View File

@ -1,24 +0,0 @@
import { ReactElement } from 'react'
import styles from './Layout.module.css'
import Typekit from '../../core/Typekit'
import Footer from '../../organisms/Footer'
import Header from '../../organisms/Header'
export default function LayoutBase({
children
}: {
children: any
}): ReactElement {
return (
<>
<Typekit />
<Header />
<main className={styles.document} id="document">
<div className={styles.content}>{children}</div>
</main>
<Footer />
</>
)
}

View File

@ -1,5 +1,4 @@
import React, { ReactElement } from 'react'
import { Link, PageProps, graphql } from 'gatsby'
import { PageContext } from '../../../@types/Post'
import HeadMeta, { HeadMetaProps } from '../../core/HeadMeta'
import { Image } from '../../core/Image'
@ -19,9 +18,9 @@ export const PhotoThumb = ({
return (
<article className={styles.photo}>
{image && (
<Link to={slug}>
<a href={slug}>
<Image title={title} image={gatsbyImageData} alt={title} />
</Link>
</a>
)}
</article>
)

View File

@ -1,5 +1,4 @@
import React, { ReactElement } from 'react'
import { Link } from 'gatsby'
import Icon from '../../core/Icon'
import styles from './LinkActions.module.css'
import stylesMore from './More.module.css'
@ -15,9 +14,9 @@ const PostLinkActions = ({
<a className={stylesMore.postMore} href={linkurl}>
Go to source <Icon name="ExternalLink" />
</a>
<Link to={slug} rel="tooltip" title="Permalink">
<a href={slug} rel="tooltip" title="Permalink">
<Icon name="Link" />
</Link>
</a>
</div>
)

View File

@ -1,5 +1,4 @@
import React, { ReactElement } from 'react'
import { Link } from 'gatsby'
import slugify from 'slugify'
import { useSiteMetadata } from '../../../hooks/useSiteMetadata'
import Tag from '../../core/Tag'
@ -28,7 +27,7 @@ export default function PostMeta({
{type && type === 'photo' && (
<div className={styles.type}>
<Link to={`/${slugify(type)}s/`}>{type}s</Link>
<a href={`/${slugify(type)}s/`}>{type}s</a>
</div>
)}

View File

@ -1,5 +1,4 @@
import React, { ReactElement } from 'react'
import { Link } from 'gatsby'
import Icon from '../../core/Icon'
import styles from './More.module.css'
@ -10,10 +9,10 @@ const PostMore = ({
to: string
children: string
}): ReactElement => (
<Link className={styles.postMore} to={to}>
<a className={styles.postMore} href={to}>
{children}
<Icon name="ChevronRight" />
</Link>
</a>
)
export default PostMore

View File

@ -1,5 +1,4 @@
import React, { ReactElement } from 'react'
import { Link } from 'gatsby'
import Icon from '../../core/Icon'
import styles from './PrevNext.module.css'
@ -17,20 +16,20 @@ const PrevNext = ({ prev, next }: PrevNextProps): ReactElement => (
<nav className={styles.prevnext}>
<div>
{prev && (
<Link to={prev.slug}>
<a href={prev.slug}>
<Icon name="ChevronLeft" />
<p className={styles.label}>Newer</p>
<h3 className={styles.title}>{prev.title}</h3>
</Link>
</a>
)}
</div>
<div>
{next && (
<Link to={next.slug}>
<a href={next.slug}>
<p className={styles.label}>Older</p>
<h3 className={styles.title}>{next.title}</h3>
<Icon name="ChevronRight" />
</Link>
</a>
)}
</div>
</nav>

View File

@ -1,5 +1,4 @@
import React, { ReactElement } from 'react'
import { Link, PageProps } from 'gatsby'
import HeadMeta, { HeadMetaProps } from '../../components/core/HeadMeta'
import Page from '../../components/layouts/Page'
import styles from './404.module.css'
@ -16,7 +15,7 @@ const NotFound = (): ReactElement => (
<div className={styles.wrapper}>
<h1 className={styles.title}>{meta.title}</h1>{' '}
<p className={styles.text}>{meta.description}</p>
<Link to={'/'}>Back to homepage</Link>
<a href={'/'}>Back to homepage</a>
</div>
</Page>
)

17
src/pages/feed.json.ts Normal file
View File

@ -0,0 +1,17 @@
import { getCollection } from 'astro:content'
import { SITE_TITLE, SITE_DESCRIPTION } from '../consts'
export async function get(context) {
const posts = await getCollection('blog')
return {
body: JSON.stringify({
title: SITE_TITLE,
description: SITE_DESCRIPTION,
site: context.site,
items: posts.map((post) => ({
...post.data,
link: `/blog/${post.slug}/`
}))
})
}
}

View File

@ -2,13 +2,15 @@
"extends": "astro/tsconfigs/strict",
"compilerOptions": {
"jsx": "react-jsx",
"plugins": [
{
"name": "typescript-plugin-css-modules"
}
],
"plugins": [{ "name": "typescript-plugin-css-modules" }],
"jsxImportSource": "react"
},
"exclude": ["node_modules", "public", "dist", "*.js"],
"include": ["./*.ts", "./src/**/*", "./scripts/*.ts", "./.jest/**/*"]
"exclude": ["node_modules", "public", "dist", "./**/*.js", "./**/*.astro"],
"include": [
"./**/*.ts",
"./**/*.tsx",
"./**/*.mjs",
"./scripts/*.ts",
"./.jest/**/*"
]
}