mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 21:55:59 +00:00
dynamic promo widget
This commit is contained in:
21
packages/web/src/jsonui/JsonUiLinkButton.svelte
Normal file
21
packages/web/src/jsonui/JsonUiLinkButton.svelte
Normal file
@@ -0,0 +1,21 @@
|
||||
<script lang="ts">
|
||||
import FormStyledButton from '../buttons/FormStyledButton.svelte';
|
||||
import { openWebLink } from '../utility/simpleTools';
|
||||
|
||||
export let text: string;
|
||||
export let link: string;
|
||||
export let newTab: boolean = true;
|
||||
|
||||
// very light url guard
|
||||
const safe = /^(https?:)?\/\//i.test(link) || link.startsWith('/');
|
||||
</script>
|
||||
|
||||
<div class="center">
|
||||
<FormStyledButton on:click={() => openWebLink(link)} value={text} skipWidth />
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user