1
0
Fork 0

src/pages setup

This commit is contained in:
Matthias Kretschmann 2023-08-29 23:09:47 +01:00
parent c8721539d1
commit 58275113bc
Signed by: m
GPG Key ID: 606EEEF3C479A91F
21 changed files with 68 additions and 20 deletions

1
.nvmrc
View File

@ -1 +0,0 @@
18

View File

@ -1,4 +1,8 @@
import { defineConfig } from 'astro/config'
import { defineConfig } from 'astro/config';
import react from "@astrojs/react";
// https://astro.build/config
export default defineConfig({})
export default defineConfig({
integrations: [react()]
});

2
package-lock.json generated
View File

@ -73,7 +73,7 @@
"typescript-plugin-css-modules": "^5.0.1"
},
"engines": {
"node": "18"
"node": ">=16"
}
},
"node_modules/@aashutoshrathi/word-wrap": {

View File

@ -93,7 +93,7 @@
"typescript-plugin-css-modules": "^5.0.1"
},
"engines": {
"node": "18"
"node": ">=16"
},
"repository": {
"type": "git",

22
src/content/config.ts Normal file
View File

@ -0,0 +1,22 @@
import { defineCollection, z } from 'astro:content'
const articles = defineCollection({
type: 'content', // v2.5.0 and later
// Type-check frontmatter using a schema
schema: z.object({
title: z.string(),
description: z.string(),
// Transform string to Date object
date: z
.string()
.or(z.date())
.transform((val) => new Date(val)),
updated: z
.string()
.optional()
.transform((str) => (str ? new Date(str) : undefined)),
image: z.string().optional()
})
})
export const collections = { articles }

View File

@ -1,7 +1,7 @@
import React, { ReactElement } from 'react'
import { Link, PageProps } from 'gatsby'
import HeadMeta, { HeadMetaProps } from '../components/atoms/HeadMeta'
import Page from '../components/templates/Page'
import HeadMeta, { HeadMetaProps } from '../../components/atoms/HeadMeta'
import Page from '../../components/templates/Page'
import * as styles from './404.module.css'
const meta: Partial<HeadMetaProps> = {

View File

18
src/pages/[...slug].astro Normal file
View File

@ -0,0 +1,18 @@
---
import { getCollection } from 'astro:content';
// 1. Generate a new path for every collection entry
export async function getStaticPaths() {
const articles = await getCollection('articles');
return articles.map(entry => ({
params: { slug: entry.slug }, props: { entry },
}));
}
// 2. For your template, you can get the entry directly from the prop
const { entry } = Astro.props;
const { Content } = await entry.render();
---
<h1>{entry.data.title}</h1>
<Content />

View File

@ -1,6 +1,6 @@
import React from 'react'
import { render } from '@testing-library/react'
import NotFound from '../404'
import NotFound from '../404/404'
describe('/404', () => {
it('renders without crashing', () => {

View File

@ -1,6 +1,6 @@
import React from 'react'
import { render } from '@testing-library/react'
import Tags from '../tags'
import Tags from '../tags/tags'
describe('/tags', () => {
const data = {

0
src/pages/archive.astro Normal file
View File

0
src/pages/index.astro Normal file
View File

View File

View File

View File

@ -1,8 +1,8 @@
import React, { ReactElement } from 'react'
import { PageProps, graphql } from 'gatsby'
import HeadMeta, { HeadMetaProps } from '../components/atoms/HeadMeta'
import Tag from '../components/atoms/Tag'
import Page from '../components/templates/Page'
import HeadMeta, { HeadMetaProps } from '../../components/atoms/HeadMeta'
import Tag from '../../components/atoms/Tag'
import Page from '../../components/templates/Page'
import * as styles from './tags.module.css'
const meta: Partial<HeadMetaProps> = {

View File

View File

@ -2,11 +2,11 @@ import React, { ReactElement } from 'react'
import { HeadProps } from 'gatsby'
import { WagmiConfig } from 'wagmi'
import { RainbowKitProvider } from '@rainbow-me/rainbowkit'
import { chains, theme, wagmiConfig } from '../helpers/rainbowkit'
import Copy from '../components/atoms/Copy'
import Meta, { HeadMetaProps } from '../components/atoms/HeadMeta'
import Icon from '../components/atoms/Icon'
import { useSiteMetadata } from '../hooks/useSiteMetadata'
import { chains, theme, wagmiConfig } from '../../helpers/rainbowkit'
import Copy from '../../components/atoms/Copy'
import Meta, { HeadMetaProps } from '../../components/atoms/HeadMeta'
import Icon from '../../components/atoms/Icon'
import { useSiteMetadata } from '../../hooks/useSiteMetadata'
import * as styles from './thanks.module.css'
const meta: Partial<HeadMetaProps> = {
@ -14,7 +14,7 @@ const meta: Partial<HeadMetaProps> = {
}
const Web3Donation = React.lazy(
() => import('../components/molecules/Web3Donation')
() => import('../../components/molecules/Web3Donation')
)
function Coin({ address, title }: { address: string; title: string }) {

View File

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