Files
recipe-app/_archive/frontend/app/recipes/page.tsx
T
Nils-Johan Gynther ffe50e5151
Test Suite / test (24.15.0) (push) Has been cancelled
feat: add TypeScript definitions for next-auth session with accessToken and user details
2026-05-04 20:09:21 +02:00

34 lines
1.0 KiB
TypeScript

import Link from 'next/link';
import { fetchJson } from '../../lib/api';
import type { Recipe } from '../../features/inventory/types';
import Navigation from '../Navigation';
import RecipeGrid from './RecipeGrid';
export default async function RecipesPage() {
const recipes = await fetchJson<Recipe[]>('/api/recipes');
return (
<main style={{ padding: '1rem', maxWidth: '1000px', margin: '0 auto' }}>
<Navigation />
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: '1.5rem' }}>
<h1 style={{ margin: 0 }}>Recept</h1>
<Link
href="/recipes/create"
style={{
padding: '0.5rem 1rem',
background: '#0070f3',
color: 'white',
borderRadius: '4px',
textDecoration: 'none',
fontWeight: 500,
fontSize: '1rem',
}}
>
Lägg till nytt recept
</Link>
</div>
<RecipeGrid recipes={recipes} />
</main>
);
}