From bce557cc2dc767628bed6aac87301a1be7c5431b Mon Sep 17 00:00:00 2001
From: rxliuli <rxliuli@gmail.com>
Date: Tue, 4 Nov 2025 05:03:50 +0800
Subject: init commit

---
 src/components/jet/action/ExternalUrlAction.svelte | 52 ++++++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 src/components/jet/action/ExternalUrlAction.svelte

(limited to 'src/components/jet/action/ExternalUrlAction.svelte')

diff --git a/src/components/jet/action/ExternalUrlAction.svelte b/src/components/jet/action/ExternalUrlAction.svelte
new file mode 100644
index 0000000..e8a2ad6
--- /dev/null
+++ b/src/components/jet/action/ExternalUrlAction.svelte
@@ -0,0 +1,52 @@
+<script lang="ts">
+    import type { HTMLAnchorAttributes } from 'svelte/elements';
+    import type { ExternalUrlAction } from '@jet-app/app-store/api/models';
+    import ArrowIcon from '@amp/web-app-components/assets/icons/arrow.svg';
+    import { getJetPerform } from '~/jet';
+
+    type AllowedAnchorAttributes = Omit<
+        HTMLAnchorAttributes,
+        // The `href` attribute is not allowed because it will be provided
+        // by the `ExternalUrlAction`
+        'href'
+    >;
+
+    interface $$Props extends AllowedAnchorAttributes {
+        destination: ExternalUrlAction;
+        includeArrowIcon?: boolean;
+    }
+
+    const perform = getJetPerform();
+
+    export let destination: ExternalUrlAction;
+    export let includeArrowIcon: boolean = true;
+
+    function handleClickAction() {
+        perform(destination);
+    }
+</script>
+
+<a
+    {...$$restProps}
+    data-test-id="external-link"
+    href={destination.url}
+    target="_blank"
+    rel="nofollow noopener noreferrer"
+    on:click={handleClickAction}
+>
+    <slot />
+    {#if includeArrowIcon}
+        <ArrowIcon class="external-link-arrow" aria-hidden="true" />
+    {/if}
+</a>
+
+<style lang="scss">
+    @use '@amp/web-shared-styles/sasskit-stylekit/ac-sasskit-config';
+    @use 'ac-sasskit/core/locale' as *;
+
+    a :global(.external-link-arrow) {
+        @include rtl {
+            transform: rotate(-90deg);
+        }
+    }
+</style>
-- 
cgit v1.2.3

