Files
Crussell/frontend/src/lib/components/ui/policyPopover.svelte
T
popertots c8051a76d6
CI / Env docs check (push) Successful in 16s
CI / Nginx config check (push) Successful in 22s
CI / Docker compose check (push) Successful in 23s
CI / Frontend major deps (push) Successful in 23s
CI / Frontend deps check (push) Successful in 28s
CI / Secrets scan (push) Successful in 36s
CI / Go build (push) Successful in 37s
CI / Frontend build (push) Successful in 43s
CI / Knip (push) Successful in 52s
CI / Frontend a11y check (push) Successful in 1m48s
CI / Go vet (prod) (push) Successful in 1m36s
CI / Go vet (dev) (push) Successful in 2m11s
CI / go mod tidy (push) Successful in 1m0s
CI / Frontend QC (audit) (push) Successful in 35s
CI / Staticcheck (prod) (push) Successful in 2m47s
CI / Staticcheck (dev) (push) Successful in 3m4s
CI / golangci-lint (push) Successful in 3m24s
CI / Go vulnerabilities (push) Successful in 1m52s
CI / Frontend QC (lint) (push) Failing after 1m2s
CI / Frontend QC (typecheck) (push) Successful in 1m23s
CI / Svelte strict check (push) Has been skipped
CI / Security scan (prod) (push) Successful in 4m15s
CI / Security scan (dev) (push) Successful in 4m54s
CI / Tests (prod) (push) Successful in 3m48s
CI / Tests (dev) (push) Failing after 4m2s
CI / Race (prod) (push) Failing after 7m15s
CI / Race (dev) (push) Failing after 7m20s
fix: replace time.Sleep with poll loops in tests, fix a11y target=_blank violations
2026-07-11 16:16:23 +01:00

70 lines
1.4 KiB
Svelte

<script lang="ts">
import type { Snippet } from 'svelte';
const {
trigger
}: {
trigger?: Snippet;
} = $props();
let open = $state(false);
function toggle() {
open = !open;
}
function handleClickOutside(e: MouseEvent) {
const target = e.target as HTMLElement;
if (!target.closest('[data-policy-popover]')) {
open = false;
}
}
function handleKeydown(e: KeyboardEvent) {
if (e.key === 'Escape') open = false;
}
</script>
<svelte:window onclick={handleClickOutside} onkeydown={handleKeydown} />
<span data-policy-popover class="relative inline-block">
<button
type="button"
onclick={toggle}
class="inline cursor-pointer text-xs underline hover:text-amber-700"
>
{#if trigger}
{@render trigger()}
{:else}
cancellation policy
{/if}
</button>
{#if open}
<div
class="absolute top-full left-0 z-50 mt-1 w-48 rounded-md border border-gray-200 bg-white p-2 shadow-lg"
>
<a
href="/cancellation-policy"
target="_blank"
rel="noopener noreferrer external"
class="block w-full rounded px-3 py-2 text-left text-sm hover:bg-gray-100"
onclick={() => (open = false)}
>
Open
</a>
<button
type="button"
class="block w-full rounded px-3 py-2 text-left text-sm hover:bg-gray-100"
onclick={() => {
open = false;
const win = window.open('/cancellation-policy?format=pdf', '_blank');
if (win) win.focus();
}}
>
Download PDF
</button>
</div>
{/if}
</span>