mirror of
https://github.com/Patiun/com.gregkilmer.www.git
synced 2026-11-08 04:08:24 +00:00
gaming updates
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* platforms.ts
|
||||
* ---------------------------------------------------------------------------
|
||||
* Helpers for mapping a free-form platform string (as authored in the games /
|
||||
* nowPlaying content) to an mdi icon name. Kept here so it can be shared
|
||||
* between the gaming page and any future components without coupling to the
|
||||
* content collection config.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns an mdi icon name (without the `mdi:` prefix) for a platform string.
|
||||
* Matches case-insensitively on substrings; unknown platforms fall back to a
|
||||
* generic gamepad.
|
||||
*
|
||||
* @example platformToIcon("PlayStation 5") // "sony-playstation"
|
||||
*/
|
||||
export const platformToIcon = (platform: string): string => {
|
||||
const p = platform.toLowerCase();
|
||||
if (p.includes('playstation') || p.includes('ps5') || p.includes('ps4')) return 'sony-playstation';
|
||||
if (p.includes('switch')) return 'nintendo-switch';
|
||||
if (p.includes('steam') || p.includes('pc')) return 'steam';
|
||||
if (p.includes('xbox')) return 'microsoft-xbox';
|
||||
return 'gamepad-variant';
|
||||
};
|
||||
Reference in New Issue
Block a user