From 2a9e668dceda855f8302e2ca9f81ebd6f0e7b5c1 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Sun, 25 Sep 2022 18:01:37 +0800 Subject: feat: Safelist all classes needed for alerts --- apps/kit/src/app.pcss | 1 + apps/kit/src/lib/components/alert.svelte | 16 +++++-- apps/kit/src/routes/(public)/reset/+page.svelte | 22 +++------ apps/kit/src/routes/+layout.svelte | 5 +- apps/kit/src/routes/+page.svelte | 3 +- apps/kit/src/routes/book/+layout.svelte | 26 +++++++++++ apps/kit/src/routes/book/+page.svelte | 0 apps/kit/src/routes/book/alerts/+page.svelte | 62 +++++++++++++++++++++++++ 8 files changed, 112 insertions(+), 23 deletions(-) create mode 100644 apps/kit/src/routes/book/+layout.svelte create mode 100644 apps/kit/src/routes/book/+page.svelte create mode 100644 apps/kit/src/routes/book/alerts/+page.svelte (limited to 'apps/kit/src') diff --git a/apps/kit/src/app.pcss b/apps/kit/src/app.pcss index f9c290c..78a8e0b 100644 --- a/apps/kit/src/app.pcss +++ b/apps/kit/src/app.pcss @@ -2,6 +2,7 @@ @tailwind base; @tailwind components; @tailwind utilities; + pre { font-family: monospace !important; } diff --git a/apps/kit/src/lib/components/alert.svelte b/apps/kit/src/lib/components/alert.svelte index 87962cf..53aa783 100644 --- a/apps/kit/src/lib/components/alert.svelte +++ b/apps/kit/src/lib/components/alert.svelte @@ -25,12 +25,11 @@ export let actions: Array<{ id: string; text: string; color?: string }> = []; // This value is set on a plain anchor tag without any svelte routing, - // listen to the right-link-click if you want to intercept the click without navigating + // listen to the rightLinkClick if you want to intercept the click without navigating export let rightLinkHref = "javascript:void(0)"; export let visible = true; const dispatch = createEventDispatcher(); - const cooldownStorageKey = "lastseen--" + id; let iconComponent: any; @@ -79,6 +78,14 @@ } } + function rightLinkClicked() { + dispatch("rightLinkCliked"); + } + + function actionClicked(name: string) { + dispatch("act-" + name); + } + // Manages the state of the alert if cooldown is enabled function run_cooldown() { if (!cooldownEnabled) { @@ -160,8 +167,7 @@

- dispatch("right-link-click")} + on:click={() => rightLinkClicked()} class="whitespace-nowrap font-medium text-{colorClassPart}-700 hover:text-{colorClassPart}-600" > {rightLinkText} @@ -187,7 +193,7 @@ {@const color = action?.color ?? colorClassPart}