Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(bridge-ui-v2): Add component CloseButton #14914

Merged
merged 2 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import FlatAlert from '$components/Alert/FlatAlert.svelte';
import { Button } from '$components/Button';
import { Icon } from '$components/Icon';
import { CloseButton } from '$components/CloseButton';
import { InputBox } from '$components/InputBox';
import { LoadingText } from '$components/LoadingText';
import { Tooltip } from '$components/Tooltip';
Expand Down Expand Up @@ -157,9 +157,7 @@

<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] z-50" on:click={cancelModal}>
<Icon type="x-close" fillClass="fill-primary-icon" size={24} />
</button>
<CloseButton onClick={cancelModal} />

<div class="w-full">
<h3 class="title-body-bold mb-7">{$t('processing_fee.title')}</h3>
Expand Down
6 changes: 2 additions & 4 deletions packages/bridge-ui-v2/src/components/Bridge/Recipient.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import type { Address } from 'viem';

import { Button } from '$components/Button';
import { Icon } from '$components/Icon';
import { CloseButton } from '$components/CloseButton';
import { Tooltip } from '$components/Tooltip';
import { shortenAddress } from '$libs/util/shortenAddress';
import { uid } from '$libs/util/uid';
Expand Down Expand Up @@ -109,9 +109,7 @@

<dialog id={dialogId} class="modal" class:modal-open={modalOpen}>
<div class="modal-box relative px-6 md:rounded-[20px] bg-neutral-background">
<button class="absolute right-6 z-50" on:click={closeModal}>
<Icon type="x-close" fillClass="fill-primary-icon" size={24} />
</button>
<CloseButton onClick={closeModal} />

<div class="w-full">
<h3 class="title-body-bold mb-7">{$t('recipient.title')}</h3>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { SwitchChainError, UserRejectedRequestError } from 'viem';

import { chainConfig } from '$chainConfig';
import { Icon } from '$components/Icon';
import { CloseButton } from '$components/CloseButton';
import { LoadingMask } from '$components/LoadingMask';
import { warningToast } from '$components/NotificationToast';
import { chains } from '$libs/chain';
Expand Down Expand Up @@ -148,9 +148,7 @@
<LoadingMask spinnerClass="border-white" text={$t('messages.network.switching')} />
{/if}

<button class="absolute right-6 top-[35px] md:top-[20px] z-50" on:click={closeModal}>
<Icon type="x-close" fillClass="fill-primary-icon" size={24} />
</button>
<CloseButton onClick={closeModal} />
<div class="w-full">
<h3 class="title-body-bold mb-[20px]">
{#if switchWallet}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<script lang="ts">
import { Icon } from '$components/Icon';

export let onClick: () => void;
</script>

<button class="absolute right-6 z-50" on:click={onClick}>
<Icon type="x-close" fillClass="fill-primary-icon" size={24} />
</button>
1 change: 1 addition & 0 deletions packages/bridge-ui-v2/src/components/CloseButton/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as CloseButton } from './CloseButton.svelte';
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { FlatAlert } from '$components/Alert';
import AddressInput from '$components/Bridge/AddressInput.svelte';
import { Button } from '$components/Button';
import { CloseButton } from '$components/CloseButton';
import { Icon } from '$components/Icon';
import Erc20 from '$components/Icon/ERC20.svelte';
import { Spinner } from '$components/Spinner';
Expand Down Expand Up @@ -162,9 +163,7 @@

<dialog id={dialogId} class="modal modal-bottom md:modal-middle" 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] z-50" on:click={closeModal}>
<Icon type="x-close" fillClass="fill-primary-icon" size={24} />
</button>
<CloseButton onClick={closeModal} />

<h3 class="title-body-bold mb-7">{$t('token_dropdown.custom_token.title')}</h3>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { t } from 'svelte-i18n';
import type { Address } from 'viem';

import { CloseButton } from '$components/CloseButton';
import { Icon } from '$components/Icon';
import Erc20 from '$components/Icon/ERC20.svelte';
import { OnAccount } from '$components/OnAccount';
Expand Down Expand Up @@ -58,9 +59,7 @@
<!-- Mobile view -->
<dialog {id} class="modal modal-bottom" class:modal-open={menuOpen}>
<div class="modal-box relative px-6 py-[35px] w-full bg-neutral-background">
<button class="absolute right-6 top-[35px] z-50" on:click={closeMenu}>
<Icon type="x-close" fillClass="fill-primary-icon" size={24} />
</button>
<CloseButton onClick={closeMenu} />

<div class="w-full">
<h3 class="title-body-bold mb-7">{$t('token_dropdown.label')}</h3>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { t } from 'svelte-i18n';

import { Button } from '$components/Button';
import { CloseButton } from '$components/CloseButton';
import { Icon } from '$components/Icon';
import { PUBLIC_GUIDE_URL } from '$env/static/public';
import { uid } from '$libs/util/uid';
Expand Down Expand Up @@ -44,9 +45,7 @@

<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] z-50" on:click={closeModal}>
<Icon type="x-close" fillClass="fill-primary-icon" size={24} />
</button>
<CloseButton onClick={closeModal} />
<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">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { formatEther } from 'viem';

import { chainConfig } from '$chainConfig';
import { CloseButton } from '$components/CloseButton';
import { Icon } from '$components/Icon';
import type { BridgeTransaction } from '$libs/bridge';
import { noop } from '$libs/util/noop';
Expand Down Expand Up @@ -41,9 +42,7 @@
<dialog id={dialogId} class="modal modal-bottom" class:modal-open={detailsOpen}>
<div
class="modal-box relative border border-neutral-background px-6 py-[30px] dark:glassy-gradient-card dark:glass-background-gradient">
<button class="absolute right-6 z-50" on:click={closeDetails}>
<Icon type="x-close" fillClass="fill-primary-icon" size={24} />
</button>
<CloseButton onClick={closeDetails} />

<h3 class="title-body-bold mb-7 text-primary-content">{$t('processing_fee.title')}</h3>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts">
import { t } from 'svelte-i18n';

import { CloseButton } from '$components/CloseButton';
import { Icon } from '$components/Icon';
import { uid } from '$libs/util/uid';

Expand Down Expand Up @@ -47,12 +48,9 @@

<dialog id={dialogId} class="modal" class:modal-open={modalOpen}>
<div
class="modal-box
bg-neutral-background text-primary-content text-center max-w-[565px]">
class="modal-box bg-neutral-background text-primary-content text-center max-w-[565px]">
<div class="w-full flex justify-end">
<button class="right-6 z-50" on:click={closeModal}>
<Icon type="x-close" fillClass="fill-primary-content" size={24} />
</button>
<CloseButton onClick={closeModal} />
</div>
<div class="w-full">
<h1 class="title-body-bold">{$t('transactions.status.dialog.title')}</h1>
Expand Down
Loading