Skip to content

Commit

Permalink
basic dynamic stepper
Browse files Browse the repository at this point in the history
  • Loading branch information
KorbinianK committed Sep 25, 2023
1 parent b9281d7 commit 7616048
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 4 deletions.
4 changes: 3 additions & 1 deletion packages/bridge-ui-v2/src/components/Card/Card.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@

<div class={classes}>
<div class="card-body body-regular p-4 md:p-[50px] gap-0">
<h2 class="card-title title-screen-bold">{title}</h2>
{#if title}
<h2 class="card-title title-screen-bold">{title}</h2>
{/if}
{#if text}
<p>{text}</p>
{/if}
Expand Down
13 changes: 13 additions & 0 deletions packages/bridge-ui-v2/src/components/Stepper/Step.svelte
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 packages/bridge-ui-v2/src/components/Stepper/Stepper.svelte
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>
2 changes: 2 additions & 0 deletions packages/bridge-ui-v2/src/components/Stepper/index.ts
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';
18 changes: 15 additions & 3 deletions packages/bridge-ui-v2/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,20 @@
"bridge": {
"title": {
"default": "Bridge Token",
"nft": "Bridge NFT"
"nft": {
"import": "Import NFT",
"review": "Review",
"confirm": "Confirm"
}
},
"description": {
"default": "Send your assets across chains.",
"nft": {
"import": "Transfer your NFTs across chains",
"review": "Verify your NFT details.",
"confirm": "Confirm your NFT details."
}
},
"description": "Send your assets across chains.",
"actions": {
"approve": {
"tx": "Transaction sent to approve {token} tokens. Click <a href=\"{url}\" target=\"_blank\"><b>here</b></a> to see it in the explorer.",
Expand Down Expand Up @@ -48,7 +59,8 @@
"approved": "Approved",
"bridge": "Bridge",
"bridging": "Bridging",
"import": "Fetch NFT data"
"fetch": "Fetch NFT data",
"import": "Import"
}
},
"recipient": {
Expand Down
31 changes: 31 additions & 0 deletions packages/bridge-ui-v2/src/styles/override.css
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,34 @@ input[type='number'] {
flex-direction: column;
align-items: center;
}

.step:after {
height: 0px !important;
width: 0px !important;
}

.step-primary:after {
height: 8px !important;
width: 8px !important;
}

.step:before {
background-color: rgba(255, 198, 233, 0.2) !important;
height: 2px !important;
}

.step-primary:before {
background-color: #e81899 !important;
height: 2px !important;
}

.step-previous:before {
background-color: #e81899 !important;
height: 2px !important;
}

.step-previous:after {
@apply step-primary;
height: 0px !important;
width: 0px !important;
}

0 comments on commit 7616048

Please sign in to comment.