mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-08 22:53:25 +00:00
feat: add multiple way to show collections and links
This commit is contained in:
18
shared/lib/display_preferences.ts
Normal file
18
shared/lib/display_preferences.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { DisplayPreferences } from '#shared/types/index';
|
||||
|
||||
export const COLLECTION_LIST_DISPLAYS = ['list', 'inline'] as const;
|
||||
export const LINK_LIST_DISPLAYS = ['list', 'grid'] as const;
|
||||
|
||||
export const DEFAULT_LIST_DISPLAY_PREFERENCES: DisplayPreferences = {
|
||||
linkListDisplay: LINK_LIST_DISPLAYS[0],
|
||||
collectionListDisplay: COLLECTION_LIST_DISPLAYS[0],
|
||||
} as const;
|
||||
|
||||
export function getDisplayPreferences(
|
||||
displayPreferences: Partial<DisplayPreferences> = DEFAULT_LIST_DISPLAY_PREFERENCES
|
||||
): DisplayPreferences {
|
||||
return {
|
||||
...DEFAULT_LIST_DISPLAY_PREFERENCES,
|
||||
...displayPreferences,
|
||||
} as const;
|
||||
}
|
||||
Reference in New Issue
Block a user