-
Notifications
You must be signed in to change notification settings - Fork 21
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
Free Listings + Paid Ads: Add the paid ads previews to the boost product listings section #1650
Free Listings + Paid Ads: Add the paid ads previews to the boost product listings section #1650
Conversation
…eter to be optional
…size since there is an unavoidable increase in this PR
@@ -28,6 +28,7 @@ module.exports = { | |||
'stylelint', | |||
'@wordpress/stylelint-config', | |||
'@pmmmwh/react-refresh-webpack-plugin', | |||
'react-transition-group', |
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.
❓ Just curiosity. Not an issue. Why is needed to add this dependency here?
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 PR uses the same react-transition-group
dependency as the one @woocommerce/components
depends on, so react-transition-group
is not listed in this repo's package.json file. Therefore, this change is to let eslint know it's one of the core modules and to prevent from the eslint error import/no-extraneous-dependencies
.
* @param {boolean} [props.thinnest] Whether to draw a thinnest placeholder. | ||
* @param {boolean} [props.thinner] Whether to draw a thinner placeholder. | ||
* @param {boolean} [props.thicker] Whether to draw a thicker placeholder. |
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 see this just set the height of the placeholder??
Why not just type="thinnest|thinner|thicker" ? Or just do height={unit} and set up the height as we do with the width.
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 forgot the original reason. I probably started with three different values of height and was inspired by the props of Button
component (isPrimary
, isSecondary
, isLink
, etc.). But when adding the color, it was not so ideal to use the same pattern, so I changed to using a single prop with different values.
And it's definitely better to have consistent props for this component. I changed them in c6908de.
P.S. I have double-checked the visual results again with Figma file when doing this change. And some prop values were different from their previous value in this commit since I found them are not the closest ones to the visual design. Not sure if Figma file was changed or if I set the wrong values in the beginning. 😅
* @param {boolean} [props.smaller] Whether to draw a smaller text size. | ||
* @param {boolean} [props.larger] Whether to draw a larger text size. |
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.
💅 Same as the case of thinner/ticker... Why not just set a type prop and add the class name modifier? Or do the inline style mdoification?
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.
Changed in 631e8fe.
❓ Regarding google shopping logo (sorry somehow I don't know how to comment in the file) Shall we check if that is still the Shopping logo we want? I just modified them recently with the new logo |
* Data for compositing ad preview mockups. | ||
* | ||
* @typedef {Object} AdPreviewData | ||
* @property {string} title Price of the product. |
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.
❓ Should this be "Title of the product"?
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.
Thanks for catching this. Fixed in 8e72981.
const { second, callCount, startCountdown } = useCountdown(); | ||
|
||
// TODO: Fetch required data from API. | ||
const product = fallbackProduct; | ||
|
||
const moveBy = useCallback( ( step ) => { | ||
setIndex( ( currentIndex ) => { | ||
return ( currentIndex + step + mockups.length ) % mockups.length; | ||
} ); | ||
}, [] ); | ||
|
||
useEffect( () => { | ||
if ( second === 0 ) { | ||
if ( callCount > 0 ) { | ||
moveBy( 1 ); | ||
} | ||
startCountdown( 5 ); | ||
} | ||
}, [ second, callCount, startCountdown, moveBy ] ); |
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 maybe can be wrapped in some kind of useTimingIndex
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.
Wrapping this to another custom hook sometimes also increases the complexity. In this case, the CampaignPreview
component doesn't have much code, therefore, I think it ok to stay with the current implementation.
…r Placeholder and adjust some values of them to align with visual design. Address #1650 (comment)
@puntope, thanks for the review.
I checked this with the design team, and it's confirmed that the logo is correct for this project. Because it's supposed to be a Google Shopping logo on the ad preview of Google Shopping.
Thanks for catching this. I added some CSS styles for this in 656aeb9. I believe all comments were replied to or fixed. Could you help with another round of code reviews? |
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.
✅ LGTM
💅 One thing I'm missing here and in this feature are the tests
Changes proposed in this Pull Request:
This PR implements the ad previews part of 📌 Boost product listings section in #1610.
Dynamically compositing the ad previews with product and shop data.
💡Please note that there is a very small white border in the fallback image of product cover. It's not a CSS style problem and I will check with the design team later.
Screenshots:
📷 Text ellipsis
📷 Simulation of using product cover from merchant's DB
📷 Simulation of using shop logo from merchant's website
📹 All ad previews and blur animation
Kapture.2022-08-24.at.17.17.08.mp4
Detailed test instructions: