-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: add popover to delivery button #10
Merged
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
37bd364
feat: add popover to delivery button
ArthurFerrao 73b25e7
update CHANGELOG.md
ArthurFerrao 2891e55
update CHANGELOG.md
ArthurFerrao 445a252
update @types/react version
ArthurFerrao fd1c48d
feat: close popover on click
ArthurFerrao e12d489
Fix EN, PT and ES translations
sheilagomes 1ba9470
feat: add input in popover to define postal code
ArthurFerrao 999330f
feat: add popover-input as default overlay
ArthurFerrao 1138b60
feat: update messages ids
ArthurFerrao 2236a66
fix: messages ids to postalCodeInput error
ArthurFerrao bf8cf34
update the CHANGELOG.md
ArthurFerrao 4313028
feat: update popover description text
ArthurFerrao 4b9b2ce
feat: add link to postal code finder website
ArthurFerrao 6f6569b
Merge pull request #11 from vtex-apps/feat/popover-input
ArthurFerrao 351e03b
update changelog
ArthurFerrao 90988e0
update CHANGELOG
ArthurFerrao b51afbd
feat: update description popover to add AddressRules component
ArthurFerrao efb0009
feat: update ES translations
ArthurFerrao 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React from 'react' | ||
import { useCssHandles } from 'vtex.css-handles' | ||
import { Button } from 'vtex.styleguide' | ||
import OutsideClickHandler from 'react-outside-click-handler' | ||
import '../styles.css' | ||
|
||
const CSS_HANDLES = [ | ||
'deliveryPopover', | ||
'popoverPolygonContainer', | ||
'popoverPolygonSvg', | ||
'popoverPolygon', | ||
] as const | ||
|
||
interface Props { | ||
onClick: () => void | ||
handleOutSideClick: () => void | ||
description: string | ||
buttonLabel: string | ||
} | ||
|
||
const DeliveryPopover = ({ | ||
onClick, | ||
description, | ||
buttonLabel, | ||
handleOutSideClick, | ||
}: Props) => { | ||
const handles = useCssHandles(CSS_HANDLES) | ||
|
||
return ( | ||
<OutsideClickHandler onOutsideClick={handleOutSideClick}> | ||
<div className={`${handles.deliveryPopover}`}> | ||
<p className="ma0">{description}</p> | ||
<Button onClick={onClick}>{buttonLabel}</Button> | ||
|
||
<span className={`${handles.popoverPolygonContainer}`}> | ||
<svg | ||
className={`${handles.popoverPolygonSvg}`} | ||
width="25" | ||
height="12" | ||
viewBox="0 0 30 10" | ||
preserveAspectRatio="none" | ||
> | ||
<polygon | ||
className={`${handles.popoverPolygon}`} | ||
points="0,0 30,0 15,10" | ||
/> | ||
</svg> | ||
</span> | ||
</div> | ||
</OutsideClickHandler> | ||
) | ||
} | ||
|
||
export default DeliveryPopover |
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.
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.
Are we on react 18?
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.
Yes, we are. I needed to change the version of @types/react because I had some problems adding the react-outside-click-handler library. The solution I found is to use the same version of react in @types/react.
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.
So, I don't think we are on version 18, but rather on 16, vide:
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 tested in main to confirm if it was caused by any of my changes but in main it is also occurring. I have no idea why this is like this, maybe @hiagolcm has a clue.
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 don't have. I would need to investigate. But since it is just the @types we can just change it to the 16.x
But this issue should be addressed in another PR