mirror of
https://github.com/remvze/moodist.git
synced 2025-09-29 15:30:49 -04:00
refactor: seperate common types
This commit is contained in:
parent
f1688cb53c
commit
bad2d31b2d
@ -11,12 +11,7 @@ import { Categories } from '@/components/categories';
|
||||
|
||||
import { sounds } from '@/data/sounds';
|
||||
|
||||
interface Sound {
|
||||
src: string;
|
||||
label: string;
|
||||
id: string;
|
||||
icon: React.ReactNode;
|
||||
}
|
||||
import type { Sound } from '@/data/types';
|
||||
|
||||
export function App() {
|
||||
const categories = useMemo(() => sounds.categories, []);
|
||||
|
@ -2,18 +2,10 @@ import { AnimatePresence } from 'framer-motion';
|
||||
|
||||
import { Category } from '@/components/category';
|
||||
|
||||
import type { Categories } from '@/data/types';
|
||||
|
||||
interface CategoriesProps {
|
||||
categories: Array<{
|
||||
id: string;
|
||||
title: string;
|
||||
icon: React.ReactNode;
|
||||
sounds: Array<{
|
||||
label: string;
|
||||
src: string;
|
||||
icon: React.ReactNode;
|
||||
id: string;
|
||||
}>;
|
||||
}>;
|
||||
categories: Categories;
|
||||
}
|
||||
|
||||
export function Categories({ categories }: CategoriesProps) {
|
||||
|
@ -5,17 +5,10 @@ import { fade } from '@/lib/motion';
|
||||
|
||||
import styles from './category.module.css';
|
||||
|
||||
interface CategoryProps {
|
||||
icon: React.ReactNode;
|
||||
title: string;
|
||||
id: string;
|
||||
import type { Category } from '@/data/types';
|
||||
|
||||
interface CategoryProps extends Category {
|
||||
functional?: boolean;
|
||||
sounds: Array<{
|
||||
label: string;
|
||||
src: string;
|
||||
icon: React.ReactNode;
|
||||
id: string;
|
||||
}>;
|
||||
}
|
||||
|
||||
export function Category({
|
||||
|
@ -9,12 +9,10 @@ import { cn } from '@/helpers/styles';
|
||||
|
||||
import styles from './sound.module.css';
|
||||
|
||||
interface SoundProps {
|
||||
label: string;
|
||||
src: string;
|
||||
icon: React.ReactNode;
|
||||
import type { Sound } from '@/data/types';
|
||||
|
||||
interface SoundProps extends Sound {
|
||||
hidden: boolean;
|
||||
id: string;
|
||||
functional: boolean;
|
||||
selectHidden: (key: string) => void;
|
||||
unselectHidden: (key: string) => void;
|
||||
|
@ -8,15 +8,12 @@ import { fade, scale, mix } from '@/lib/motion';
|
||||
|
||||
import styles from './sounds.module.css';
|
||||
|
||||
import type { Sounds } from '@/data/types';
|
||||
|
||||
interface SoundsProps {
|
||||
id: string;
|
||||
functional: boolean;
|
||||
sounds: Array<{
|
||||
label: string;
|
||||
src: string;
|
||||
icon: React.ReactNode;
|
||||
id: string;
|
||||
}>;
|
||||
sounds: Sounds;
|
||||
}
|
||||
|
||||
export function Sounds({ functional, id, sounds }: SoundsProps) {
|
||||
|
17
src/data/types.d.ts
vendored
Normal file
17
src/data/types.d.ts
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
export interface Sound {
|
||||
label: string;
|
||||
src: string;
|
||||
icon: React.ReactNode;
|
||||
id: string;
|
||||
}
|
||||
|
||||
export type Sounds = Array<Sound>;
|
||||
|
||||
export interface Category {
|
||||
id: string;
|
||||
title: string;
|
||||
icon: React.ReactNode;
|
||||
sounds: Sounds;
|
||||
}
|
||||
|
||||
export type Categories = Array<Category>;
|
Loading…
x
Reference in New Issue
Block a user