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

Add clear search button. #152

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion assets/css/frontend.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/frontend.min.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions assets/js/frontend.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/frontend.min.js

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions assets/src/frontend/components/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,17 @@ export default {
}
}

.clear-button {
color: #BDC0C9;
background-color: transparent;
border: none;
height: 35px;

&:hover {
color: #E9485E;
}
}

.search-type {
position: absolute;
top: 0px;
Expand Down
6 changes: 6 additions & 0 deletions assets/src/frontend/components/ProductSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<span class="search-icon flaticon-musica-searcher" v-if="mode == 'product'"></span>
<span class="search-icon flaticon-supermarket-scanner" v-if="mode == 'scan'"></span>
<div class="search-type" v-hotkey="hotkeys">
<button type="button" class="clear-button" v-if="serachInput != ''" @click="clearSearch">X</button>
Copy link

@coderabbitai coderabbitai bot May 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct the typo in the variable name.

- v-model="serachInput"
+ v-model="searchInput"

Committable suggestion was skipped due low confidence.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dear reviewer, this is not a typo but the original variable name.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@daviddaytw, thank you for clarifying the usage of the variable name 'serachInput'. I appreciate your prompt response and will respect the existing naming convention in your codebase. If there's anything else you need, feel free to let me know!

<a href="#" :class="{ active: mode == 'product'}" @click.prevent="changeMode('product')">{{ __( 'Product', 'wepos' ) }}</a>
<a href="#" :class="{ active: mode == 'scan'}" @click.prevent="changeMode('scan')">{{ __( 'Scan', 'wepos' ) }}</a>
</div>
Expand Down Expand Up @@ -155,6 +156,11 @@ export default {
this.$refs.productSearch.blur();
},

clearSearch() {
this.searchClose();
this.serachInput = '';
Copy link

@coderabbitai coderabbitai bot May 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct the typo in the variable name.

- this.serachInput = '';
+ this.searchInput = '';

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
this.serachInput = '';
this.searchInput = '';

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dear reviewer, this is not a typo but the original variable name.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@daviddaytw, thank you for the clarification. I have verified that 'serachInput' is consistently used throughout the ProductSearch.vue file. Therefore, it is indeed the original variable name, and no changes are needed.

Analysis chain

},

onKeyDown() {
jQuery('.product-search-item.selected').next().children('a').focus();
},
Expand Down