From 3b5cabee1124979df908ef507c670c1a900b6820 Mon Sep 17 00:00:00 2001 From: Brian Ginsburg <7957636+bgins@users.noreply.github.com> Date: Fri, 14 Oct 2022 19:26:30 -0700 Subject: [PATCH] Add info and warning notification icons (#76) * Add info and warning notification icons * Switch over to icon map --- src/components/icons/InfoThinIcon.svelte | 19 +++++++++ src/components/icons/WarningThinIcon.svelte | 19 +++++++++ .../notifications/Notification.svelte | 40 +++++++++++++++---- tailwind.config.cjs | 4 +- 4 files changed, 73 insertions(+), 9 deletions(-) create mode 100644 src/components/icons/InfoThinIcon.svelte create mode 100644 src/components/icons/WarningThinIcon.svelte diff --git a/src/components/icons/InfoThinIcon.svelte b/src/components/icons/InfoThinIcon.svelte new file mode 100644 index 0000000..05aa050 --- /dev/null +++ b/src/components/icons/InfoThinIcon.svelte @@ -0,0 +1,19 @@ + + + + + diff --git a/src/components/icons/WarningThinIcon.svelte b/src/components/icons/WarningThinIcon.svelte new file mode 100644 index 0000000..ce322ca --- /dev/null +++ b/src/components/icons/WarningThinIcon.svelte @@ -0,0 +1,19 @@ + + + + + diff --git a/src/components/notifications/Notification.svelte b/src/components/notifications/Notification.svelte index 0e6c363..92a8d6f 100644 --- a/src/components/notifications/Notification.svelte +++ b/src/components/notifications/Notification.svelte @@ -4,9 +4,38 @@ import { themeStore } from '../../stores' import type { Notification } from '$lib/notifications' import CheckThinIcon from '$components/icons/CheckThinIcon.svelte' + import InfoThinIcon from '$components/icons/InfoThinIcon.svelte' + import WarningThinIcon from '$components/icons/WarningThinIcon.svelte' import XThinIcon from '$components/icons/XThinIcon.svelte' export let notification: Notification + + const iconMap = { + info: { + component: InfoThinIcon, + props: { + color: '#1e3a8a' + } + }, + error: { + component: XThinIcon, + props: { + color: $themeStore === 'light' ? '#ffd6d7' : '#fec3c3' + } + }, + success: { + component: CheckThinIcon, + props: { + color: $themeStore === 'light' ? '#b8ffd3' : '#002e12' + } + }, + warning: { + component: WarningThinIcon, + props: { + color: '#7c2d12' + } + } + }
- {#if notification.type === 'success'} - - {:else if notification.type === 'error'} - - {/if} + {@html notification.msg}
diff --git a/tailwind.config.cjs b/tailwind.config.cjs index 4313fe2..3e2e931 100644 --- a/tailwind.config.cjs +++ b/tailwind.config.cjs @@ -12,7 +12,7 @@ module.exports = { secondary: "#30aadd", accent: "#00ffc6", neutral: "#282828", - info: "#bfdbfe", + info: "#93c5fd", success: "#22c55e", warning: "#fdba74", error: "#ef4444", @@ -31,7 +31,7 @@ module.exports = { neutral: "#e5e5e5", info: "#bfdbfe", success: "#15803d", - warning: "#fdba74", + warning: "#fed7aa", error: "#b91c1c", "base-content": "#0f172a", // Base text content color "base-100": "#f8fafc", // Base background color