-
Notifications
You must be signed in to change notification settings - Fork 683
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
My Account - Create wishlist UI #2766
Merged
Merged
Changes from 13 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
3f44358
Initial stuff
revanth0212 da6bdd3
Added base modal code.
revanth0212 2c7ae95
Added rest of the modal UI.
revanth0212 9c31d60
Using Dialog component.
revanth0212 54cce93
Added prop types.
revanth0212 79f548c
Merge remote-tracking branch 'origin/develop' into revanth/my_account…
revanth0212 ed7ef49
Added useCreateWishList docs.
revanth0212 a5f5598
Added missing wishlist talon docs.
revanth0212 203f2f9
Minor.
revanth0212 fdaf439
Minor.
revanth0212 f830846
Added cancel button classes for extensibility.
revanth0212 7ce6516
Changed buttons css.
revanth0212 94b4a88
Added create wish list tests.
revanth0212 d963651
Added useCreateWishlist tests.
revanth0212 53a5354
Update based on PR comments.
revanth0212 e161727
Addressed PR CSS changes.
revanth0212 79621d4
Merge branch 'develop' into revanth/my_account_create_list
revanth0212 25a4af2
Minor.
revanth0212 78ef7a1
Snapshot update.
revanth0212 9463645
Merge branch 'develop' into revanth/my_account_create_list
dpatil-magento dfd7619
Swapping public and private radio buttons.
revanth0212 2a0d65e
Merge branch 'revanth/my_account_create_list' of https://github.com/m…
revanth0212 49d67ab
Merge branch 'develop' into revanth/my_account_create_list
dpatil-magento File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
packages/peregrine/lib/talons/WishlistPage/useCreateWishlist.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { useState, useCallback } from 'react'; | ||
|
||
/** | ||
* @function | ||
* | ||
* @returns {CreateWishListProps} | ||
*/ | ||
export const useCreateWishlist = () => { | ||
const [isModalOpen, setIsModalOpen] = useState(false); | ||
|
||
const showModal = useCallback(() => { | ||
setIsModalOpen(true); | ||
}, []); | ||
|
||
const hideModal = useCallback(() => { | ||
setIsModalOpen(false); | ||
}, []); | ||
|
||
const createList = useCallback(data => { | ||
// TODO create list mutation is not available yet | ||
// Will be handled in PWA-989 | ||
console.log('Creating wish list with data: ', data); | ||
setIsModalOpen(false); | ||
}, []); | ||
|
||
return { | ||
createList, | ||
isModalOpen, | ||
hideModal, | ||
showModal | ||
}; | ||
}; | ||
|
||
/** | ||
* JSDoc type definitions | ||
*/ | ||
|
||
/** | ||
* Props data to use when rendering the Create Wishlist component. | ||
* | ||
* @typedef {Object} CreateWishListProps | ||
* | ||
* @property {Function} createList Callback to be called while creating new list | ||
* @property {Boolean} isModalOpen Boolean which represents if the create modal is open or not | ||
* @property {Function} hideModal Callback to hide the create modal by modifying the value of isModalOpen | ||
* @property {Function} showModal Callback to show the create modal by modifying the value of isModalOpen | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why @function js doc ?
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.
This is part of the new Docs initiate we have started for the code. I modeled this after @jcalcaben's previous PR. @jcalcaben is this as expected?
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.
@larsroettig this is used to help me auto-generate reference docs from the source code
@revanth0212 yes, this looks like the proper format