-
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): NFT bridge stepper (#14811)
- Loading branch information
1 parent
2d2c5f4
commit 7635921
Showing
10 changed files
with
185 additions
and
31 deletions.
There are no files selected for viewing
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
25 changes: 17 additions & 8 deletions
25
packages/bridge-ui-v2/src/components/Bridge/BridgeTabs.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 |
---|---|---|
@@ -1,25 +1,34 @@ | ||
<script lang="ts"> | ||
import { t } from 'svelte-i18n'; | ||
import { page } from '$app/stores'; | ||
import { LinkButton } from '$components/LinkButton'; | ||
import { PUBLIC_NFT_BRIDGE_ENABLED } from '$env/static/public'; | ||
import { classNames } from '$libs/util/classNames'; | ||
import { activeBridge } from './state'; | ||
import { BridgeTypes } from './types'; | ||
let classes = classNames('space-x-2', $$props.class); | ||
$: isERC20Bridge = $page.route.id === '/'; | ||
$: isNFTBridge = $page.route.id === '/nft'; | ||
$: isERC20Bridge = $activeBridge === BridgeTypes.FUNGIBLE; | ||
$: isNFTBridge = $activeBridge === BridgeTypes.NFT; | ||
const onBridgeClick = (type: BridgeTypes) => { | ||
activeBridge.set(type); | ||
}; | ||
</script> | ||
|
||
{#if PUBLIC_NFT_BRIDGE_ENABLED === 'true'} | ||
<div class={classes}> | ||
<LinkButton class="py-2 px-[20px]" href="/" active={isERC20Bridge}> | ||
<button | ||
class="{isERC20Bridge ? 'btn-primary' : 'btn-ghost'} px-[28px] py-[14px] rounded-full text-white" | ||
on:click={() => onBridgeClick(BridgeTypes.FUNGIBLE)}> | ||
<span> {$t('nav.token')}</span> | ||
</LinkButton> | ||
</button> | ||
|
||
<LinkButton class="py-2 px-[20px]" href="/nft" active={isNFTBridge}> | ||
<button | ||
class="{isNFTBridge ? 'btn-primary' : 'btn-ghost'} h-[44px] px-[28px] py-[14px] rounded-full text-white" | ||
on:click={() => onBridgeClick(BridgeTypes.NFT)}> | ||
<span> {$t('nav.nft')}</span> | ||
</LinkButton> | ||
</button> | ||
</div> | ||
{/if} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export enum BridgeTypes { | ||
FUNGIBLE = 'FUNGIBLE', | ||
NFT = 'NFT', | ||
} | ||
|
||
export enum NFTSteps { | ||
IMPORT, | ||
REVIEW, | ||
CONFIRM, | ||
} | ||
|
||
export type BridgeType = BridgeTypes; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<script lang="ts"> | ||
export let isActive = false; | ||
export let stepIndex: number; | ||
export let currentStepIndex: number; | ||
</script> | ||
|
||
<li | ||
data-content="" | ||
class="step | ||
{isActive ? 'step-primary' : ''} | ||
{stepIndex < currentStepIndex && !isActive ? 'step-previous' : ''}"> | ||
<slot /> | ||
</li> |
23 changes: 23 additions & 0 deletions
23
packages/bridge-ui-v2/src/components/Stepper/Stepper.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,23 @@ | ||
<script lang="ts"> | ||
import { classNames } from '$libs/util/classNames'; | ||
export let activeStep: number = 0; | ||
const styles = ` | ||
w-full | ||
md:card | ||
md:rounded-[20px] | ||
md:border | ||
md:border-divider-border | ||
dark:md:glassy-gradient-card | ||
dark:md:glass-background-gradient`; | ||
$: classes = classNames(styles, $$props.class); | ||
</script> | ||
|
||
<div class={classes}> | ||
<div class="card-body body-regular gap-0 p-0"> | ||
<ul class="steps my-[30px]"> | ||
<slot {activeStep} /> | ||
</ul> | ||
</div> | ||
</div> |
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,2 @@ | ||
export { default as Step } from './Step.svelte'; | ||
export { default as Stepper } from './Stepper.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
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