refactor: renames, rewrite some file, function names and texts

This commit is contained in:
Riccardo
2024-06-18 12:03:56 +02:00
parent acc10bf5fd
commit e0b89237fb
22 changed files with 55 additions and 84 deletions

6
utils/cn.ts Normal file
View File

@@ -0,0 +1,6 @@
import { type ClassValue, clsx } from 'clsx';
import { twMerge } from 'tailwind-merge';
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}

View File

@@ -1,4 +1,4 @@
export const sayings = [
export const getSayings = [
'hot off the press',
'straight from the oven',
"straight from the horse's mouth",

View File

@@ -1,6 +0,0 @@
import { type ClassValue, clsx } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}

View File

@@ -1,5 +1,6 @@
export const topNews = 'https://hacker-news.firebaseio.com/v0/topstories.json';
export const getTopNews =
'https://hacker-news.firebaseio.com/v0/topstories.json';
export function singleNews(id: number) {
export function getSingleNews(id: number) {
return `https://hacker-news.firebaseio.com/v0/item/${id}.json`;
}

View File

@@ -1,11 +1,9 @@
import { z } from 'zod';
export const ResponseSchema = z.object({
success: z.boolean(),
message: z.string()
});
export type ResponseType = z.infer<typeof ResponseSchema>;
export interface ResponseType {
success: boolean;
message: string;
}
export const SubscribeFormSchema = z.object({
email: z.string().email()
@@ -36,24 +34,17 @@ export const NewsDatabaseSchema = z.object({
export type NewsDatabaseType = z.infer<typeof NewsDatabaseSchema>;
export const NewsSchema = z.object({
id: z.number(),
title: z.string(),
text: z.string().nullable(),
type: z.string(),
by: z.string(),
time: z.number(),
url: z.string().nullable(),
score: z.number(),
createdAt: z.date()
});
export interface NewsTileType {
id: number;
title: string;
by: string;
}
export type NewsType = z.infer<typeof NewsSchema>;
export const NewsTileSchema = z.object({
id: z.number(),
title: z.string(),
by: z.string()
});
export type NewsTileType = z.infer<typeof NewsTileSchema>;
export interface NewsType extends NewsTileType {
text: string | null;
type: string;
time: number;
url: string | null;
score: number;
createdAt: Date;
}