-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(bridge-ui-v2): add dialog for claim with insufficient funds (#14742
) Co-authored-by: dave | d1onys1us <[email protected]>
- Loading branch information
1 parent
fb9b42b
commit 75a1c71
Showing
3 changed files
with
83 additions
and
2 deletions.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
packages/bridge-ui-v2/src/components/Transactions/InsufficientFunds.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<script lang="ts"> | ||
import { onDestroy } from 'svelte'; | ||
import { t } from 'svelte-i18n'; | ||
import { Button } from '$components/Button'; | ||
import { Icon } from '$components/Icon'; | ||
import { PUBLIC_GUIDE_URL } from '$env/static/public'; | ||
import { uid } from '$libs/util/uid'; | ||
export let modalOpen = false; | ||
let dialogId = `dialog-${uid()}`; | ||
function closeModal() { | ||
removeEscKeyListener(); | ||
modalOpen = false; | ||
} | ||
let escKeyListener: (event: KeyboardEvent) => void; | ||
const addEscKeyListener = () => { | ||
escKeyListener = (event: KeyboardEvent) => { | ||
if (event.key === 'Escape') { | ||
closeModal(); | ||
} | ||
}; | ||
window.addEventListener('keydown', escKeyListener); | ||
}; | ||
const removeEscKeyListener = () => { | ||
window.removeEventListener('keydown', escKeyListener); | ||
}; | ||
onDestroy(() => { | ||
removeEscKeyListener(); | ||
}); | ||
$: if (modalOpen) { | ||
addEscKeyListener(); | ||
} else { | ||
removeEscKeyListener(); | ||
} | ||
</script> | ||
|
||
<dialog id={dialogId} class="modal" class:modal-open={modalOpen}> | ||
<div class="modal-box relative px-6 py-[35px] md:rounded-[20px] bg-neutral-background"> | ||
<button class="absolute right-6 top-[35px]" on:click={closeModal}> | ||
<Icon type="x-close" fillClass="fill-primary-icon" size={24} /> | ||
</button> | ||
<div class="w-full space-y-6"> | ||
<h3 class="title-body-bold mb-7">{$t('transactions.actions.claim.dialog.title')}</h3> | ||
<div class="body-regular text-secondary-content mb-3 flex flex-col items-end"> | ||
<div> | ||
{$t('transactions.actions.claim.dialog.description')} | ||
</div> | ||
<a href={PUBLIC_GUIDE_URL} target="_blank" class="flex link py-[10px]"> | ||
{$t('transactions.actions.claim.dialog.link')}<Icon type="arrow-top-right" /> | ||
</a> | ||
</div> | ||
|
||
<Button | ||
type="primary" | ||
class="px-[28px] py-[10px] rounded-full w-full border-primary-brand" | ||
hasBorder={true} | ||
on:click={closeModal}> | ||
<span class="body-bold">{$t('common.ok')}</span> | ||
</Button> | ||
</div> | ||
</div> | ||
</dialog> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75a1c71
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
bridge-ui-v2-internal – ./packages/bridge-ui-v2
bridge-ui-v2-internal-taikoxyz.vercel.app
bridge-ui-v2-internal-git-main-taikoxyz.vercel.app
bridge-ui-v2-internal.vercel.app