Skip to content

Commit 7cbb636

Browse files
committedFeb 7, 2023
feature: scroll to top when searching
1 parent d594864 commit 7cbb636

File tree

7 files changed

+130
-100
lines changed

7 files changed

+130
-100
lines changed
 

‎CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### 1.4.4
2+
3+
- scroll mew select to top when searching [#341](https://github.com/MyEtherWallet/mew-components/pull/341)
4+
15
### 1.4.3-hotfix.2
26

37
- fix menu popup overflow [#340](https://github.com/MyEtherWallet/mew-components/pull/340)

‎package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@myetherwallet/mew-components",
3-
"version": "1.4.3-hotfix.2",
3+
"version": "1.4.4",
44
"description": "MEW Components",
55
"main": "dist/mew-components.umd.js",
66
"module": "dist/mew-components.esm.js",

‎src/components/MewMenuPopup/MewMenuPopup.vue

+11-11
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
:src="btnIcon"
2727
alt="Icon"
2828
:class="btnTitle ? 'mr-2' : ''"
29-
/>
29+
>
3030
<span :style="btnTitleStyle">{{ btnTitle }}</span>
3131
</v-btn>
3232

@@ -77,27 +77,27 @@ export default {
7777
},
7878
color: {
7979
type: String,
80-
default: "white",
80+
default: 'white',
8181
},
8282
btnTitle: {
8383
type: String,
84-
default: "",
84+
default: '',
8585
},
8686
btnSize: {
8787
type: String,
88-
default: "large",
88+
default: 'large',
8989
},
9090
btnFontSize: {
9191
type: String,
92-
default: "14px",
92+
default: '14px',
9393
},
9494
btnIcon: {
9595
type: String,
96-
default: "",
96+
default: '',
9797
},
9898
btnIconSize: {
9999
type: String,
100-
default: "30px",
100+
default: '30px',
101101
},
102102
left: {
103103
type: Boolean,
@@ -158,12 +158,12 @@ export default {
158158
toggleMenu() {
159159
this.show = !this.show;
160160
if (this.show) {
161-
window.addEventListener("click", this.detactOutsideClick);
161+
window.addEventListener('click', this.detactOutsideClick);
162162
} else {
163-
window.removeEventListener("click", this.detactOutsideClick);
163+
window.removeEventListener('click', this.detactOutsideClick);
164164
}
165165
166-
this.$emit("input", this.show);
166+
this.$emit('input', this.show);
167167
},
168168
// =============================================================================
169169
// Whenever outside of menu content window is clicked, close the menu
@@ -181,7 +181,7 @@ export default {
181181
)
182182
) {
183183
this.show = false;
184-
window.removeEventListener("click", this.detactOutsideClick);
184+
window.removeEventListener('click', this.detactOutsideClick);
185185
}
186186
},
187187
},

‎src/components/MewOverlay/MewOverlay.vue

+46-24
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@
1818
class="mobile-title-block pa-3 d-flex align-center justify-space-between full-width"
1919
>
2020
<div style="min-width: 36px">
21-
<v-btn v-if="back" icon color="textBlack2" @click="back">
21+
<v-btn
22+
v-if="back"
23+
icon
24+
color="textBlack2"
25+
@click="back"
26+
>
2227
<v-icon size="24">
2328
mdi-arrow-left
2429
</v-icon>
@@ -31,8 +36,16 @@
3136
{{ title }}
3237
</h3>
3338
<div style="min-width: 36px">
34-
<v-btn v-if="close" icon color="textBlack2" @click="close">
35-
<v-icon size="24" color="textBlack2">
39+
<v-btn
40+
v-if="close"
41+
icon
42+
color="textBlack2"
43+
@click="close"
44+
>
45+
<v-icon
46+
size="24"
47+
color="textBlack2"
48+
>
3649
mdi-close
3750
</v-icon>
3851
</v-btn>
@@ -78,11 +91,17 @@
7891
]"
7992
@click="close"
8093
>
81-
<v-icon size="24" color="textBlack2">
94+
<v-icon
95+
size="24"
96+
color="textBlack2"
97+
>
8298
mdi-close
8399
</v-icon>
84100
</v-btn>
85-
<v-container :class="['ma-0 pa-0', isMobile ? 'full-height' : '']" fluid>
101+
<v-container
102+
:class="['ma-0 pa-0', isMobile ? 'full-height' : '']"
103+
fluid
104+
>
86105
<!-- ===================================================================================== -->
87106
<!-- White sheet (displays on the overlay - size is based on the contentSize prop) -->
88107
<!-- ===================================================================================== -->
@@ -106,8 +125,8 @@
106125
isMobile
107126
? 'mew-heading-2 ml-3'
108127
: isMobile && !back
109-
? 'mew-heading-2 ml-4'
110-
: 'mew-subtitle',
128+
? 'mew-heading-2 ml-4'
129+
: 'mew-subtitle',
111130
]"
112131
>
113132
{{ title }}
@@ -131,7 +150,10 @@
131150
<!-- ===================================================================================== -->
132151
<!-- Footer -->
133152
<!-- ===================================================================================== -->
134-
<v-row justify="center" class="ma-0 py-8 textMedium--text">
153+
<v-row
154+
justify="center"
155+
class="ma-0 py-8 textMedium--text"
156+
>
135157
{{ footer.text }}
136158
<a
137159
v-if="footer && footer.linkTitle && footer.link"
@@ -150,14 +172,14 @@
150172

151173
<script>
152174
const sizes = {
153-
small: "small",
154-
medium: "medium",
155-
large: "large",
156-
xlarge: "xlarge",
175+
small: 'small',
176+
medium: 'medium',
177+
large: 'large',
178+
xlarge: 'xlarge',
157179
};
158180
159181
export default {
160-
name: "MewOverlay",
182+
name: 'MewOverlay',
161183
props: {
162184
/**
163185
* Displays on the outside bottom of the white sheet.
@@ -184,7 +206,7 @@ export default {
184206
*/
185207
title: {
186208
type: String,
187-
default: "",
209+
default: '',
188210
},
189211
/**
190212
* Function that gets triggered
@@ -212,7 +234,7 @@ export default {
212234
*/
213235
contentSize: {
214236
type: String,
215-
default: "small",
237+
default: 'small',
216238
},
217239
},
218240
data() {
@@ -228,18 +250,18 @@ export default {
228250
if (this.contentSize) {
229251
switch (this.contentSize.toLowerCase()) {
230252
case sizes.small:
231-
return "384px";
253+
return '384px';
232254
case sizes.medium:
233-
return "504px";
255+
return '504px';
234256
case sizes.large:
235-
return "624px";
257+
return '624px';
236258
case sizes.xlarge:
237-
return "744px";
259+
return '744px';
238260
default:
239-
return "384px";
261+
return '384px';
240262
}
241263
}
242-
return "384px";
264+
return '384px';
243265
},
244266
},
245267
watch: {
@@ -261,12 +283,12 @@ export default {
261283
methods: {
262284
// Remove html element's side bar to fix double sidebar bug
263285
removeHtmlScrollbar() {
264-
const htmlElement = document.querySelector("html");
265-
htmlElement.style.overflow = "hidden";
286+
const htmlElement = document.querySelector('html');
287+
htmlElement.style.overflow = 'hidden';
266288
},
267289
// Restore html element's side bar on exit
268290
restoreHtmlScrollbar() {
269-
const htmlElement = document.querySelector("html");
291+
const htmlElement = document.querySelector('html');
270292
htmlElement.style.overflow = null;
271293
},
272294
},