Skip to content

Commit 54d740f

Browse files
authored
Merge pull request #353 from blocknative/enhancement/modal-button-styles
Enhancement: Modal Button Styles
2 parents c3a9c48 + 39cca26 commit 54d740f

File tree

3 files changed

+35
-14
lines changed

3 files changed

+35
-14
lines changed

src/components/Modal.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
div {
5353
height: 0.66em;
5454
position: absolute;
55-
padding: 0.8em;
55+
padding: 0.25em;
5656
top: 1.33em;
5757
right: 1.33em;
5858
font-size: inherit;

src/elements/Button.svelte

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script lang="ts">
22
import { app } from '../stores'
33
export let onclick: () => void = () => {}
4+
export let position: string
45
</script>
56

67
<style>
@@ -24,11 +25,22 @@
2425
button:hover {
2526
background: #ecf3fc;
2627
}
28+
29+
.bn-onboard-prepare-button-right {
30+
position: absolute;
31+
right: 0;
32+
}
33+
34+
.bn-onboard-prepare-button-left {
35+
position: absolute;
36+
left: 0;
37+
}
2738
</style>
2839

2940
<button
3041
on:click={onclick}
31-
class="bn-onboard-custom bn-onboard-button"
42+
class:bn-onboard-prepare-button-right={position === 'right'}
43+
class:bn-onboard-prepare-button-left={position === 'left'}
3244
class:bn-onboard-dark-mode-link={$app.darkMode}
3345
class:bn-onboard-dark-mode-background-hover={$app.darkMode}>
3446
<slot />

src/views/WalletCheck.svelte

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,11 @@
103103
}) => {
104104
// no result then user has passed all conditions
105105
if (!result.modal) {
106-
blocknative && blocknative.event({
107-
categoryCode: 'onboard',
108-
eventCode: 'onboardingCompleted'
109-
})
106+
blocknative &&
107+
blocknative.event({
108+
categoryCode: 'onboard',
109+
eventCode: 'onboardingCompleted'
110+
})
110111
111112
handleExit(true)
112113
@@ -120,10 +121,11 @@
120121
currentModule = result.module
121122
122123
// log the event code for this module
123-
blocknative && blocknative.event({
124-
eventCode: activeModal.eventCode,
125-
categoryCode: 'onboard'
126-
})
124+
blocknative &&
125+
blocknative.event({
126+
eventCode: activeModal.eventCode,
127+
categoryCode: 'onboard'
128+
})
127129
128130
// run any actions that module require as part of this step
129131
if (activeModal.action) {
@@ -295,7 +297,10 @@
295297
/* .bn-onboard-prepare-button-container */
296298
div {
297299
display: flex;
298-
justify-content: space-between;
300+
justify-content: center;
301+
align-items: center;
302+
min-height: 2.5rem;
303+
position: relative;
299304
}
300305
301306
section {
@@ -336,19 +341,23 @@
336341

337342
<div class="bn-onboard-custom bn-onboard-prepare-button-container">
338343
{#if activeModal.button}
339-
<Button onclick={activeModal.button.onclick}>
344+
<Button position="left" onclick={activeModal.button.onclick}>
340345
{activeModal.button.text}
341346
</Button>
342347
{/if}
343348
{#if errorMsg}
344-
<Button onclick={doAction}>Try Again</Button>
349+
<Button position={!activeModal.button && 'left'} onclick={doAction}>
350+
Try Again
351+
</Button>
345352
{:else}
346353
<div />
347354
{/if}
348355
{#if loading}
349356
<Spinner />
350357
{/if}
351-
<Button onclick={() => handleExit(false)}>Dismiss</Button>
358+
<Button position="right" onclick={() => handleExit(false)}>
359+
Dismiss
360+
</Button>
352361
</div>
353362
</Modal>
354363
{/if}

0 commit comments

Comments
 (0)