diff options
| author | Fuwn <[email protected]> | 2024-01-11 18:45:31 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-01-11 18:45:31 -0800 |
| commit | 1b71b6a1197967271528fd0d5b9ff5fc9a1f3c26 (patch) | |
| tree | 5261f5d00e22b53e89420c3c1b5fa97d60253d6e /src/lib/Notification/options.ts | |
| parent | refactor(routes): move shortcuts to hooks (diff) | |
| download | due.moe-1b71b6a1197967271528fd0d5b9ff5fc9a1f3c26.tar.xz due.moe-1b71b6a1197967271528fd0d5b9ff5fc9a1f3c26.zip | |
feat: notifications
Diffstat (limited to 'src/lib/Notification/options.ts')
| -rw-r--r-- | src/lib/Notification/options.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/lib/Notification/options.ts b/src/lib/Notification/options.ts new file mode 100644 index 00000000..f14e0d25 --- /dev/null +++ b/src/lib/Notification/options.ts @@ -0,0 +1,19 @@ +type Position = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'; + +interface Options { + heading: string | number; + description: string | number | undefined; + position: Position; + duration: number; + id: string; +} + +export const options = (preferences: { [key: string]: number | string }): Options => { + return { + position: (preferences.position || 'top-right') as Position, + duration: Number(preferences.duration || 3000), + heading: preferences.heading || 'Notification', + description: preferences.description || undefined, + id: Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15) + }; +}; |