refactor: some renaming and corrections

This commit is contained in:
Riccardo
2023-12-19 19:21:45 +01:00
parent c639f55067
commit 146ea54d71
18 changed files with 169 additions and 7545 deletions

View File

@@ -3,7 +3,7 @@
import { usePathname } from 'next/navigation';
import { useEffect, useState } from 'react';
import { z } from 'zod';
import { NewsSchema } from '../../../../utils/schemas';
import { NewsTile, NewsTileSchema } from '../../../../utils/schemas';
import { Tile } from './tile';
type TilesProps = {
@@ -19,11 +19,11 @@ export const Tiles = ({ children }: TilesProps) => {
width: 0,
height: 0
});
const [news, setNews] = useState<z.infer<typeof NewsSchema>[]>();
const [news, setNews] = useState<z.infer<typeof NewsTileSchema>[]>();
useEffect(() => {
async function getNews() {
const news = await fetch('/api/news').then(res => res.json());
const news: NewsTile[] = await fetch('/api/news').then(res => res.json());
if (news) {
setNews(news);
@@ -83,7 +83,7 @@ export const Tiles = ({ children }: TilesProps) => {
return (
<div>
<div className='flex flex-col justify-between'>
<div className='-ml-12 -mt-10 flex flex-col justify-between'>
{Array.from({ length: rows }).map((_, index) =>
renderRow(columns, index)
)}