mirror of
https://github.com/kremalicious/blog.git
synced 2024-06-16 09:33:13 +02:00
src/pages setup
This commit is contained in:
parent
c8721539d1
commit
58275113bc
|
@ -1,4 +1,8 @@
|
||||||
import { defineConfig } from 'astro/config'
|
import { defineConfig } from 'astro/config';
|
||||||
|
|
||||||
|
import react from "@astrojs/react";
|
||||||
|
|
||||||
// https://astro.build/config
|
// https://astro.build/config
|
||||||
export default defineConfig({})
|
export default defineConfig({
|
||||||
|
integrations: [react()]
|
||||||
|
});
|
2
package-lock.json
generated
2
package-lock.json
generated
|
@ -73,7 +73,7 @@
|
||||||
"typescript-plugin-css-modules": "^5.0.1"
|
"typescript-plugin-css-modules": "^5.0.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "18"
|
"node": ">=16"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@aashutoshrathi/word-wrap": {
|
"node_modules/@aashutoshrathi/word-wrap": {
|
||||||
|
|
|
@ -93,7 +93,7 @@
|
||||||
"typescript-plugin-css-modules": "^5.0.1"
|
"typescript-plugin-css-modules": "^5.0.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "18"
|
"node": ">=16"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
22
src/content/config.ts
Normal file
22
src/content/config.ts
Normal 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 }
|
|
@ -1,7 +1,7 @@
|
||||||
import React, { ReactElement } from 'react'
|
import React, { ReactElement } from 'react'
|
||||||
import { Link, PageProps } from 'gatsby'
|
import { Link, PageProps } from 'gatsby'
|
||||||
import HeadMeta, { HeadMetaProps } from '../components/atoms/HeadMeta'
|
import HeadMeta, { HeadMetaProps } from '../../components/atoms/HeadMeta'
|
||||||
import Page from '../components/templates/Page'
|
import Page from '../../components/templates/Page'
|
||||||
import * as styles from './404.module.css'
|
import * as styles from './404.module.css'
|
||||||
|
|
||||||
const meta: Partial<HeadMetaProps> = {
|
const meta: Partial<HeadMetaProps> = {
|
0
src/pages/404/index.astro
Normal file
0
src/pages/404/index.astro
Normal file
18
src/pages/[...slug].astro
Normal file
18
src/pages/[...slug].astro
Normal 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 />
|
|
@ -1,6 +1,6 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { render } from '@testing-library/react'
|
import { render } from '@testing-library/react'
|
||||||
import NotFound from '../404'
|
import NotFound from '../404/404'
|
||||||
|
|
||||||
describe('/404', () => {
|
describe('/404', () => {
|
||||||
it('renders without crashing', () => {
|
it('renders without crashing', () => {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { render } from '@testing-library/react'
|
import { render } from '@testing-library/react'
|
||||||
import Tags from '../tags'
|
import Tags from '../tags/tags'
|
||||||
|
|
||||||
describe('/tags', () => {
|
describe('/tags', () => {
|
||||||
const data = {
|
const data = {
|
||||||
|
|
0
src/pages/archive.astro
Normal file
0
src/pages/archive.astro
Normal file
0
src/pages/index.astro
Normal file
0
src/pages/index.astro
Normal file
0
src/pages/photos/index.astro
Normal file
0
src/pages/photos/index.astro
Normal file
0
src/pages/tags/index.astro
Normal file
0
src/pages/tags/index.astro
Normal file
|
@ -1,8 +1,8 @@
|
||||||
import React, { ReactElement } from 'react'
|
import React, { ReactElement } from 'react'
|
||||||
import { PageProps, graphql } from 'gatsby'
|
import { PageProps, graphql } from 'gatsby'
|
||||||
import HeadMeta, { HeadMetaProps } from '../components/atoms/HeadMeta'
|
import HeadMeta, { HeadMetaProps } from '../../components/atoms/HeadMeta'
|
||||||
import Tag from '../components/atoms/Tag'
|
import Tag from '../../components/atoms/Tag'
|
||||||
import Page from '../components/templates/Page'
|
import Page from '../../components/templates/Page'
|
||||||
import * as styles from './tags.module.css'
|
import * as styles from './tags.module.css'
|
||||||
|
|
||||||
const meta: Partial<HeadMetaProps> = {
|
const meta: Partial<HeadMetaProps> = {
|
0
src/pages/thanks/index.astro
Normal file
0
src/pages/thanks/index.astro
Normal file
|
@ -2,11 +2,11 @@ import React, { ReactElement } from 'react'
|
||||||
import { HeadProps } from 'gatsby'
|
import { HeadProps } from 'gatsby'
|
||||||
import { WagmiConfig } from 'wagmi'
|
import { WagmiConfig } from 'wagmi'
|
||||||
import { RainbowKitProvider } from '@rainbow-me/rainbowkit'
|
import { RainbowKitProvider } from '@rainbow-me/rainbowkit'
|
||||||
import { chains, theme, wagmiConfig } from '../helpers/rainbowkit'
|
import { chains, theme, wagmiConfig } from '../../helpers/rainbowkit'
|
||||||
import Copy from '../components/atoms/Copy'
|
import Copy from '../../components/atoms/Copy'
|
||||||
import Meta, { HeadMetaProps } from '../components/atoms/HeadMeta'
|
import Meta, { HeadMetaProps } from '../../components/atoms/HeadMeta'
|
||||||
import Icon from '../components/atoms/Icon'
|
import Icon from '../../components/atoms/Icon'
|
||||||
import { useSiteMetadata } from '../hooks/useSiteMetadata'
|
import { useSiteMetadata } from '../../hooks/useSiteMetadata'
|
||||||
import * as styles from './thanks.module.css'
|
import * as styles from './thanks.module.css'
|
||||||
|
|
||||||
const meta: Partial<HeadMetaProps> = {
|
const meta: Partial<HeadMetaProps> = {
|
||||||
|
@ -14,7 +14,7 @@ const meta: Partial<HeadMetaProps> = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const Web3Donation = React.lazy(
|
const Web3Donation = React.lazy(
|
||||||
() => import('../components/molecules/Web3Donation')
|
() => import('../../components/molecules/Web3Donation')
|
||||||
)
|
)
|
||||||
|
|
||||||
function Coin({ address, title }: { address: string; title: string }) {
|
function Coin({ address, title }: { address: string; title: string }) {
|
|
@ -1,8 +1,13 @@
|
||||||
{
|
{
|
||||||
"extends": "astro/tsconfigs/strict",
|
"extends": "astro/tsconfigs/strict",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"jsx": "react",
|
"jsx": "react-jsx",
|
||||||
"plugins": [{ "name": "typescript-plugin-css-modules" }]
|
"plugins": [
|
||||||
|
{
|
||||||
|
"name": "typescript-plugin-css-modules"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"jsxImportSource": "react"
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules", "public", "dist", "*.js"],
|
"exclude": ["node_modules", "public", "dist", "*.js"],
|
||||||
"include": ["./*.ts", "./src/**/*", "./scripts/*.ts", "./.jest/**/*"]
|
"include": ["./*.ts", "./src/**/*", "./scripts/*.ts", "./.jest/**/*"]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user