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

fix: go back while adding a book #59

Merged
merged 1 commit into from
May 20, 2021
Merged

Conversation

venkivijay
Copy link
Contributor

Issue #54

Copy link
Owner

@Zelig880 Zelig880 left a 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!

resetSelection(){
this.currentStep = 1
this.selectedBook = null
this.$refs.bookSelection.$data.searchText = ""
Copy link
Owner

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.

Copy link
Contributor Author

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.

<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>
Copy link
Owner

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

Copy link
Contributor Author

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.

@Zelig880 Zelig880 merged commit e4a4cd7 into Zelig880:main May 20, 2021
@venkivijay venkivijay deleted the issue-54 branch May 21, 2021 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants