-
Notifications
You must be signed in to change notification settings - Fork 18
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
fix: go back while adding a book #59
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing first PR!
Just to let you know, the code was perfectly working and the provided comment are just set to keep a clean code and provide better guidance for future development!
resources/js/pages/bookshelf/add.vue
Outdated
resetSelection(){ | ||
this.currentStep = 1 | ||
this.selectedBook = null | ||
this.$refs.bookSelection.$data.searchText = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead than set the SearchText, I would invoke the Method "resetSearch" available withint he BookshelfAddStep1. Also add some validation, just in case.
- Add JS validation to make sure that we just call the method if it is loaded (add an If(this.$refs.bookSelection && this.$refs.bookSelection.resetSearch)
- Change this line to call the "resetSearch" instead than reset just the string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should have thought this earlier because just clearing the searchText will not toggle the disabled prop. Made these changes and amended them.
resources/js/pages/bookshelf/add.vue
Outdated
<BookshelfAddStep2 v-if="currentStep >= 2" :disabled="currentStep !== 2" @select="selectCondition" /> | ||
<Button v-if="currentStep === 3" class="float-right mt-6" @click="addToBookshelf">Add to your Bookshelf</Button> | ||
<Button v-if="selectedBook" theme="secondary" color="secondary" class="float-right mt-6" :class="currentStep == 2 ? 'mr-0' : 'mr-6'" @click="resetSelection">Start again</Button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead than add the logic of current step to define the margin right. You could just ALWAYS set Margin left on the Add to your Bookshelf Button!
- Remove the logic in the Reset button for MR
- Add the Margin Left on the Add to your Bookshelf button
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't really guess what I was thinking when I coded this. My bad. Made these changes and amended them.
Issue #54