feat(FontCategory): separate types for font categories from different providers

This commit is contained in:
Ilia Mashkov
2026-01-09 16:09:18 +03:00
parent de2688de5a
commit 8ad29fd3a8
3 changed files with 8 additions and 2 deletions

View File

@@ -3,11 +3,13 @@
* DOMAIN TYPES * DOMAIN TYPES
* ============================================================================ * ============================================================================
*/ */
import type { FontCategory as FontshareFontCategory } from './fontshare';
import type { FontCategory as GoogleFontCategory } from './google';
/** /**
* Font category * Font category
*/ */
export type FontCategory = 'sans-serif' | 'serif' | 'display' | 'handwriting' | 'monospace'; export type FontCategory = GoogleFontCategory | FontshareFontCategory;
/** /**
* Font provider * Font provider

View File

@@ -8,6 +8,8 @@ import type { CollectionApiModel } from '$shared/types/collection';
export const FONTSHARE_API_URL = 'https://api.fontshare.com/v2' as const; export const FONTSHARE_API_URL = 'https://api.fontshare.com/v2' as const;
export type FontCategory = 'sans' | 'serif' | 'slab' | 'display' | 'handwritten' | 'script';
/** /**
* Model of Fontshare API response * Model of Fontshare API response
* @see https://fontshare.com * @see https://fontshare.com

View File

@@ -4,6 +4,8 @@
* ============================================================================ * ============================================================================
*/ */
export type FontCategory = 'sans-serif' | 'serif' | 'display' | 'handwriting' | 'monospace';
/** /**
* Model of google fonts api response * Model of google fonts api response
*/ */
@@ -29,7 +31,7 @@ export interface FontItem {
* Font category classification (e.g., "sans-serif", "serif", "display", "handwriting", "monospace") * Font category classification (e.g., "sans-serif", "serif", "display", "handwriting", "monospace")
* Useful for grouping and filtering fonts by style * Useful for grouping and filtering fonts by style
*/ */
category: string; category: FontCategory;
/** /**
* Available font variants for this font family * Available font variants for this font family